Questions tagged [camera2]

142 questions
8
votes
2 answers

CameraDevice failing to create session [Camera2]

I'm trying to use the Camera2 API to stream camera data to a SurfaceView. I'm following this guide: Camera2 guide I cannot get past step 5 MainActivity.java::onCreate() setContentView(R.layout.activity_main); surfaceView =…
Arbitur
  • 38,684
  • 22
  • 91
  • 128
7
votes
2 answers

Android camera2 jpeg framerate

I am trying to save image sequences with fixed framerates (preferably up to 30) on an android device with FULL capability for camera2 (Galaxy S7), but I am unable to a) get a steady framerate, b) reach even 20fps (with jpeg encoding). I already…
TobiasWeis
  • 491
  • 6
  • 14
7
votes
0 answers

Video encoded using camera2 is upside down on nexus (5x, 6p) devices

We are using camera2 API to get preview and encode video simultaneously, using mediacodec. We know when we should rotate the camera by querying 'CameraCharacteristics.SENSOR_ORIENTATION' but there is only preview rotation option. What we need is to…
eduard
  • 309
  • 3
  • 9
7
votes
2 answers

Android Camera2 API - Detect when we have focus

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…
Hiam
  • 303
  • 1
  • 4
  • 12
6
votes
1 answer

android Camera2 API + TextureView overlay for drawing on camera preview

So, I need to overlay the camera2 preview and draw a rectangle on the preview video image by layering a transparent overlay on top. I started with a basic Camera2 code here: https://github.com/googlesamples/android-Camera2Basic the above use…
David
  • 315
  • 3
  • 14
6
votes
1 answer

Android camera2 tap to focus

Trying to implement tap to focus using camera2api. CaptureRequest.Builder afBuilder = mPreviewBuilder; Rect newRect=new Rect(0,0,200,200); MeteringRectangle meteringRectangle=new MeteringRectangle(newRect,METERING_WEIGHT_DONT_CARE); …
6
votes
4 answers

Flashlight Camera2 API

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…
user3579059
  • 285
  • 1
  • 5
  • 11
6
votes
2 answers

Android: Camera2 Bad argument passed to camera service

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 &&…
LittleFunny
  • 8,155
  • 15
  • 87
  • 198
5
votes
1 answer

How can I draw on a video while recording it in android, and save the video and the drawing?

I am trying to develop an app that allows me to draw on a video while recording it, and to then save both the recording and the video in one mp4 file for later use. Also, I want to use the camera2 library, especially that I need my app to run for…
MarounG
  • 164
  • 3
  • 8
5
votes
0 answers

Proper camera2 YUV_420_888 to JPEG conversion

I know the topic has already appeared multiple times but none of the solutions actually seems to be working, ranging from answers suitable for the old camera API (where the YUV data comes in a neat byte[] array), via corrupted images, to saving…
bosmart
  • 325
  • 3
  • 11
4
votes
0 answers

Speeding up image capture from camera2

I'm working on an Android app, which takes a picture via camera2 api. The problem I'm facing is a huge delay between hitting the "Take picture" button and the actual image capture - somewhere around ~1800-2000ms, which I personally think isn't…
altskop
  • 311
  • 2
  • 12
4
votes
1 answer

Android Camera2 API Cropping Video

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…
man-r
  • 208
  • 3
  • 14
4
votes
1 answer

How do I get a CameraDevice working in camera2?

I've been following the camera2 documentation trying to implement a non-previewed camera with an ImageReader, but when I get to cameraDevice.createCaptureSession(outputs, mccsStateCallback, cameraHandler);, the cameraDevice object is null, even…
Kelyn Ferguson
  • 143
  • 2
  • 7
4
votes
1 answer

Camera2 get continuous access to camera preview images

I want to extend an app from Camera1 to Camera2 depending on the API. One core mechanism of the app consists in taking preview pictures at a rate of about 20 pics per second. With Camera1 I realized that by creating a SurfaceView, adding a Callback…
Settembrini
  • 1,366
  • 3
  • 20
  • 32
4
votes
1 answer

Android Camera2 touch to focus implementation - cancelling on new touch

I'm having issues with my touch-to-focus implementation using Camera2 APIs. Here's my code: mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL); if (isMeteringAreaAESupported()) { …
vkislicins
  • 3,331
  • 3
  • 32
  • 62
1
2
3
9 10