android-camera2

Android Camera2 increase brightness

萝らか妹 提交于 2019-11-29 09:17:20
I am using android camera2 in my application to take continuous images, Here when I use camera2 getting image preview brightness very dark compare to original camera. I seen this but there is no similar requirement in that answer. I tried to set brightness in camera2 as suggested here : Note that this control will only be effective if android.control.aeMode != OFF. This control will take effect even when android.control.aeLock == true. captureRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); captureRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,

How to create a BottomBar as StickyBottomCaptureLayout in camera2 Android api?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 08:30:15
Context: In the android-7.1.1_r12 api, the android.hardware.camera2 uses a StickyBottomCaptureLayout as a "BottomBar" to display the action buttons (as switch-camera, shutter and recent picture buttons). Whatever the device orientation, this StickyBottomCaptureLayout is displayed always above/near the system bar (which has back, home and other apps buttons). For example, this is what it looks when the rotation degree is 0 or 180 : And, by orienting the device and get a rotation degree as 90 or 270 , the StickyBottomCaptureLayout is now near the system bar: Usually, this above screenshot should

Android convert ImageReader Image to YCbCr_420_SP (NV21) byte array using render script?

≯℡__Kan透↙ 提交于 2019-11-29 07:18:58
问题 I am currently working with Javacv which makes use of the public void onPreviewFrame(byte[] data, Camera camera) camera function. Since camera is deprecated, I have been looking into camera2 and MediaProjection. Both of these libraries make use of the ImageReader class. Currently I instantiate such an ImageReader with the following code: ImageReader.newInstance(DISPLAY_WIDTH, DISPLAY_HEIGHT, PixelFormat.RGBA_8888, 2); And attach an OnImageAvailableListener like this: private final ImageReader

How to convert & rotate raw NV21 array image (android.media.Image) from front cam portrait mode in onImageAvailable (android Camera2)?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 02:46:30
Note: All info in my post only goes for Samsung Galaxy S7 device. I do not know how emulators and other devices behave. In onImageAvailable I convert continuously each image to a NV21 byte array and forward it to an API expecting raw NV21 format. This is how I initialize the image reader and receive the images: private void openCamera() { ... mImageReader = ImageReader.newInstance(WIDTH, HEIGHT, ImageFormat.YUV_420_888, 1); // only 1 for best performance mImageReader.setOnImageAvailableListener( mOnImageAvailableListener, mBackgroundHandler); ... } private final ImageReader

camera2 captured picture - conversion from YUV_420_888 to NV21

烂漫一生 提交于 2019-11-28 13:04:36
Via the camera2 API we are receiving an Image object of the format YUV_420_888 . We are using then the following function for conversion to NV21 : private static byte[] YUV_420_888toNV21(Image image) { byte[] nv21; ByteBuffer yBuffer = image.getPlanes()[0].getBuffer(); ByteBuffer uBuffer = image.getPlanes()[1].getBuffer(); ByteBuffer vBuffer = image.getPlanes()[2].getBuffer(); int ySize = yBuffer.remaining(); int uSize = uBuffer.remaining(); int vSize = vBuffer.remaining(); nv21 = new byte[ySize + uSize + vSize]; //U and V are swapped yBuffer.get(nv21, 0, ySize); vBuffer.get(nv21, ySize, vSize

Android Camera2 capture image skewed

怎甘沉沦 提交于 2019-11-28 12:33:28
Update : This looks like it's related to this: Image data from Android camera2 API flipped & squished on Galaxy S5 - I consider this as a bug since Nexus 5/6 works correctly and it makes no sense to need to obtain full sensor size and then cropping manually to reach the desired aspect ratio, might as well not using "supported" output sizes as well! Problem: Get characteristics of a camera using Camera2 API, and extract output sizes suitable for a MediaCodec.class Create a MediaCodec input surface with one of the suitable camera output sizes. Feed the output to some MediaMuxer or whatever, to

Full screen preview camera2Basic Example Project

╄→гoц情女王★ 提交于 2019-11-28 11:29:40
问题 I'm trying to modify Google's camera2Basic example code. I removed the <FrameLayout/> containing the "Picture" and "Info" button in an attempt to make the <TextureView/> full screen. However, the preview does not fill the entire screen, there remains a black bar below it. I believe this has something to do with the AutoFitTextureView that it ships with but since they haven't provided any documentation on how it works I am unable to make modifications to it. 回答1: I noticed this exact same

Camera2 API Set Custom White Balance & Temperature Color

本秂侑毒 提交于 2019-11-28 09:31:10
I'm trying to set a custom value for the White Balance & temperature color in my camera app. I'm using camera2 API and I'm trying different ways to set this value. I found a method from a excel file to get the right RGB Temperature matrix [Red,Green,Blue] from the White Balance Value between 100 and 100.000. I attached this method to a Seekbar and its working fine, my problem appear when I try to focus something white, then it becomes pink. Any kind of light looks like a pink torch in the screen. I'm setting the values in this way: mPreviewRequestBuilder.set(CaptureRequest.COLOR_CORRECTION

Android Turn on/off Camera Flash Programatically with Camera2

泪湿孤枕 提交于 2019-11-28 08:50:29
I am making a simple application that acts as a flashlight. I need to be able to turn on and off the flash from a button in the application with the Camera2 API, as I get errors with the old camera API. I would like to use a "torch" flashlight, where the camera doesn't have to open in order for the flash to turn on. I know it's possible, as lots of phones have a flash on/off in the quick settings menu, but I can't find any code or tutorials about how to do this. Code: Camera cam = Camera.open(); Parameters p = cam.getParameters(); p.setFlashMode(Parameters.FLASH_MODE_TORCH); cam.setParameters

How to create a BottomBar as StickyBottomCaptureLayout in camera2 Android api?

大城市里の小女人 提交于 2019-11-28 02:04:16
问题 Context: In the android-7.1.1_r12 api, the android.hardware.camera2 uses a StickyBottomCaptureLayout as a "BottomBar" to display the action buttons (as switch-camera, shutter and recent picture buttons). Whatever the device orientation, this StickyBottomCaptureLayout is displayed always above/near the system bar (which has back, home and other apps buttons). For example, this is what it looks when the rotation degree is 0 or 180 : And, by orienting the device and get a rotation degree as 90