Murodjon Abdukholikov
Murodjon Abdukholikov

Reputation: 567

How to capture image with different resolution using Multi camera android?

I'm trying to capture an image using Android Multi Camera API. The problem I'm facing now is that I can not get supported resolutions and prepare output configuration for a specific physical camera.

Google official docs suggests to use MultiResoultionImageReader, here's the link, but MultiResolutionImageReader should be used for a camera device only if the camera device supports multi-resolution output stream by advertising the specified output format in android.hardware.camera2.CameraCharacteristics#SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP.

However it's returning null and i'm testing it with Pixel 5 and 6.

val multipleStreamConfigurationMap = mCameraCharacteristics.get(CameraCharacteristics.SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP) How can I set a resolution for physical camera?

Upvotes: 0

Views: 507

Answers (2)

Interstadial
Interstadial

Reputation: 3

I'm not sure if this is exactly what you were after, but on my Pixel 6 Pro, I can get the StreamConfigurationMap of a particular physical camera by first using getCameraCharacteristics on the physical Id; for instance, the telephoto lens on the P6 pro has id "4". Then use .get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP) just like you would for a normal camera Id. This worked for a Pixel 4 XL as well.

You can also use the characteristics of the physical id to get the ISO range, focal lengths, and anything you can get for a normal Id.

I also tried MultiResoultionImageReader and found, like you, that it returned null on the Pixel 6.

Hopefully this little example is helpful:

try {
    physicalCharacteristics = manager.getCameraCharacteristics(physicalId);
}catch (CameraAccessException e){
    throw new RuntimeException(e);
}
StreamConfigurationMap tempMap = physicalCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
Range<Integer> isoRange = physicalCharacteristics.get(CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE);

And for anyone reading who doesn't know, you can find the physical ids of a given logical camera by calling .getPhysicalCameraIds() on the CameraCharacteristics of that logical camera.

Upvotes: 0

Wasim Ansari
Wasim Ansari

Reputation: 475

Most of the physical camera are not exposed directly to app developer. it is exposed via some logical cameraID. You need to check if the device that you are using support logical cameraID or not before using MultiResolutionImageReader

Upvotes: 0

Related Questions