android-camera2

Android Camera2 API stretching the preview

孤街浪徒 提交于 2021-02-04 21:23:10
问题 I am working with the Google sample project, but I cannot seem to get the preview to work without stretching it. public void setAspectRatio(int width, int height) { if (width < 0 || height < 0) { throw new IllegalArgumentException("Size cannot be negative."); } mRatioWidth = width; mRatioHeight = height; requestLayout(); } I have tried physically changing the aspect ration on the AutoFitTextureView class, this makes it full screen, but causes it to stretch. Has anyone figured out a successful

Android Camera2 API Image Color space

为君一笑 提交于 2021-01-28 05:12:44
问题 I used this Tutorial to learn and try understand how to make a simple picture taking android app using the Camera2 API. I have added some snippets from the code to see if you all can help me understand some questions I have. I am trying to find out how the image is saved as. Is it RGB, or BGR? Is it stored in the variable bytes? ImageReader reader = ImageReader.newInstance(width,height,ImageFormat.JPEG, 1); @Override public void onImageAvailable(ImageReader reader) { Image image = null; try {

How to change camera exposure on android?

旧巷老猫 提交于 2021-01-27 20:42:59
问题 I want to perform image processing with OpenCV and android. In the first step, I need to change the camera properties like resolution, exposure, etc. By using OpenCV I only can change the resolution( mOpenCvCameraView.setMaxFrameSize(320,240); ) and cannot change exposure. By using OpenCV and camera2 When I run it, it is crashing(this code: pastebin.com/3XgvKGQN ). How can I change camera exposure? package com.williams.drew.opencvtest; import android.graphics.Paint; import android.hardware

Cropping YUV_420_888 images for Firebase barcode decoding

假装没事ソ 提交于 2021-01-27 06:24:27
问题 I'm using the Firebase-ML barcode decoder in a streaming (live) fashion using the Camera2 API. The way I do it is to set up an ImageReader that periodically gives me Images. The full image is the resolution of my camera, so it's big - it's a 12MP camera. The barcode scanner takes about 0.41 seconds to process an image on a Samsung S7 Edge, so I set up the ImageReaderListener to decode one at a time and throw away any subsequent frames until the decoder is complete. The image format I'm using

Take photo in service using Camera2 API

末鹿安然 提交于 2021-01-21 08:12:50
问题 I am using the camera2 API. I need to take a photo in the service without a preview. It works, but the photos have a bad exposure. The pictures are very dark or sometimes very light. How can I fix my code so that the photos are of high quality? I'm using the front camera. public class Camera2Service extends Service { protected static final String TAG = "myLog"; protected static final int CAMERACHOICE = CameraCharacteristics.LENS_FACING_BACK; protected CameraDevice cameraDevice; protected

Using camera2 API to get single image and display it with ImageView

跟風遠走 提交于 2020-12-31 01:39:02
问题 I want to use Camera2 API to get a single frame from the camera and display it with ImageView. I found some close questions such as https://stackoverflow.com/questions/25462277/camera-preview-image-data-processing-with-android-l-and-camera2-api And also I've looked at Camera2Basic example but it was too complex and not exactly what I needed. I wrote the code, that is based on some examples I saw on the web, that should do it but it doesn't work and I can't figure out why. The app doesn't

Using camera2 API to get single image and display it with ImageView

こ雲淡風輕ζ 提交于 2020-12-31 01:35:37
问题 I want to use Camera2 API to get a single frame from the camera and display it with ImageView. I found some close questions such as https://stackoverflow.com/questions/25462277/camera-preview-image-data-processing-with-android-l-and-camera2-api And also I've looked at Camera2Basic example but it was too complex and not exactly what I needed. I wrote the code, that is based on some examples I saw on the web, that should do it but it doesn't work and I can't figure out why. The app doesn't

How to listen to the cameraX lens facing changes

妖精的绣舞 提交于 2020-12-12 13:26:26
问题 Does camerax provide api for lens facing changes callback? After switching the lens facing camera I want to be notified when it has finished changing and the camera is ready to use. Currently I'm using this dependencies of camerax implementation "androidx.camera:camera-lifecycle:1.0.0-beta01" implementation "androidx.camera:camera-view:1.0.0-alpha08" implementation "androidx.camera:camera-extensions:1.0.0-alpha08" 回答1: Sounds like you need a signal for when the camera starts emitting frames.

How to listen to the cameraX lens facing changes

孤街浪徒 提交于 2020-12-12 13:23:40
问题 Does camerax provide api for lens facing changes callback? After switching the lens facing camera I want to be notified when it has finished changing and the camera is ready to use. Currently I'm using this dependencies of camerax implementation "androidx.camera:camera-lifecycle:1.0.0-beta01" implementation "androidx.camera:camera-view:1.0.0-alpha08" implementation "androidx.camera:camera-extensions:1.0.0-alpha08" 回答1: Sounds like you need a signal for when the camera starts emitting frames.

How to listen to the cameraX lens facing changes

一个人想着一个人 提交于 2020-12-12 13:23:32
问题 Does camerax provide api for lens facing changes callback? After switching the lens facing camera I want to be notified when it has finished changing and the camera is ready to use. Currently I'm using this dependencies of camerax implementation "androidx.camera:camera-lifecycle:1.0.0-beta01" implementation "androidx.camera:camera-view:1.0.0-alpha08" implementation "androidx.camera:camera-extensions:1.0.0-alpha08" 回答1: Sounds like you need a signal for when the camera starts emitting frames.