android-camera2

Android application with camera2 library crash on start for SDK19

一世执手 提交于 2019-12-11 15:25:54
问题 I use androidx.camera.camera2 library in my application. This library for SDK 21 and greater. But i want allow users start application for SDK 19 without camera2 support. I check SDK version in my code, but application crash on start. Can i exclude camera2 from dependencies for old SDK? 05-30 12:13:42.318 2000-2000/com.myapp.android E/AndroidRuntime: FATAL EXCEPTION: main Process: com.myapp.android, PID: 2000 java.lang.NoClassDefFoundError: android.util.Size at androidx.camera.camera2.impl

Cannot get Camera2 API touch to focus to work

ぃ、小莉子 提交于 2019-12-11 15:16:26
问题 I'm unable to get the touch to focus to work properly on Camera2 API. On touching I just seem to focus for a second and then it becomes extremely blurred. The phone is a Nexus 5X. Here is my code for touch to focus. private void refocus(MotionEvent event, View view){ //Handler for autofocus callback CameraCaptureSession.CaptureCallback captureCallbackHandler = new CameraCaptureSession.CaptureCallback() { @Override public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest

Can I Make A Background Service That runs at certain intervals of time even after closing the Application

烈酒焚心 提交于 2019-12-11 14:43:33
问题 I am Referring this Application https://github.com/hzitoun/android-camera2-secret-picture-taker. In this Application there are two classes(APictureCapturingService.java & PictureCapturingServiceImpl.java) that takes pictures without preview can these two classes be converted to Background Service that runs always never dies. Is this possible to have camera capturing process as a background service if yes how to proceed? 回答1: I don't know how you are taking picture in your activity but i can

Android Camera2: Auto Focus and Exposure

℡╲_俬逩灬. 提交于 2019-12-11 09:25:13
问题 In my Android camera application I'm using the Camera2 API. The application doesn't show the preview of the Camera, and I've implemented it in a way, when a button on the UI is pressed, it takes an image. But the problem is with auto focus and auto exposure. Simply, I need to camera always focused on the middle of its view. So when building the request, I added following properties: captureBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_AUTO); captureBuilder.set

optical aspect ratio not consistent with supportedPictureSizes

有些话、适合烂在心里 提交于 2019-12-11 07:46:30
问题 I have discovered that certain tablets (e.g. Samsung SM-T210 - Galaxy Tab 3) have equal horizontal and vertical angles of view (implying aspect ratio = 1), while NONE of their camera1.parameters supported picture sizes have an aspect ratio of 1 (closest being 1.33). What's going on? Are pixel pitches different in the x and y directions? Is come kind of cropping always applied? I am testing an augmented reality app, and I need to have a very clear understanding of how an optical point maps

Android camera2 manual flash doesn't always work

怎甘沉沦 提交于 2019-12-11 04:41:49
问题 I'm using the new camera2 api on Android 6.1, sdk 23. I have two requests: a preview and a still image capture request. I'd like to make it so that the flash goes off on every still image request, but without any pre-flash. Right now, my request looks like this: CaptureRequest.Builder requester = mCameraDevice.createCaptureRequest(mCameraDevice.TEMPLATE_STILL_CAPTURE); requester.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH); requester.set(CaptureRequest

Android camera2 createCaptureRequest returns all black pixels when getting YUV_420_888 image

倾然丶 夕夏残阳落幕 提交于 2019-12-11 03:15:56
问题 I have a Android camera2 API preview running ok in Kotlin using suspendCoroutine for all the surface setup and callbacks. But when I try to take a picture 5 seconds after the app starts (TEMPLATE_STILL_CAPTURE, YUV_420_888, smallest res) for some reason it all goes completely black for a moment (even in the preview window) and I get a YUV image full of 0-lum pixels. private suspend fun captureStill(): Image = suspendCoroutine { cont -> val captureRequestStill = cameraDevice

Android Camera2 configure crashes without reporting proper error

不打扰是莪最后的温柔 提交于 2019-12-11 01:47:01
问题 I am trying some preview frame processing on top of camera2basic example from android. createCaptureSession call is failing with no so useful error reporting. Can someone help me understand whats going wrong? Following works and still image capturing works as expected mCameraDevice.createCaptureSession(Arrays.asList(surface, mImageReader.getSurface()), Following also works with my custom frame processing happening mPreviewRequestBuilder.addTarget(mFrameReader.getSurface()); mCameraDevice

How to set the ''CONTROL_AE_EXPOSURE_COMPENSATION'' in Camera2 API on Android?

陌路散爱 提交于 2019-12-11 01:04:55
问题 I'm currently working on Androids Camera 2 API and my current problem is, that I cannot set the "CONTROL_AE_EXPOSURE_COMPENSATION". My code: -1.0 < exposureAdjustment <1.0 public void setExposure(double exposureAdjustment) { Range<Integer> range1 = mCameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE); int minExposure = range1.getLower(); int maxExposure = range1.getUpper(); float newCalculatedValue = 0; if (exposureAdjustment >= 0) { newCalculatedValue = (float)

How to check whether given Camera is regular camera or wide angle camera?

不想你离开。 提交于 2019-12-11 00:39:58
问题 Is there any way to detect whether the given camera is regular camera or wide angle camera? With devices like Oppo, Vivo, LG, etc. they provide the access to each of their camera using Camera2 API. but how to know which camera is primary camera and which camera is wide angle camera? 回答1: You can calculate the field of view of each camera, and decide if it's wide enough to count. The standard formula for horizontal field of view in degrees is: FOV = 2 * arctan(sensor_width / (2 * lens_focal