LENS_FACING_BACK vs DEFAULT_BACK_CAMERA to use main camera lens on all devices

140 views
Skip to first unread message
Assigned to tonyt...@google.com by wuj...@google.com

Michael K

unread,
Nov 3, 2022, 3:57:30 PM11/3/22
to Android CameraX Discussion Group
Hi,
I develop and maintain a camera app based on CameraX. The app uses this code to specify the lens to be used:

val cameraSelector = CameraSelector.Builder().requireLensFacing(CameraSelector.LENS_FACING_BACK ).build()

The app should use the main (normal) back camera lens and in most cases such lens is selected when using the above code.

However, occasionally users report that the app uses the wide-angle lens instead of the main (normal) back camera lens. This seems to occur only on a limited number of devices models, e.g. Samsung S22Ultra. Should I switch to this code below, so to ensure that the main (normal) camera lens is used on all devices?

val cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA

Thanks,
Michael




Scott Nien

unread,
Nov 7, 2022, 4:37:38 AM11/7/22
to Michael K, TY Chang, Android CameraX Discussion Group

Thanks for reporting the issue. This sounds like a bug.  What CameraX version are you using ?  

--
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/b6b974dd-c3bd-4e09-8479-a4595fe0e513n%40android.com.

tonyt...@google.com

unread,
Nov 7, 2022, 4:38:02 AM11/7/22
to Android CameraX Discussion Group, kost...@gmail.com
Hi Michael,
Thanks for the question. First of all, there should be no difference between using DEFAULT_BACK_CAMERA and requireLensFacing(CameraSelector.LENS_FACING_BACK). Do you actually see that DEFAULT_BACK_CAMERA selects the main camera?

Additionally, how does the user that tell it's not selecting the main camera? By physically covering the lens or comparing the FOV between CameraX and the native camera app? I don't have an S22 ultra in hand right now. Could you help to check what's the camera ID when using DEFAULT_BACK_CAMERA? You may use Camera2CameraInfo.from(cameraInfo).cameraId() to get the camera ID.

Michael K

unread,
Nov 10, 2022, 5:17:40 AM11/10/22
to Android CameraX Discussion Group, tonyt...@google.com, Michael K
Hi all,
thanks for your reply and the additional info. Now to your questions:
  • I am currently using the CameraX version 1.1.0-alpha12.
  • I do see that both the DEFAULT_BACK_CAMERA and the requireLensFacing(CameraSelector.LENS_FACING_BACK) do select the main camera on my testing devices, however have not tested it on a physical Samsung S22Ultra, so can't tell how CameraX behaves for such device.
  • The user (by now it is two users reporting the same issue) reported that the wide-angle camera lens is selected, based on the image distortion/fisheye view shown on the images captured, typical for the wide angle lens. Unfortunately, I cannot check the camera lens ID for myself, since I do not have a physical Samsung S22Ultra.
Kindly let me know in case you need any further info.

Michael

Michael K

unread,
Nov 10, 2022, 5:22:42 AM11/10/22
to Android CameraX Discussion Group, Michael K, tonyt...@google.com
Hi again,

I forgot one info: one of the two users reported that on his Samsung S22Ultra, the normal lens is selected for the preview (no distortion shown), however on the image captured and stored, the photo appears to have been taken with the wide angle lens (or at least, the photo shows a distortion typical for a wide-angle lens.

Scott Nien

unread,
Nov 18, 2022, 4:29:14 PM11/18/22
to Michael K, Android CameraX Discussion Group, tonyt...@google.com
Hi Michael, 
Sorry for the late response. I can't reproduce it on Samsung S22Ultra, can you check the following items ?
1) Did your app or the user set the zoom ratio to be less than 1.0 ?   S22 Ultra supports setting zoom to be 0.6 which will switch to ultra wide angle.  Also the getMinZoomRatio in ZoomState is 0.6. on S22 Ultra. 
2) Does your app show the full FOV of the preview ?  Would it be possible that the preview is also ultra-wide angle but it is just being cropped in the view.   

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.

Michael K

unread,
Jan 12, 2023, 9:29:47 AM1/12/23
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, tonyt...@google.com, Michael K
Hi Scott,

thanks for your message. I am so sorry for my very late response, could not work on the app development lately.
1) Now to your first question, my app resets the zoom manually when setting up the camera, and I have used this code till now:
camera?.cameraControl?.setLinearZoom(0.0f)
I have not considered that some devices might feature a zoom ratio less than 1.0. Hence, maybe this code sets the zoom ratio of the S22 Ultra to the lowest ratio possible, hence 0.6, and thus uses the wide-angle lens?

Maybe the below code should be better?
camera?.cameraControl?.setZoomRatio(1.0f)

2) Unfortuantely, I am unable to respond to your second question, since I do not have an S22 Ultra to test the FOV.

Thanks for your help,
Michael

Scott Nien

unread,
Jan 12, 2023, 6:34:48 PM1/12/23
to Michael K, Android CameraX Discussion Group, tonyt...@google.com
Setting linear zoom to 0f on S22 Ultra will result in 0.6 zoom ratio which will switch to ultra wide angle lens.  Setting zoom ratio to 1.0f is recommend to select the default lens.

Michael K

unread,
Jan 13, 2023, 10:06:38 AM1/13/23
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, tonyt...@google.com, Michael K
Thanks a lot Scott! Will implement the change now.
If I may, a question related to the topic: is there a list of devices that allow the zoom ratio to go below 1.0, such as for the S22 Ultra?

Thanks,
Michael

Scott Nien

unread,
Jan 30, 2023, 11:10:45 PM1/30/23
to Michael K, Android CameraX Discussion Group, tonyt...@google.com
is there a list of devices that allow the zoom ratio to go below 1.0, such as for the S22 Ultra?
--> Almost all Pixel devices will do so.  and some of the new Samsung models.  But I don't have an exhaustive list and even if I have that,  there will be new models supporting the feature. 
So I would suggest not to rely on the list to do any customized behavior, but rather always assuming linear zoom 0f could lead to extra wide angle and behave accordingly. 
Reply all
Reply to author
Forward
0 new messages