camera2

Android Camera2 API - Detect when we have focus

痴心易碎 提交于 2019-12-06 03:19:16
问题 So, I managed to create the functionality i wanted with the old camera the way I wanted it. With mCamera.autoFocus(autoFocusCallback); i detect when I have focus and run the required code while in preview-mode. Now I have a hard time grasping how to do the same in camera2 API. My first idea was that i'd use private void process(CaptureResult result) { switch (mState) { case STATE_PREVIEW: { // We have nothing to do when the camera preview is working normally. int afState = result.get

Android: Camera2 Bad argument passed to camera service

浪尽此生 提交于 2019-12-05 09:45:09
Can somebody what I have done wrong... I wanted to capture the image which I have a preview screen using SurfaceView. I am able to show the preview on the surface view. This is my code to capture the image if (mCameraSession == null && mCameraDevice == null) return; ImageReader reader = ImageReader.newInstance(mTexturePreviewSize.getWidth(), mTexturePreviewSize.getHeight(), ImageFormat.JPEG, 1); reader.setOnImageAvailableListener(imageAvailableListener, mBackgroundHandler); Surface surface = reader.getSurface(); try { CaptureRequest.Builder requestBuilder = mCameraDevice.createCaptureRequest

Android camera2 API get focus distance in AF mode

独自空忆成欢 提交于 2019-12-05 02:24:42
I'm working with Android camera2 API. I can get focus distance value using LENS_FOCUS_DISTANCE in manual focus mode. However, the property is always zero in AF mode. Is there any way to get focus distance in AF mode? Francisco Durdin Garcia Shortest distance from frontmost surface of the lens that can be brought into sharp focus. If the lens is fixed-focus, this will be 0. http://developer.android.com/intl/es/reference/android/hardware/camera2/CameraCharacteristics.html In other way, if you want to manage focus, remember that LENS_INFO_MINIMUM_FOCUS_DISTANCE give you the minimum focus, but to

60/120fps preview data on an Android device?

孤人 提交于 2019-12-05 00:53:09
We would like to process 120 fps (or 60fps) camera preview data using Neon assembly or GPU shaders to perform a simple image processing operation (eg 3x3 convolution). We are NOT interested in displaying the image on the screen so the camera data should go directly to a SurfaceTexture. We thought we could do this using Camera2 API on a Nexus 5 using CameraConstrainedHighSpeedCaptureSession but have been unsuccessful. There is no currently functional code on the internet (at least the part we have scraped) that allows this and yet it seems probable that the functionality exists. The best

Get full screen preview with Android camera2

穿精又带淫゛_ 提交于 2019-12-04 17:57:50
问题 I'm building a custom camera using the new camera2 API. My code is based on the code sample provided by Google here. I can't find a way to get the camera preview in full screen. In the code sample, they use ratio optimization to adapt to all screens but it's only taking around 3/4 of the screen's height. Here is my code of AutoFitTextureView : public class AutoFitTextureView extends TextureView { private int mRatioWidth = 0; private int mRatioHeight = 0; public AutoFitTextureView(Context

Android camera2 API - Display processed frame in real time

▼魔方 西西 提交于 2019-12-04 14:48:25
I'm trying to create an app that processes camera images in real time and displays them on screen. I'm using the camera2 API. I have created a native library to process the images using OpenCV. So far I have managed to set up an ImageReader that receives images in YUV_420_888 format like this. mImageReader = ImageReader.newInstance( mPreviewSize.getWidth(), mPreviewSize.getHeight(), ImageFormat.YUV_420_888, 4); mImageReader.setOnImageAvailableListener(mOnImageAvailableListener, mImageReaderHandler); From there I'm able to get the image planes (Y, U and V), get their ByteBuffer objects and pass

Android Camera2 API - Detect when we have focus

左心房为你撑大大i 提交于 2019-12-04 09:16:21
So, I managed to create the functionality i wanted with the old camera the way I wanted it. With mCamera.autoFocus(autoFocusCallback); i detect when I have focus and run the required code while in preview-mode. Now I have a hard time grasping how to do the same in camera2 API. My first idea was that i'd use private void process(CaptureResult result) { switch (mState) { case STATE_PREVIEW: { // We have nothing to do when the camera preview is working normally. int afState = result.get(CaptureResult.CONTROL_AF_STATE); //if (CaptureResult.CONTROL_AF_STATE == afState) { Log.d("SOME KIND OF FOCUS",

Access high fps camera on Android

纵饮孤独 提交于 2019-12-03 11:58:21
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 this mean that these phones use private proprietary APIs to access high fps capabilities and there's no

Get full screen preview with Android camera2

半世苍凉 提交于 2019-12-03 11:31:10
I'm building a custom camera using the new camera2 API. My code is based on the code sample provided by Google here . I can't find a way to get the camera preview in full screen. In the code sample, they use ratio optimization to adapt to all screens but it's only taking around 3/4 of the screen's height. Here is my code of AutoFitTextureView : public class AutoFitTextureView extends TextureView { private int mRatioWidth = 0; private int mRatioHeight = 0; public AutoFitTextureView(Context context) { this(context, null); } public AutoFitTextureView(Context context, AttributeSet attrs) { this

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