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 using this project android-camera2-secret-picture-taker to capture image without open camera view, but the captured images is very bad like this
any help to make this better?
thanks
[Edit]
I tried other phones and it works fine, I take this bad images on Huawei Y6II only and I don't know why? the phone camera is 13 mpx and works fine with native camera app.
Did you issue only a single capture request to the camera device? (No free-running preview or such).
Generally, the auto-exposure, focus, and white-balance routines take a second or so of streaming before they stabilize to good values.
Even if you don't want a preview on screen, you need to request 10-30 frames of data from the camera to start before you save a final image. Or to be more robust, set a repeating request targeting some low-resolution SurfaceTexture, and wait until the CaptureResult CONTROL_AE_STATE / AWB_STATE fields reach CONVERGED, and the AF_STATE field is what you want as well (depends on what AF mode you're using). Then capture your image.
This is a wildly blind guess, but hey, worth a try.
If you used some code snippet from the web which suggests to get a list of supported image sizes and just pick the first one - well this has backfired for me on Huawei devices (more than one model) because Huawei seems to provide the list in the ascending order of resolution (i.e. smallest-first), whereas most other devices I've seen does that in descending order (i.e. largest-first).
So if this is a resolution issue, it might be worth a check.
I am working on an Android app mainly based around the camera of the device. I am able to launch and use the Camera Intent but I would like to know if there is a way to customize this camera screen. I mean, for the moment, the camera preview screen displays all the settings of the camera, I would like to be able to hide them. If possible, I would also like to add new buttons on this screen, so I could launch popups or display a message to the user. Is it possible or should I try to use an external library which handles that ?
Basically, I would like to have a camera screen which would look like the one from the Snapchat Android app.
Thanks!
I would like to know if there is a way to customize this camera screen
No. After all, there are several hundred possible applications that you could be launching, and none of them have to offer any sort of API for the control that you want.
I would like to have a camera screen which would look like the one from the Snapchat Android app.
Then use the camera APIs directly (e.g., android.hardware.Camera) and write your own camera app.
Currently my application uses android.provider.MediaStore.ACTION_VIDEO_CAPTURE intent to capture a video, but it seems I can't programatically set the maximum resolution (for example 720p).
Are there any methods/libraries to mimic this behavior, but at the same time with resolution control? Or should I create custom capture myself using MediaRecorder, SurfaceView etc?
If anyone is wondering I've switched to https://github.com/JeroenMols/LandscapeVideoCamera/
This really allowed to change only a couple lines of code to work. The downsize is that it supports only landscape mode. But maybe this is a plus, since less people would record vertical videos.
In one of my application i need to record video of my own screen.
I need to make a video in that user can take video of their app how it possible?
first question is it possible so? if yes then how? any useful links or some help
Thanks
Pragna Bhatt
Yes, it is possible, but with certain limitations. I have done it in one of my projects.
Android 4.4 adds support for screen recording. See here
If you are targeting lower versions, you can achieve it, but it will be slow. There is no direct or easy way to do it. What you will do is, create drawable from your view/layout. Convert that drawable to YUV format and send it to camera (see some library where you can give custom yuv image to camera), camera will play it like a movies, you can save that movies to storage. Use threads to increase frame-rate (new multi-core device will have high frame-rate).
Only create drawable (from view) when there is any change in view or its children, for that you can use Global Layout Listener. Otherwise send same YUV image to camera.
Limitation:
You can not create video of more than one activities (at a time), or their transactions, because you are creating image from view. (Work on it yourself, may be you'll find a way)
You can not increase frame rate from a certain point, because it depends on hardware of your device.
I am wondering whether it is possible to set the size of the Android camera's frame through the native camera app. The goal is to be able to take pictures of a certain format (where height == width). I have looked at the official documentation but it seems that the only parameter that can be passed to the intent (ACTION_IMAGE_CAPTURE) is EXTRA_OUTPUT to define the path in which the picture will be saved.
Any idea? (If it's not possible I guess I'll need to let the user crop the picture to make it fit in a given square).
Thanks!
You can customize it, as long as this is format offered by camera service. (See camera API)
But even this does not mean that desired resolution is actually supported. When you are using intent, you are invokinng installed camera appliaction - it may provide some ways of customisation via intent, but it is not defined in standart and not portable between different vendors.
Your best option is to post process image and crop it after it is taken