Can the android camera be programmatically set to send gray scale images.
I'm not asking about conversion after the images have been received, I'm asking for a way to programmatically set it like we do with fps, resolution etc.
Are you talking about the built in camera app (via an intent) or inside your app?
If it's the built in camera app, i don't think it's possible, and even if it was , you can't assume it will work the same on all devices, since many of them have customized camera apps.
About camera within your app, yes, you can do it, and there are examples out there how to do show things on the camera based on its content , like this one
Related
I am making an android based app that includes image capturing and displaying it on the screen.
I’m currently using Android Studio to develop this application.
I am developing this app with a Xiaomi RedMi note5A/5. The screen resolution is 1280x720. However, its camera can take a much higher resolution image. Will the phone’s screen resolution be able to display that captured imaged at its best resolution or will it be scaled down to fit 1280x720 due to screen limitations.
I’ve tried looking up the method for getSupportedPreviewSizes() method in the library and attempted to use it. The supported preview sizes are only up to 1280x720. Please advise! Thanks
If the picture has more pixels than the screen, then the image must be scaled or cropped in order to be displayed. An easy way to deal with this is to simply set your picture as the source of an ImageView. Android will handle the scaling, so your image can fit the view. See below for a simple example.
myImageView.setImageBitmap(pictureBmp);
I'm using a standard MediaStore.ACTION_VIDEO_CAPTURE Intent call (e.g. the one on the Developer site or lots of StackOverflow threads) to record some video. I'm testing it on a (real) Nexus 7 (API 21) and it works fine...so long as the device's display is in a landscape orientation when the (native) Android camera app starts up. If it is portrait, reverse-portrait or reverse-landscape, the camera app stops part way through its initialization ("Unfortunately, Camera has stopped") and control returns to my app. The camera app is happy to reorient to portrait once it has initialized in landscape, however. And if I use MediaStore.ACTION_IMAGE_CAPTURE, it'll start in portrait or landscape.
I know that I can fix the orientation of my app to landscape and I know that I can request the camera to record in landscape, but if the user happens to be holding the device in portrait anyway, the screen rotates to vertical during the transition, as my app releases control to the camera app. The camera app then receives control while the orientation is portrait and it doesn't like it and stops. The issue is not due to a change of orientation -- even if I keep everything locked to portrait throughout, the camera app cancels part-way through its initialization routine.
Is there a way to avoid this happening (while still using the camera via Intent)?
(PS I notice from here, about bespoke camera routines: "Note: A camera preview does not have to be in landscape mode..." and goes on to explain how to make that happen. Does that mean that the "Intent" implementation does?)
Is there a way to avoid this happening (while still using the camera via Intent)?
No.
More specifically, there are thousands of possible camera apps -- preloaded or installed by users -- that could claim to support ACTION_VIDEO_CAPTURE, and any of them can have bugs as this one does. There is no EXTRA_PLEASE_AVOID_BUGS that you can pass on the Intent to change that (though that'd be really cool...).
I'm using the first method outlined in this answer (https://stackoverflow.com/a/10229228) to invoke the camera app to let the user take a photo and return it to my app. What I want to do is get a series of photos from continuous (burst) shot mode, but invoking the camera app in this way only allows the user to take a single photo.
I have tried adding code to my app to use the camera directly with autofocus set to infinity however it doesn't get anywhere near the performance of continuous shot mode.
Is there something I can add to the intent I'm starting to tell it to use a different mode?
I've tried to start the camera and use it my app - with unsatisfactory results. I followed the sample code provided in the android SDK (the Preview class), and I got bad results - the camera was rotating and when I tried to add a button, it never showed up.
I checked other apps and it looks like the skype app uses the same camera app as the one built into the phone. I want to know how I can implement this in my own app. Any solutions?
I am writing a simple android camera application (SDK version 7). Can I handle camera button like in native camera app, i.e. soft click - focus, and hard click - capture photo ?
Be aware that many android devices do not have physical camera button. It is safer bet to allow the way for the users to use touch screen for both focusing and taking photo.
Anyway, since you mention native camera app, I assume you mean the official camera app. In that case, you can find the source code at https://android.googlesource.com/platform/packages/apps/Camera.git