Android Question Camera2 Is 0.5x supported?

dfwm1989

New Member
微信图片_20240304145407.png
 

drgottjr

Expert
Licensed User
Longtime User
there are several problems:
does the camera support .5? does the device support .5 who will do the math to figure out the view (not me)?
you can handle problem #1 with erel's cam2 class:

B4X:
public Sub getZoomRange As Object
    Return GetFromCameraCharacteristic("CONTROL_ZOOM_RATIO_RANGE")
End Sub

in main (or it could be in cam2 class)
B4X:
    Dim zjo As JavaObject
    zjo = cam.getZoomRange
    ' public static final Key<Range<Float>>
    
    dim minzoom as float = zjo.RunMethod("getLower",Null)
    dim maxzoom as float = zjo.RunMethod("getUpper",Null)
    Log("min: " & minzoom & "  max: " & maxzoom)

when i run this on my camera, i get: min: 0.5304937958717346 max: 8
so my camera (and maybe software) is capable of .5 wide view.

if your result says 1, that means you don't have .5 view.

in erel's camera2 example, there is a sub which handles zooming, but
i don't think it works for values less than 1. zooming with camera2 is not
handled the same way as with the original camera class. i don't use
camera2, and i'm sure i'll be dead before the original camera class no
longer works, so i'll leave the math to you. erel's sub works for zooming
in. i would guess you reverse the operation for values < 1.
 
Upvote 0

dfwm1989

New Member
CAM2 class using EREL Output results min: 1 max: 8
But the camera that comes with the phone supports 0.5x, as shown in the camera screenshot I uploaded
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
on my device, output (using erel's class and my modification) is what i showed in my post. camera hardware and software are at the discretion of the manufacturer. i was hoping your camera was like mine, and that you would take the time to work out the math needed to zoom wide. but it looks like your default camera app is custom for your device. sorry.
 
Upvote 0

dfwm1989

New Member
If EREL's CAM2 class supports 0.5x scaling.
Is there any example method? Erel's demo only shows zooming in. The shrinking method should be different. Can you help me try it?
 
Upvote 0
Top