camera2

Flashlight Camera2 API

為{幸葍}努か 提交于 2019-12-01 12:03:18
Can I use camera preview and flashlight at the same time in Android Camera2 API? When I try use CameraManager.setTorchMode(String cameraId, boolean enabled) it's work fine when camera is not opened. But when Camera is open and I try setTorchMode I receive this exception: CameraService: setTorchMode: torch mode of camera 0 is not available because camera is in use The error is indicating that the camera in question, is already in use. You need to set the FLASH_MODE and CONTROL_AE_MODE accordingly. mPreviewRequestBuilder.set(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_OFF);

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

Flashlight Camera2 API

泪湿孤枕 提交于 2019-12-01 09:06:53
问题 Can I use camera preview and flashlight at the same time in Android Camera2 API? When I try use CameraManager.setTorchMode(String cameraId, boolean enabled) it's work fine when camera is not opened. But when Camera is open and I try setTorchMode I receive this exception: CameraService: setTorchMode: torch mode of camera 0 is not available because camera is in use 回答1: The error is indicating that the camera in question, is already in use. You need to set the FLASH_MODE and CONTROL_AE_MODE

Android 5.x Shutter Speed

霸气de小男生 提交于 2019-12-01 08:07:49
问题 I am trying to get supported shutter speed parameters but I am now sure how to get those ranges. For ISO-values String supportedIsoValues = camParams.get("iso-values"); //supported values, comma separated String System.out.println("supportedIsoValues: " + supportedIsoValues); But I have no idea how to get supported shutter speed. How can I get a supported shutter speed? 回答1: Lets start with Camera from Android Devs. They tell us that starting with API 21 you should move over to android

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 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]

Access high fps camera on Android

微笑、不失礼 提交于 2019-11-29 18:54:22
问题 There are phones with official support for high fps recording, like the Galaxy S5 and S6. I tried both, with both you can record high fps videos (60 or even 120 fps) with the default camera app. (Or on the S6 using Gear VR's "Passthrough Camera" function.) BUT: when you query the camera's capabilities through the standard Android APIs (tried it on both S5 on 4.4 and 5.0 and S6 on 5.1, tried both the old and the new camera2 APIs) in all cases, 30 fps is reported as the highest available. Does

Android Camera2 API switch back - front cameras

醉酒当歌 提交于 2019-11-29 18:51:09
问题 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

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

懵懂的女人 提交于 2019-11-29 16:00:59
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] to CONTROL_AE_TARGET_FPS_RANGE I get error "Fps range [60, 60] in the request is not a supported high