camera2

Android camera2 api touch to focus example?

醉酒当歌 提交于 2021-02-07 02:50:30
问题 Hi I'm using camera2basic example to implement my camera2 application. I can't find any good example to implement touch to focus with camera2 api. Currently the code i'm using for touch to focus is this: private void setFocusArea(MotionEvent event) { if (mCameraId == null) return; CameraManager cm = (CameraManager)getActivity().getSystemService(Context.CAMERA_SERVICE); CameraCharacteristics cc = null; try { cc = cm.getCameraCharacteristics(mCameraId); } catch (CameraAccessException e) { e

Android camera2 jpeg framerate

南楼画角 提交于 2020-07-05 07:56:05
问题 I am trying to save image sequences with fixed framerates (preferably up to 30) on an android device with FULL capability for camera2 (Galaxy S7), but I am unable to a) get a steady framerate, b) reach even 20fps (with jpeg encoding). I already included the suggestions from Android camera2 capture burst is too slow. The minimum frame duration for JPEG is 33.33 milliseconds (for resolutions below 1920x1080) according to characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)

Android camera2: java.lang.IllegalStateException: maxImages (1) has already been acquired, call #close before acquiring more

依然范特西╮ 提交于 2020-07-04 10:48:30
问题 Hello having trouble to fix this issue. I already have a imageReader.close called inside the ImageAvailable callback but still having the error: java.lang.IllegalStateException: maxImages (1) has already been acquired, call #close before acquiring more. Code I have is here: private ImageReader.OnImageAvailableListener imageAvailableListener = new ImageReader.OnImageAvailableListener() { @Override public void onImageAvailable(ImageReader reader) { Image img = mReader.acquireLatestImage();

Turning on/off flash with Android camera2 API not working

折月煮酒 提交于 2020-06-10 05:19:58
问题 I'm creating an Android app with a custom camera and I'm switching to the new camera2 API. I have a button allowing to turn ON and OFF the flash when the back camera is on (without stopping the camera, like any classic camera app). When I tap the flash icon, nothing happens and this is what the logcat returns: D/ViewRootImpl: ViewPostImeInputStage processPointer 0 D/ViewRootImpl: ViewPostImeInputStage processPointer 1 I don't know why it's not working. Here is the code: I have a

Android set camera2 focus only once on beginning of timelapse

房东的猫 提交于 2020-01-05 05:56:10
问题 I want to make simple app that is making captures for timelapse. Finally I have made it. But I am wondering whether it is possible to lock focus only once, on first photo? And later use that saved value about focus (if possible)? Generally it is a good idea? I thought that every several seconds calling lockFocus() is too expensive. While device is placed fixed, motionless. Actually I have code like to google sample code. I am setting CaptureRequest.Builder field CONTROL_AF_TRIGGER to CONTROL

Android Camera2 API Cropping Video

偶尔善良 提交于 2019-12-30 06:55:30
问题 I'm trying to record a video using Android Camera2 API. I'm trying to crop video as a square by setting the SCALER_CROP_REGION in the request builder. I'm using the following code but it doesn't seem to work mCameraDevice.createCaptureSession(surfaces, new CameraCaptureSession.StateCallback() { @Override public void onConfigured( CameraCaptureSession cameraCaptureSession) { mCaptureSession = cameraCaptureSession; try { mIsRecording = true; /////****** this where i'm setting the coping mZoom =

Camera2 get continuous access to camera preview images

本秂侑毒 提交于 2019-12-29 07:13:22
问题 I want to extend an app from Camera1 to Camera2 depending on the API. One core mechanism of the app consists in taking preview pictures at a rate of about 20 pics per second. With Camera1 I realized that by creating a SurfaceView, adding a Callback on its holder and after creation of the surface accessing the preview pics via periodic setOneShotPreviewCallbacks. That was pretty easy and reliable. Now, when studying Camera2, I came "from the end" and managed to convert YUV420_888 to Bitmap

Android - Camera2 : The easiest way to turn on the torch light

这一生的挚爱 提交于 2019-12-25 20:05:19
问题 The simplest way to turn on the torch light was : Camera camera = Camera.open(); Camera.Parameters parameters = camera.getParameters(); parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); camera.setParameters(parameters); camera.startPreview(); The simplest way to turn it off was : Camera camera = Camera.open(); Camera.Parameters parameters = camera.getParameters(); parameters.setFlashMode(Camera.Parameters.FLASH_MODE_OFF); camera.setParameters(parameters); camera.stopPreview(); But,

Android - Camera2 - Turn off pre flash

我怕爱的太早我们不能终老 提交于 2019-12-24 16:27:55
问题 I am trying to build an app that take picture with red eye. I am using Camera2 capture request as CONTROL_AE_MODE_ON_ALWAYS_FLASH. I noticed that while taking picture, pre flash seems happening in the camera and it reduce the red eye in the picture. How can I turn off the pre flash? 来源: https://stackoverflow.com/questions/34334110/android-camera2-turn-off-pre-flash

Taking picture with flash on camera2 gives picture “after” flash occured (i.e without flash)

久未见 提交于 2019-12-23 15:43:46
问题 I based my code on the sample from Google Camera2-Basic and added flash always support. But It looks like the picture is taken right after the flash has occur. I (almost) always get non flashed picture, even though the flash is triggered. The modified preview request builder : mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH); And I also added this control mode to captureStillPicture() captureBuilder.set(CaptureRequest.CONTROL_AE_MODE,