Smooth Zoom

798 views
Skip to first unread message

Raz

unread,
Feb 5, 2022, 12:50:32 AM2/5/22
to Android CameraX Discussion Group
I have watched this video from Android Developers on youtube, and Smooth Zoom was mentioned.
It said that CameraX automatically uses all the cameras for more zoom range - like the default device camera, but for some reason it does not seem to work with my
implementation - min zoom level is 1x unlike the default device camera and in video example which both have zoom level under 1x.

My implementation:

override fun onScale(detector: ScaleGestureDetector?): Boolean {
    val zoomRatio = camera.cameraInfo.zoomState.value?.zoomRatio?.times(detector!!.scaleFactor)
    zoomRatio?.let {
        // Setting new zoom ratio for CameraX
        camera.cameraControl.setZoomRatio(it)
    }
    return true
}

Thanks,
Raz

Scott Nien

unread,
Feb 7, 2022, 9:34:26 AM2/7/22
to Raz, Android CameraX Discussion Group
Hi Raz, 

Good question.  The smooth zoom mentioned in the video is enabled on devices that implement the smooth zoom functionality via CONTROL_ZOOM_RATIO.  Pixel 5 / 6 supports this feature so you can try it if you have one. For other devices, you may check the CONTROL_ZOOM_RATIO_RANGE. If the range has min value smaller than 1.0f,  then the device supports the smooth zoom via CONTROL_ZOOM_RATIO.
 
Scott


--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/87f3ec50-d54e-4990-97c1-9b0b8844460an%40android.com.
Reply all
Reply to author
Forward
0 new messages