android-camera2

Android Camera2 API Cropping Video

守給你的承諾、 提交于 2019-11-30 23:14:54
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 = getZoomRect(); mPreviewRequestBuilder.set(CaptureRequest.SCALER_CROP_REGION, mZoom); /////////********

Android Camera2 API set custom Brightness, Contrast, Gamma

怎甘沉沦 提交于 2019-11-30 17:27:03
问题 Since this hasn't clear answer, and stackoverflow hasn't questions / answers about Camera 2 API Gamma, I ask for solution to modify Brightness, Contrast and Gamma using Android Camera 2 API. My code to get range and step : Rational controlAECompensationStep = characteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_STEP); if (controlAECompensationStep != null) { compensationStep = controlAECompensationStep.doubleValue(); } Range<Integer> controlAECompensationRange = characteristics

ImageReader makes Camera lag

﹥>﹥吖頭↗ 提交于 2019-11-30 15:25:33
I'm facing a problem where I am using a ImageReader in addition to have a SurfaceView which is used to show the output of the camera. I have added the SurfaceView itself and the surface for the ImageReader like this (and added the ImageReader listeners in order to receive events on new images): preview.addTarget(_surfaces.get(1)); //ImageReader surface preview.addTarget(_surfaces.get(0)); //SurfaceView of the layout However, if I remove the ImageReader the application is working fine (no lagging from the camera). But as soon as the ImageReader surface is added the camera i lagging a lot.

android camera2 handle zoom

匆匆过客 提交于 2019-11-30 13:20:41
问题 I'm new in Android Camera2 API. I just move my all project to the new Camera2 API. I have used the Camera2Basic example as a starting point. I'm now trying handle zoom by adding this: public boolean onTouchEvent(MotionEvent event) { try { CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE); CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraId); float maxZoom = (characteristics.get(CameraCharacteristics.SCALER_AVAILABLE_MAX_DIGITAL

How to lock focus in camera2 api, android?

纵饮孤独 提交于 2019-11-30 13:12:56
问题 I am trying to lock focus after my custom camera finds focus. First it AF mode set to auto: builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_AUTO); And After touching the preview it finds focus distance, and I have to lock AF and AE using this code: builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE); builder.set(CaptureRequest.CONTROL_AE_LOCK, true); Locking AE works fine in any devices. Locking AF is working on Nexus5 and

Camera2 video recording without preview on Android: mp4 output file not fully playable

回眸只為那壹抹淺笑 提交于 2019-11-30 13:08:52
I am trying to record video from the back camera (the one that faces the face) on my Samsung Galaxy S6 (which supports 1920x1080 at about 30 fps). I do not want to have to use any surface for previewing if I do not have to as this is to just happen in the background. I seem to have it working, but the output files are not playable in a way that actually is correct. On my Windows 10 PC, Windows Media Player will show the first frame and then play the audio, VLC will not show any of the frames. On my phone, the recorded file is playable but not totally. It will hold the first frame for 5-8

Android Camera2 API switch back - front cameras

一世执手 提交于 2019-11-30 13:07:10
I'm creating a custom camera capturing videos with the new camera2 API. My code is strongly inspired from the code provided by Google here . My camera preview has a button to switch from back to front camera and then from front to back camera. The "camera preview" activity is launched with the back camera by default. For some reason, when I click on the "switch/swap camera" button for the first time , it brings be to the front camera as it should, BUT everytime I click again, the switch/swap doesn't work anymore: the preview (on the front camera) fades a little bit, like if something is

How to use android camera2 api to record 60 fps video with fixed exposure time

倖福魔咒の 提交于 2019-11-30 09:37:42
问题 I want to implement a app to record 60 fps with fixed exposure time. As device I have the Google Pixel. Since its native camera app can do 60 fps and it has hardware level LEVEL_3, I thought this won't be a problem but I can't get it working. With getSupportedPreviewFpsRange() (from camera api) I get ranges [15, 15], [24, 24], [7, 30], [30, 30] and with getHighSpeedVideoFpsRangesFor (from camera2 api) I get ranges [30, 120], [120, 120], [30, 240], [240, 240], [240, 240] . When I set [60, 60]

Face detection & draw circle using Android Camera2 API

放肆的年华 提交于 2019-11-30 08:49:57
Currently I am trying to convert Camera2.Face to actual view's rect in order to draw circle over the face detected by the Camera2 API. I am able to get number of faces and its data into Callback by below code: private CameraCaptureSession.CaptureCallback mCaptureCallback = new CameraCaptureSession.CaptureCallback() { private void process(CaptureResult result) { Integer mode = result.get(CaptureResult.STATISTICS_FACE_DETECT_MODE); Face [] faces = result.get(CaptureResult.STATISTICS_FACES); if(faces != null && mode != null) Log.e("tag", "faces : " + faces.length + " , mode : " + mode ); }

Android camera2 output to ImageReader format YUV_420_888 still slow

你离开我真会死。 提交于 2019-11-30 08:31:54
问题 I'm trying to get the Android camera2 running in the background service, then process the frame in the callback ImageReader.OnImageAvailableListener. I already use the suggested raw format YUV_420_888 to get max fps, however I only get around 7fps on the resolution 640x480. This is even slower than what I get using the old Camera interface( I want to upgrade to Camera2 to get higher fps ) or with the OpenCV JavaCameraView( I can't use this because I need to run processing in the background