android-camera2

Searching focus keeps failing with external lens, camera2 api in android

孤人 提交于 2019-12-02 03:50:03
I am using camera2 api for my custom camera. I implemented touch to focus. It is working fine. But when I'm trying to attach external lens, it can't find focus distance, I have to try several times. Native camera works perfectly even with the lens. What else should I consider? Any opinions? please guide. (For the further usage) I ended up the solution using samsung camera sdk . It is working perfectly 来源: https://stackoverflow.com/questions/42090124/searching-focus-keeps-failing-with-external-lens-camera2-api-in-android

Camera2 preview stretched when cropping with SCALER_CROP_REGION

[亡魂溺海] 提交于 2019-12-02 00:09:47
I want to display a preview in fullscreen using camera2 api. The camera size I selected is 4160x3120 (16:9) and my screen is 1080x1920 (9:16). Therefore if I want the preview to be right scaled I have to crop the camera output : Rect zoomCrop = new Rect(0, 0, 1755, 3120); captureRequestBuilder.set(CaptureRequest.SCALER_CROP_REGION, zoomCrop); The cropped preview should be of size 1755x3120 which has a ratio of 9:16 as well. Still the preview is streched. Question : Am I using SCALER_CROP_REGION correctly ? If not, how am I supposed to use it ? Thanks in advance I've been struggling with the

Android camera2 api. Setting multiple ImageReader surfaces gives blank output

大城市里の小女人 提交于 2019-12-01 21:13:58
问题 I have a camera2 implementation. The current setup is, it uses a texture view surface to display the actual camera view and an ImageReader surface for capturing images. Now I want to capture preview frames as well. So I tried adding a new ImageReader surface for capturing frames. But when I add that surface to createCaptureSession request, the screen goes blank. What could possibly be wrong? Below is the code that I use to add surfaces to createCaptureSession val surface = preview.surface ?:

CameraCharacteristics SENSOR_INFO_EXPOSURE_TIME_RANGE gives wrong values

杀马特。学长 韩版系。学妹 提交于 2019-12-01 21:01:49
问题 I am using SENSOR_INFO_EXPOSURE_TIME_RANGE to calculate the range of supported exposure time. I tested this in Huawei P30 Pro and it seems like this API is giving wrong values(10000 - 1000000000). But when I use the built in camera app's pro mode, there I can set exposure value to 30s which is really larger than what is provided by the API. Can anyone help me with this? How to get correct values for the range of supported exposure durations? 来源: https://stackoverflow.com/questions/56817053

Android camera2 api. Setting multiple ImageReader surfaces gives blank output

…衆ロ難τιáo~ 提交于 2019-12-01 19:28:37
I have a camera2 implementation. The current setup is, it uses a texture view surface to display the actual camera view and an ImageReader surface for capturing images. Now I want to capture preview frames as well. So I tried adding a new ImageReader surface for capturing frames. But when I add that surface to createCaptureSession request, the screen goes blank. What could possibly be wrong? Below is the code that I use to add surfaces to createCaptureSession val surface = preview.surface ?: throw CameraAccessException(CameraAccessException.CAMERA_ERROR) val previewIRSurface =

Changing Flash setting of Android Camera 2 at runtime

那年仲夏 提交于 2019-12-01 19:20:02
Basically, what I am trying to do is change the CONTROL_AE_MODE by button click in the app. The user can use AUTO flash(ON_AUTO_FLASH), turn if ON(ON_ALWAYS_FLASH), or OFF(CONTROL_AE_MODE_OFF). In this example: https://github.com/googlesamples/android-Camera2Basic/blob/master/Application/src/main/java/com/example/android/camera2basic/Camera2BasicFragment.java Line 818, they set the flash once: // Use the same AE and AF modes as the preview. captureBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE); setAutoFlash(captureBuilder); // Orientation int

Switch flash in Camera2 API

烈酒焚心 提交于 2019-12-01 19:08:16
My problem is when I switch between different flashmodes and then want to capture an image, my captureBuilder won't set the chosen flashmode. It only works when i close and reopen the camera. I took the https://github.com/googlesamples/android-Camera2Basic as a starting point. my method: private void captureStillPicture() { try { final Activity activity = (Activity) context; if (null == activity || null == mCameraDevice) { return; } // This is the CaptureRequest.Builder that we use to take a picture. CaptureRequest.Builder captureBuilder = mCameraDevice.createCaptureRequest(CameraDevice

Android Camera2 API preview sometimes distorted

眉间皱痕 提交于 2019-12-01 12:13:44
I am building a custom camera with the Camera2 API. So far the camera works very well except for the preview which is distorted sometimes. Let's say I open the camera 7 times in a row. All of the attempts are succesful and the 8th time the camera preview is distorted. It looks like it uses the width as the height and vice versa. I have based my code on the Google sample implementation of the camera2 which can be found here . the interesting thing is that even the Google sample implementation has this distorted preview sometimes. I have tried to modify the AutoFitTextureView but nothing was

Android Camera2 API preview sometimes distorted

强颜欢笑 提交于 2019-12-01 11:38:50
问题 I am building a custom camera with the Camera2 API. So far the camera works very well except for the preview which is distorted sometimes. Let's say I open the camera 7 times in a row. All of the attempts are succesful and the 8th time the camera preview is distorted. It looks like it uses the width as the height and vice versa. I have based my code on the Google sample implementation of the camera2 which can be found here. the interesting thing is that even the Google sample implementation

Camera2 API Issue

半城伤御伤魂 提交于 2019-12-01 01:55:58
I make some camera App use camera2 APi example camera2 api google sample, so my camera output not full screen then i read from camera2 api isue to solve that i have to change this in Onmeasure at AUtofitTextureView class: if (width < height * mRatioWidth / mRatioHeight) { from < to > so like here : if (width > height * mRatioWidth / mRatioHeight) { then my camera view fix to fullscreen but Now i have other issue, my capture image is bigger than my preview. please check my screen capture from my app my camera preview not full screen my capture image if camera preview not full screen 3. my