All Questions
Tagged with android-camera android-camera2
424 questions
0
votes
1
answer
22
views
Magnifier modifier with AndroidView with camera preview
I want to implement the magnifier modifer on my camera preview.
What Im trying right now:
@Composable
fun CameraScreen() {
val previewView = remember { SurfaceView(context) }
Box(Modifier....
1
vote
1
answer
62
views
identify Macro Camera in android smartphone using kotlin/java
I am trying to programmatically check whether the Android Smartphone has the macro camera or not.
Tried CameraManager and through that found the different characteristics of the camera. Than found the ...
0
votes
0
answers
31
views
How to share camera views from one phone to another programatically?
I am building an android application that can open multiple cameras using Camera2 API simultaneously. Now I want to stream the footage of those cameras over RSTP. I found this "libstreaming" ...
0
votes
0
answers
36
views
How to control ArCore camera's focus while in FocusMode.FIXED
I have a very specific task with ArCore and if someone had a similar situation, here is the use case: I have to use ArCore session’s FIXED focus (not AUTO). But then whenever the user clicks to ...
0
votes
0
answers
40
views
Cancelling ListenableFuture returned from ProcessCameraProvider.getInstance(context) call
According to the documentation of ProcessCameraProvider https://developer.android.com/reference/androidx/camera/lifecycle/ProcessCameraProvider#getInstance(android.content.Context) the call to ...
0
votes
1
answer
43
views
Flashlight toggle issue: Android app only turns on the flashlight, not off
I'm developing an Android app that should toggle the flashlight on or off when the app starts. The goal is to switch the flashlight to the opposite state of what it was when the app was launched. ...
1
vote
1
answer
52
views
Camera2 control torch strength
Im playing around with the camera2Video sample (https://github.com/android/camera-samples/tree/main/Camera2Video), and I want to be able to control not just the torch on/off, but also its strength/...
0
votes
0
answers
194
views
Android CameraX Unable to configure camera
I'm trying to create a simple camera app on android, I was following this this (medium.com) guide, but my preview doesn't load, I only get an empty screen.
Error in logcat:
Unable to configure camera ...
0
votes
0
answers
33
views
Android camera2 focus distance step size
I'm developing an Android NDK camera2 app for astrophotography, for which I need the best possible focus. Considering that it is a photo in very low light conditions, with a standard smartphone device,...
0
votes
1
answer
90
views
Replace LegacyCamera with Camera2
In this device with AOSP 10, I have currently the LegacyCamera API for the camera but I want to replace it with Camera2.
What should I change to have it build and install Camera2 by default instead of ...
0
votes
0
answers
110
views
Android - How to display captured image from CameraX full size in ImageView?
I am using Kotlin CameraX, I have successfully implemented PreviewView with ratio 16:9
I successfully Captured Image using ImageCapture.takePicture(...)
imageCapture.takePicture(executor, object : ...
0
votes
0
answers
37
views
Camera crop working on Android 10. Not working on Android 11 or 12
Below is a very small gitHub project for image cropping from camera pic or gallery pic.
So, on the android java side it is using the 'edmodo' image cropper library-
com.theartofdev.edmodo.cropper
But ...
0
votes
1
answer
42
views
Auto Focus and Manual focus Focus Locking Error In Camera 2 api
I have one camera app in which i am providing user with 2 option manual focus and auto focus and then capturing 6 image back to back
but my issue is when i call auto focus and then capture image it is ...
0
votes
0
answers
117
views
camera2 CameraCaptureSession.capture() fails on first go but completes on second call
class AutomaticCapture(private val arguments: IntentArguments,
override val cameraCharacteristics: CameraCharacteristics,
override val imageReader: ...
0
votes
0
answers
41
views
Distortions in Wide-Angle Shots Using CameraX on Android: Any Solutions?
I'm capturing wide-angle shots using CameraX on Android. However, I've noticed distortions, like a fisheye effect, in these wide-angle shots. Do you have any suggestions for a solution?
Thanks
0
votes
0
answers
74
views
Error trying to save video in specific folder inside Movies - Android 13
I need to create an application that records videos and saves them in 2 different folders depending on the button that was pressed to record. However, for some reason the videos are always being saved ...
1
vote
0
answers
58
views
Consistent Artifacts in Android ImageView with Camera Preview
I'm working on an application for the Android Open Source Project (AOSP) using the source code from an SOM provider and facing a challenging issue with the camera preview. When using SurfaceView ...
1
vote
0
answers
173
views
Camera2 how to detect focus on a metering area
Afternoon,
I have an application that detects something in the scene. This runs on live camera preview. I now want to use the results of a (successful) detection to set certain points of interest for ...
0
votes
0
answers
84
views
Understanding LENS_FOCUS_DISTANCE Accuracy and Calculation for Distance Measurement on Samsung S22
I'm trying to use the auto-focus feature of Android phones to detect object distances using the LENS_FOCUS_DISTANCE parameter, but I'm facing accuracy issues.
My device: Samsung S22
...
0
votes
0
answers
170
views
Android FotoApparat library how to make the cameraView zoom how?
i am using the below library in my android application
implementation 'io.fotoapparat:fotoapparat:2.7.0'
and this is the implementation of the fotoapparat instance build
fotoapparat = Fotoapparat....
0
votes
0
answers
68
views
Android - Camera2 tap to focus not working
I am working on a Camera2 library that has a auto-focusing preview, and should support "tap to focus" to focus to a specific area.
I tried to follow tutorials in the internet, read Google's ...
0
votes
1
answer
125
views
Issue with Zxing Embedded Continuous QR Code Scanning
I'm currently using Zxing Embedded for QR code scanning in continuous mode. However, I'm encountering an issue where it scans randomly from various patterns, including clothes and other non-QR code ...
0
votes
1
answer
293
views
CameraX touch focus issue with Jetpack Compose
AndroidView(modifier = Modifier.fillMaxSize(),factory = {
PreviewView(it).apply {
this.controller = controller
controller.bindToLifecycle(lifecycleOwner)
...
0
votes
1
answer
231
views
Camera2 YUV formats efficiency and differences
I noticed that in Camera2 the StreamConfigurationMap.getOutputFormats() function returns different YUV formats depending on the phone's hardware.
For example, my Samsung S21 returns ImageFormat....
0
votes
1
answer
220
views
Camera2 Lifecycle - close device on minimize?
What is the recommended way of dealing with Camera2's lifecycle?
When I open a Camera session, I see three steps:
Open CameraDevice
Open CameraCaptureSession
Start a repeating CaptureRequest
Now ...
0
votes
0
answers
278
views
Camera2 "Hack" Samsung's 60 FPS vendor lock using NDK
I'm building an Android Camera2 app and I absolutely need the Camera to run at 60 FPS.
Many Samsung phones advertise that their Cameras to support 60 FPS through the Camera Devices API:
fun getMaxFps(...
1
vote
0
answers
188
views
Camera output is always cropped via Android Camera2/CameraX. How to show full view?
My app shows preview of the camera and saves pics to files. Both the preview and the saved pics only show part of the what the camera can see. The image is clearly cropped/clipped. How do I configure ...
0
votes
0
answers
61
views
How to get Preview image from Opencamera camera1 api in android(java) application
We have android camera based application ,in that we have used opencamera camera2 api's preview image .Recently we started using Moto g62 5g android phone, in this phone we are not getting proper ...
0
votes
1
answer
268
views
Android Studio , Camera Manager turnOnTorchWithStrengthLevel throw exception. How to resolve?
I'm using api 34 for my android phone galaxy. everything was working fine until I tried to use the Camera Manager turnOnTorchWithStrengthLevel.
The code:
package com.example.myflashlight
import ...
1
vote
1
answer
4k
views
Access external USB camera in Android application
Is there any official android library to access external USB camera in android?
I have gone through all the android/camera-samples. The issue is external USB camera can not be detected/listed in the ...
10
votes
2
answers
902
views
Camera2 Pass Images from ImageReader to MediaRecorder
I'm trying to create a Camera2 CameraCaptureSession that is capable of four outputs:
On-screen preview (SurfaceView, up to 1080p)
Photo capture (ImageReader, up to 8k photos)
Video Capture (...
1
vote
0
answers
412
views
MediaRecorder - java.io.IOException: prepare failed - for 4K resolutions on some devices
So I noticed the following exception on some devices (usually Chinese-brand devices only, especially Realme and Vivo but also Motorola as well and some Samsung devices of A serires) when using 4K ...
1
vote
0
answers
77
views
CameraX blurry when setting LinearZoom below 0.5f and fails to focus on Pixel 6a/7
Why is the camera preview blurry when cameraControl#setLinearZoom is called with a value of less than 0.5?
I'm testing on a Pixel 6a and Pixel 7.
As soon as I hardcode this to 0.5f, the camera preview ...
2
votes
0
answers
97
views
About the correctness of focal Lengths, sensor Height, sensor Width taken with Android Camerax
with the android camerax, I get the focalLengths, hFov, vFov , cameraSensorHeight and cameraSensorWidth values from the corresponding camera of the phone as follows.
val maxFocus = characteristics....
0
votes
1
answer
277
views
How to check if a hidden camera id can be used to open camera? (Camera2 API)
So many devices (especially brand-Chinese ones) hide some camera ids for non-native applications.
There is still a solution to access some more cameras:
for (id in 0..511) {
try {
val ...
0
votes
1
answer
95
views
MediaRecorder stop() function fails
class MainActivity : AppCompatActivity() {
// Thread handlers for Camera2 API threads
lateinit var handler: Handler
lateinit var handlerThread: HandlerThread
lateinit var ...
0
votes
0
answers
207
views
android camerax image analyzer preview lag
I am trying to use an image analyzer, but I am not performing any operation on the image, yet I face with terrible lag on the preview
val analyzerDispatcher = Executors.newSingleThreadExecutor()....
1
vote
0
answers
128
views
Any Android phones supporting FEATURE_CAMERA_EXTERNAL?
I am looking for any Android mobile phone that supports external USB cameras natively using Camera2 API based on this.
This is a follow up question to this in 2021, and this in 2019.
Any input is ...
0
votes
0
answers
282
views
CameraX RuntimeException lock buffer failed for format 0x21
We recently implemented CameraX to take images instead of using the device camera. Since the time we rolled out this feature in our app, we are seeing the following error. Can someone help debug this ...
0
votes
1
answer
298
views
Turn on torch when camera is open
I need to turn on torch when camera is open.
class FlashLight(private val context: Context) {
private val cameraManager by lazy { context.getSystemService(Context.CAMERA_SERVICE) as CameraManager }...
3
votes
1
answer
5k
views
How do some apps can access ultra wide lens camera when Camera2 API doesn't even return all cameras?
So I have different Samsung devices (up to S22 Ultra) and it is very easy to access ultra wide lens camera because CameraManager.cameraIdList returns 4 cameras which includes general back lens camera ...
0
votes
1
answer
35
views
how to get size of my image file store in DIRECTORY_Picture
I am implementing an app using camera to capture photo . But the camera is capturing even if i don't click , and saving it in the Picture Directory . Photos captured without clicking are saved in hte ...
1
vote
1
answer
63
views
Resgistering photos issues in android programming
I am implementing an android app using camera to take pictures then registering it in External_storage\Android\data\com.abc.projectname.bf . But after openning the camera , even if i don't capture , ...
3
votes
0
answers
878
views
Recording a video with MediaStore.ACTION_VIDEO_CAPTURE fails on Android 13
When I'm trying to Record a video with MediaStore.ACTION_VIDEO_CAPTURE on Android 13, the app crashes.
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.content....
0
votes
0
answers
55
views
How to make output video landscape mode when recording video in portrait mode?
For some reason, I want video has fixed resolution in landscape whether i recorded in portrait mode or landscape mode. like this picture:
Picture
I try mediaRecorder.setVideoSize(640,480) to set fixed ...
0
votes
1
answer
784
views
Image quality is very low after capture with camera in jetpack compose
I am making this camera app where I take the picture and upload to server. But after captured image that I am getting very low quality. Can we specify the image quality here?
val cameraLauncher = ...
1
vote
0
answers
247
views
How to filter out devices on Google Play with Legacy Camera Hardware Level
When using Camera2 API or CameraX I get such crashes for
and also
With Camera 2 API you can check the camera hardware level:
val level =
getCameraCharacteristics(
context,
...
0
votes
0
answers
771
views
How to Integrate external Camera device to Android
Requirement:-
I have to make a android accessibility service application which take camera frames through any USB Camera Device.
Camera should be always turn on.
Try to use camera2 Api to connect ...
1
vote
0
answers
181
views
Android Camera2 API autofocus (AF) state remains in ACTIVE SCAN state
I'm stuck at the problem that after locking the android autofocus (AF) the AF state will change into AF_STATE_ACTIVE_SCAN and remain in that state forever. Restarting the AF trigger by cancel it and ...
1
vote
0
answers
124
views
Android - How to get Real time (While recording) video recording data from camera in android?
I wanted to transfer live video (android device camera) to destination (may be another android device / video supported device).
So how do I get the camera video data (may be byte[]) so that I can ...