CameraCharacteristics SENSOR_INFO_EXPOSURE_TIME_RANGE gives wrong values - android

I am using SENSOR_INFO_EXPOSURE_TIME_RANGE to calculate the range of supported exposure time.
I tested this in Huawei P30 Pro and it seems like this API is giving wrong values(10000 - 1000000000).
But when I use the built in camera app's pro mode, there I can set exposure value to 30s which is really larger than what is provided by the API.
Can anyone help me with this? How to get correct values for the range of supported exposure durations?

As Camera algorithms are defined differently on different phone models and manufactures, for Huawei Mate30 Pro, please use HMS camera kit API to get the calculated exposure range instead of using Android Camera2 native API:API example is as follows, then you will see the exposure range returned as : 1/4000-30s.
mMode.getModeCharacteristics()
.getParameterRange(RequestKey.HW_PRO_SENSOR_EXPOSURE_TIME_VALUE)
For more detailed info. on how to integrate HMS camera Pro. Mode, please refer to HMS Camera Engine Developer’s Guide:
Please note: HMS Camera Engine SDK is currently only available on HMS phones.

Related

Android camera2 API intrinsics and the DEPTH_OUTPUT capability

Extracting intrinsic calibration parameters from an android device's camera using the camera2 API is known to be problematic.
However the guidance has been that if the phone supports the DEPTH_OUTPUT capability, it is guaranteed to also provide camera intrinsics (via LENS_INTRINSIC_CALIBRATION).
This is stated in the following sources:
In this SO answer
In the documentation, where it is stated that:
[The DEPTH_OUTPUT] capability requires the camera device to support the following:
This camera device, and all camera devices with the same android.lens.facing, will list the following calibration metadata entries in both CameraCharacteristics and CaptureResult:
android.lens.intrinsicCalibration
Still, the Huawei P30 Pro claims to support the DEPTH_OUTPUT capability but does not provide any useful intrinsics (all intrinsic parameters are zero).
For what it's worth, the Huawei P30 Pro's support for the camera2 API is INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED, but this should not matter, as neither of the sources cited above give any conditions on the device's camera2 API support level for extracting intrinsics.
Could anyone please help?

How to achieve Google Duo app's low light mode using Camera2 API?

I'm working on an Android app that streams video with another party, and currently looking at brightening the image in low light scenes.
I noticed that on Google Duo app, the low light mode does it really well.
Is it achievable using just Camera2 API? The reason I am not using CameraX API is because my app is also utilising Vonage (formerly TokBox) SDK for two way video call and it's SDK sample code currently uses Camera2 API and haven't migrated to CameraX yet.
What I tried is to set CONTROL_AE_MODE (Auto Exposure) to CONTROL_AE_MODE_ON, this helps a bit but the image quality is no where as near as Google Duo app's. I'm looking to decrease the Camera FPS next but what else can I do to brighten the image?
If you set CaptureRequest.CONTROL_AE_MODE to CaptureRequest.CONTROL_AE_MODE_OFF then you can control ISO CaptureRequest.SENSOR_SENSITIVITYand exposure time CaptureRequest.SENSOR_EXPOSURE_TIME manually.
You can read the available range of sensorSensitivity (ISO) like this val sensorSensitivityRange = cameraCharacteristics?.get(CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE) as Range<Int>? as this will vary from device to device / camera to camera.
So in low-light mode you could control the brightness yourself, and in normal mode, you let the camera do it automatically.
More information here:
https://developer.android.com/reference/android/hardware/camera2/CaptureRequest

How can I get Depth(Distance) Data using Depth(ToF) Camera?(Galaxy Note 10+, Camera2 API)

I'm working with Galaxy Note 10+ and Android Camera2 API.
What I want to do is to get depth(distance) data while I'm taking pictures.(on Preview, View Finder screen)
Like this screenshot of Quick Measure app, I think it's Samsung default app.
Quick Measure
When I tested my device on Google Camera2Basic Sample, I found out that the depth(ToF) camera isn't included to availableCameras list because it doesn't have CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE among its characteristics.
And the characteristic says
Devices with the DEPTH_OUTPUT capability might not list this capability, indicating that they support only depth measurement, not standard color output.
I have no clue how to use this camera to get depth information.
Should I open more than one camera simultaneously?
Any helps or comments are appreciated!
Regards,
Lee

Camera API 1 and Camera API 2 return different sensor orientation info

I am trying to figure out the limitations of using camera2 with devices that have hardware level support LEGACY. From the official docs for android camera2 api:
LEGACY: These devices expose capabilities to apps through the Camera API2 interfaces that are approximately the same capabilities as those exposed to apps through the Camera API1 interfaces. The legacy frameworks code conceptually translates Camera API2 calls into Camera API1 calls; legacy devices do not support Camera API2 features such as per-frame controls.
I have found this to be false... In fact I expected that sensor orientation obtained through Camera.CameraInfo camInfo -> camInfo.orientation (docs) would be the same as cameraCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION) (docs)
However it is not the case!
Camera API 1 returns an orientation angle of 90°
Camera API 2 returns an orientation angle of 270°
Notice that this is quite different! Landscape orientation != inverse landscape orientation! For example it would completely break the Matrix transformation from the screen preview coordinates to the camera sensor space.
Am I missing something? Is this intended behaviour?
I am using a Xiaomi Redmi 5 plus with Android 8.1 (is this a manufacturer issue?)
Thanks
If the two queries apply to the same camera, this is definitely a bug, and Xiaomi is responsible. Bugs do happen even on mainstream devices, and the camera API adaptation layers tend to be more buggy than other APIs.
You may find that for LEGACY devices, camera2 layer introduces extra overhead, and vice versa. You get best performance if you work trhough the deprecated Camera API for LEGACY devices, and through the camera2 API for other devices. I know it's painful to support two versions of your code, but when you need to utilize the device in the best way, you have to pay this price.

Get the Android camera Aperture and Exposure Time

Is there any API instruction or calculation to obtain the android camera Aperture F value, and the Exposure Time?
The Camera API exposes methods to get the White Balance, the Focal Length, etc, but I couldn't find anything related to the Aperture and the Exposure Time.
Thanks
In the Android Developer's Guide for ExifInterface, which is a class in the android.media API (not, the now deprecated Camera API), there is information for Aperture and Exposure Time
Sample code showing how it could be used is available at ExifHelper

Categories

Resources