Questions tagged [android-camera2]

The android.hardware.camera2 package provides an interface to fully control many apsects of camera device, e.g. CameraDevice, CaptureRequest-CaptureResult flow, Surfaces, ProcessingImages, setting camera parameters, setting request parameters and so on. It replaces the deprecated Camera class.

From Android Documentation

This package models a camera device as a pipeline, which takes in input requests for capturing a single frame, captures the single image per the request, and then outputs one capture result metadata packet, plus a set of output image buffers for the request. The requests are processed in-order, and multiple requests can be in flight at once. Since the camera device is a pipeline with multiple stages, having multiple requests in flight is required to maintain full framerate on most Android devices. To enumerate, query, and open available camera devices, obtain a CameraManager instance.

Individual CameraDevices provide a set of static property information that describes the hardware device and the available settings and output parameters for the device. This information is provided through the CameraCharacteristics object, and is available through getCameraCharacteristics(String).

1641 questions
136
votes
7 answers

How to use Android's camera or camera2 API to support old and new API versions without deprecation notes?

The new camera2 API confuses me. I want to develop an app (for Android APIs 10 - 21) which uses the device's camera. As stated here, I should use the "Camera" API. However, when I try to add the "Camera" API (android.hardware.Camera) to the…
Gee
  • 1,465
  • 2
  • 10
  • 7
58
votes
5 answers

Android camera2 face detection

There is not enough info about camera2 face detection mechanism. I used the Camera2 sample from Google: https://github.com/android/camera-samples I set face detection mode to…
34
votes
8 answers

YUV_420_888 interpretation on Samsung Galaxy S7 (Camera2)

I wrote a conversion from YUV_420_888 to Bitmap, considering the following logic (as I understand it): To summarize the approach: the kernel’s coordinates x and y are congruent both with the x and y of the non-padded part of the Y-Plane…
Settembrini
  • 1,366
  • 3
  • 20
  • 32
31
votes
1 answer

Camera2 understanding the sensor and device orientations

I bumped into an issue while trying to implement a touch to focus feature using the Android Camera2. The theory is easy: obtain the tap position in the preview surface map it to the dimensions of the sensor or sensor crop area (in case of a zoom)…
Dude
  • 1,202
  • 21
  • 30
31
votes
6 answers

Access denied finding property "camera.hal1.packagelist"

While using camera in service mobile screen is getting un-touchable(locked by transparent window ) and only below error is occuring Access denied finding property "camera.hal1.packagelist" what will be the reason and its solution? Please help..
Amin Pinjari
  • 2,129
  • 3
  • 25
  • 53
29
votes
2 answers

Preview callback in Camera2 is significantly slower than in Camera1

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…
Dmitry Zaytsev
  • 23,650
  • 14
  • 92
  • 146
27
votes
4 answers

Memory allocation problems with android application

I have an android application that performs image analysis, which is managed with an IntentService - the process takes a couple of seconds each time and works accurately and quickly. But when the process is repeated in the app around 50 times (as…
Stacker-flow
  • 1,251
  • 3
  • 19
  • 39
27
votes
1 answer

What's the difference between ActivityCompat and ContextCompat?

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…
24
votes
3 answers

Camera2basic app, has very dark preview in Android 6.0 LGG3

The new API, perhaps only on LG G3, seems to have something changed. I'm using the sample code. On my nexus 4, the code runs perfectly, but on LGG3 updated to Android 6.0 it does not. Any ideas? I played with the settings, but no luck, this still…
22
votes
6 answers

Android Camera2 increase brightness

I am using android camera2 in my application to take continuous images, Here when I use camera2 getting image preview brightness very dark compare to original camera. I seen this but there is no similar requirement in that answer. I tried to set…
Shailendra Madda
  • 20,649
  • 15
  • 100
  • 138
18
votes
3 answers

Accessing a USB camera using Android-Camera2 API

I have a UVC camera that want to access and grab frames from in my Android Pie (Android 9) code. This is the code I'm using to enumerate the cameras connected to the Android phone: @Override public void onResume() { CameraManager…
alex papa
  • 616
  • 1
  • 4
  • 10
18
votes
1 answer

Difference Between Camera and Camera2 in Android

I'm building an App which is similar to social media where people can share photos and videos like Instagram. That's why Camera is very important for my app. Now camera2 API is confusing me. I want to run my app on API level 11+ . I know camera2 is…
Fiverr Projects
  • 311
  • 2
  • 4
  • 13
18
votes
4 answers

Android Camera2 front camera

I recently noticed that the Camera API is deprecated and I found the new API called Camera2. I have read the documentation but I don't really understand it. So my question is: how do I preview the front camera with the new camera api? Just a…
YOYOYO
  • 211
  • 1
  • 2
  • 12
17
votes
4 answers

preview stretches in camera2 apis

Following are the screenshots when using texture view in camera2 apis.In full screen the preview stretches,but it works when using lower resolution(second image). How to use this preview in full screen without stretching it.
17
votes
1 answer

Android convert ImageReader Image to YCbCr_420_SP (NV21) byte array using render script?

I am currently working with Javacv which makes use of the public void onPreviewFrame(byte[] data, Camera camera) camera function. Since camera is deprecated, I have been looking into camera2 and MediaProjection. Both of these libraries make use of…
Gooey
  • 4,740
  • 10
  • 42
  • 76
1
2 3
99 100