android-camera2

Android Things - Creating a Camera Preview Session Fails, and no Preview is shown

跟風遠走 提交于 2019-12-10 23:42:27
问题 I am trying to deploy the Android TensorFlow-Lite Example, specifically, the Detector Activity. I have had success in deploying it in a Tablet. The app works great, it is able to detect objects, put a bounding rectangle around it, with a label as well as a confidence level. I then set up my Raspberry Pi 3 Model B Board, installed Android Things in it, connected via ADB, and then deployed the same program from Android Studio. However, the screen I was using for my Rπ board was blank. Upon

Camera2 1440x1080 is maximum

青春壹個敷衍的年華 提交于 2019-12-10 17:53:26
问题 I'm trying to display normal Full HD preview in landscape orientation (1920x1080) using Camera2 , but camera returns 1440x1080 as the highest resolution. With Legacy Camera ( android.hardware.camera ) there was no such issue for the same device. What am I doing wrong? CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE); cameraId = manager.getCameraIdList()[0]; CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);

Android “Permission Denial: can't use the camera”

余生颓废 提交于 2019-12-10 16:19:13
问题 I'm following a tutorial on utilizing the camera in an Android app. I am getting the error "Permission Denial: can't use the camera" when running debug, both on emulator and physical device. I have tried a variety of permissions in my manifest file. It seems most people who have had this error have had a typo, a missing permission, or the permissions not in the right place in their manifest. Here's my manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http:/

Camera2 Set Fixed Resolution

一笑奈何 提交于 2019-12-10 11:47:19
问题 I am using Camera2 API for my creating camera using Android Studio 2.3.May I ask if it is possible to set a fixed camera resolution into my camera? And if it is possible how can I set a fixed camera resolution? I'm really new to camera2 and android studio. I hope someone can help me. Thank you very much. 回答1: Yes, you can use fixed resolution. Only don't run this APK on devices that don't support this camera resolution. For example, InputConfiguration inputConfiguration = new

ImageReader format overridden in some devices

眉间皱痕 提交于 2019-12-09 17:29:13
问题 I have an ImageReader that is used to get the preview frame's data (byte array). It is configured with the recommended image format of YUV_420_888 like so: mPreviewImageReader = ImageReader.newInstance(width, height, ImageFormat.YUV_420_888, 2); When the listener I set in mPreviewImageReader.setOnImageAvailableListener(); is called, I retrieve an image: Image image = reader.acquireLatestImage(); In some phones, I see in the log the following printout with a ImageReader_JNI tag: ImageReader

Recording 60fps video with Camera2(on Android version 21) API

梦想的初衷 提交于 2019-12-09 13:49:39
问题 I'm trying to record a video at 60(or more)fps rate on Camera2(android.hardware.camera2) APIs. Finally, I succeeded recording at 120fps using CameraConstrainedHighSpeedCaptureSession. But it is only targeted at >=120fps use case not for 60fps. Even I tried to record at 60fps using normal capture session(CameraCaptureSession), it only supports <=30fps. I could figure it out through this code below. Range<Integer>[] fpsRanges = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE

What's the difference between ActivityCompat and ContextCompat?

核能气质少年 提交于 2019-12-09 08:30:41
问题 I'm trying to use the Android camera, for API 23 or above, it requires asking for permission at runtime. According to the documentation, I can accomplish that using, ActivityCompat or ContextCompat. I don't understand what are the difference between the two and their trade-offs. Thank you for time. 回答1: I don't understand what are the difference between the two and their trade-offs There's no trade-off really. Not sure why they wrote so - checkSelfPermission() is a method of ContextCompat and

Preview callback in Camera2 is significantly slower than in Camera1

Deadly 提交于 2019-12-09 07:38:18
问题 It is 2017 and I am finally starting switching from Camera1 to Camera2. In Camera1 I was greatly relying on setPreviewCallbackWithBuffer() to perform a real time frame processing, however in Camera2 this works much much slower to the point where it becomes almost unusable. To compare, on Moto G3 Camera1 can easily produce 30-40 FPS while on Camera2 I couldn't get more than 10-15 FPS. Here is how I am creating ImageReader imageReader = ImageReader .newInstance( previewSize.width, // size is

capturing a video using camera2 and MediaRecorder

情到浓时终转凉″ 提交于 2019-12-09 06:53:37
问题 i try to record a video with 2 different resolutions at once. Sometimes all goes well and sometimes the app seems to get stuck in of of the stop() methods of the 2 MediaRecorders. Can someone plz look through my code, wheter i'm doing something wrong? package com.example.android.videorecording; import android.app.Activity; import android.app.AlertDialog; import android.content.Intent; import android.hardware.camera2.params.StreamConfigurationMap; import android.media.MediaCodec; import

How to use zero shutter lag in Android Camera API 2?

眉间皱痕 提交于 2019-12-08 07:00:45
问题 As in title. How to make ZSL still picture with Camera 2 API? Should I only use TEMPLATE_ZERO_SHUTTER_LAG ? Should I also add CONTROL_ENABLE_ZSL in CaptureRequest ? Should I do precapture sequence before taking still? Currently I do not have any particular code, just thinking how do it. 回答1: There is IMHO good example of using Camera 2 API by Android Open Source Project : https://android.googlesource.com/platform/packages/apps/Camera2/+/9c94ab3/src/com/android/camera/one/v2/OneCameraZslImpl