How can I shoot wide-angle on Redmi Note 11 Pro and Similar devices?

121 views
Skip to first unread message

Ahmet Sina Birdevrim

unread,
Aug 24, 2023, 4:21:24 AM8/24/23
to Android CameraX Discussion Group
Hello,

I'm looking for the lowest one by comparing the focalLengths values in the logical camera ids to get the wide-angle shot. However, on devices like the Redmi Note 11 Pro, the logical camare id returns one. How can I provide wide-angle shooting in such situations?

What's the best approach to shooting wide-angle?

Thanks

tonyt...@google.com

unread,
Aug 24, 2023, 4:54:49 AM8/24/23
to Android CameraX Discussion Group, a.sinab...@gmail.com
You may query the intrinsic zoom ratio of all cameras by using CameraProvider.getAvailableCameraInfos, then obtain the camera selector corresponding to the wide-angle (the one that has intrinsic zoom ratio smaller than 1.0)

CameraSelector wideAngleCameraSelector = null;
List<CameraInfo> allCameraInfos = cameraProvider.getAvailableCameraInfos();
for (CameraInfo cameraInfo : allCameraInfos) {
    float ratio = cameraInfo.getIntrinsicZoomRatio();
    if (ratio < 1) {
        wideAngleCameraSelector = cameraInfo.getCameraSelector();
        break;
    }
}

if (wideAngleCameraSelector != null) {
    cameraProvider.bindToLifecycle(lifecycleOwner, wideAngleCameraSelector, useCase);

Ahmet Sina Birdevrim

unread,
Sep 1, 2023, 2:52:38 AM9/1/23
to Android CameraX Discussion Group, tonyt...@google.com, Ahmet Sina Birdevrim
Hi,

Thanks, I tried this method, I was able to get wide angle feature on devices like Samsung s21. But on Redmi Note 11 Pro, CameraProvider.getAvailableCameraInfos() does not give wide angle information. As far as I understand, it is due to the manufacturer's failure to provide this information.

Thanks.
24 Ağustos 2023 Perşembe tarihinde saat 11:54:49 UTC+3 itibarıyla tonyt...@google.com şunları yazdı:

Aubrey Haskett

unread,
Oct 15, 2024, 6:16:44 PMOct 15
to Android CameraX Discussion Group, tonyt...@google.com, Ahmet Birdevrim
Hello - jumping onto this thread. This intrinsic zoom ratio is super helpful - thank you so much for including it. I'll be using it to let users access the wide angle lens for devices like the S21 where the Samsung didn't include the wide angle in the logical lens list. I used to have to access Camera2 devices and do some math myself to figure out if there was a wide angle lens and switch to that if so. Glad to not have to do custom stuff anymore. Quite a few Samsungs require the custom code to access the wide angle (I know that's their fault and not Android CameraX's), so this is a great improvement. 

This might be a silly question, but do you know of a good way to detect what the correct zoom ratio is when using the cameraSelector with an intrinsic zoom ratio of <1? I would like to display to the user what zoom level they're using.

I've noticed on my S21 that using the cameraSelector with an intrinsicZoomRatio < 1 does correctly use the wide angle camera - I can tell from the previewView and outputted video content. But, when I call camera.cameraInfo.zoomState.value.zoomRatio, it comes back with a ratio around 1.0x. I'd expect to see a number <1.0x since the wide angle is being used. Do I have to do something different here since the wide angle lens isn't included in the logical camera? 

Thank you,
Aubrey

tonyt...@google.com

unread,
Oct 15, 2024, 11:41:52 PMOct 15
to Android CameraX Discussion Group, aubrey....@gc.com, tonyt...@google.com, Ahmet Birdevrim
Hi,
Thanks, I'm glad that it helps! For your question, which is a good one, the zoom ratio getting from ZoomState will be based on the wide-angle lens itself. So by default it will be 1.0x, while the intrinsic zoom ratio should be the value you want to display, isn't it? Do you mean you then want to use digital zoom on that lens and display the ratio corresponding to the default lens?
Reply all
Reply to author
Forward
0 new messages