Questions tagged [camera2]

142 questions
26
votes
2 answers

Use of camera2 versus deprecated Camera - what is best practice?

I'm writing an app for which the camera is an essential feature. In this regard I want to be 100% certain about the following aspects: If I use the deprecated camera: will the app still run on all APIs now? If 1) is yes: At what point in time this…
Settembrini
  • 1,366
  • 3
  • 20
  • 32
19
votes
3 answers

Android camera 2 api BufferQueue has been abandoned

I am testing with new Android camera2 API and I want control each frame from camera. What I do for this is create an ImageReader and set up resolution and image format. ImageReader imageReader =…
mr.leo
  • 351
  • 2
  • 4
  • 9
19
votes
3 answers

Android camera2: java.lang.IllegalStateException: maxImages (1) has already been acquired, call #close before acquiring more

Hello having trouble to fix this issue. I already have a imageReader.close called inside the ImageAvailable callback but still having the error: java.lang.IllegalStateException: maxImages (1) has already been acquired, call #close before acquiring…
LittleFunny
  • 8,155
  • 15
  • 87
  • 198
16
votes
2 answers

Get full screen preview with Android camera2

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…
J.M.
  • 691
  • 3
  • 7
  • 15
16
votes
1 answer

Access high fps camera on Android

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"…
scrpn
  • 193
  • 1
  • 2
  • 8
15
votes
2 answers

Camera2 API - How to set long exposure times

I'm trying to capture images with 30 seconds exposure times in my app (I know it's possible since the stock camera allows it). But SENSOR_INFO_EXPOSURE_TIME_RANGE (which it's supposed to be in nanoseconds) gives me the range : 13272 - 869661901 in…
KillDash9
  • 879
  • 1
  • 8
  • 21
13
votes
2 answers

Android Camera2 API switch back - front cameras

I'm creating a custom camera capturing videos with the new camera2 API. My code is strongly inspired from the code provided by Google here. My camera preview has a button to switch from back to front camera and then from front to back camera. The…
J.M.
  • 691
  • 3
  • 7
  • 15
12
votes
3 answers

Android Camera2 API YUV_420_888 to JPEG

I'm getting preview frames using OnImageAvailableListener: @Override public void onImageAvailable(ImageReader reader) { Image image = null; try { image = reader.acquireLatestImage(); Image.Plane[] planes = image.getPlanes(); …
Volodymyr Kulyk
  • 6,455
  • 3
  • 36
  • 63
12
votes
2 answers

60/120fps preview data on an Android device?

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…
twerdster
  • 4,977
  • 3
  • 40
  • 70
12
votes
2 answers

Camera2 API onCaptureComplete() is called but camera state is still CONTROL_AE_STATE_PRECAPTURE

I'm trying to create an app that takes some photos from a service using the camera2 API. I can get the app to take pictures fine from a fragment based on the Camera2Basic sample. But when I try move to a service the image doesn't finish capturing…
user2128112
  • 299
  • 4
  • 13
11
votes
1 answer

Use rear facing dual camera in Android

I'm trying to capture using both of the rear facing cameras on my xiaomi mi 5s plus. When I'm trying to iterate through the id's of the cameras using camera2 api, I only get 2 id's, one for the front facing camera and one for the rear one. I've…
Petru
  • 500
  • 6
  • 19
10
votes
2 answers

Android camera2 API get focus distance in AF mode

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?
techneer
  • 147
  • 1
  • 6
10
votes
1 answer

Manual focus in camera2, android

i am looking for an example of manual focus in camera2 in android. I tried to get minimum focus distance and available focal lengths shown below, but it didn't help. How to control the focus distance ? float minimumLens =…
user0770
  • 797
  • 3
  • 11
  • 22
9
votes
1 answer

Android camera2 api touch to focus example?

Hi I'm using camera2basic example to implement my camera2 application. I can't find any good example to implement touch to focus with camera2 api. Currently the code i'm using for touch to focus is this: private void setFocusArea(MotionEvent…
Zaeem Adil
  • 77
  • 1
  • 5
9
votes
5 answers

Turning on/off flash with Android camera2 API not working

I'm creating an Android app with a custom camera and I'm switching to the new camera2 API. I have a button allowing to turn ON and OFF the flash when the back camera is on (without stopping the camera, like any classic camera app). When I tap the…
J.M.
  • 691
  • 3
  • 7
  • 15
1
2 3
9 10