sdkgbsd
sdkgbsd

Reputation: 53

android camera2 API - how to set zoom out to ultra wide

I trying to zoom out (wide lens to ultrawide lens) using Camera2 API on Android, but I don't understand how to find the correct Rect() for SCALER CROP REGION combine with CONTROL ZOOM RATIO to be ultrawide because changing the CONTROL ZOOM RATIO to 0.5f doesn't work and to 2.0f" make zoom in and not a zoom out.

I do my test on XIAOMI MI 10 LITE 5G

characteristics.get( CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE );  //Rect(0, 0 - 4000, 3000)
characteristics.get( CameraCharacteristics.SCALER_AVAILABLE_MAX_DIGITAL_ZOOM );  //10.0
Range<Float> zoomRange = characteristics.get( CameraCharacteristics.CONTROL_ZOOM_RATIO_RANGE );  //[1.0, 10.0]

The doc for CONTROL ZOOM RATIO: Here

Example of using Camera2 API : Here

EDIT :

wide

ultrawide

Upvotes: 4

Views: 3025

Answers (1)

Eddy Talvala
Eddy Talvala

Reputation: 18107

If CameraCharacteristics.CONTROL_ZOOM_RATIO_RANGE returns a minimum value of 1.0, then zooming out is not supported on that device, even if it has a ultrawide lens.

Unfortunately, many manufacturers have yet to allow applications to access the ultrawide (or telephoto) cameras via the camera APIs. And only allow access in the default camera app they develop.

Upvotes: 1

Related Questions