Android Question CameraEx, FocusDistances

Urishev

Member
Licensed User
Longtime User
Hello! I am a novice. Please help.
Task: find the distance from the camera to the paper with the text.
The camera automatically adjusts the sharpness of text. Setting the focus is the focal distance change.
How to convert the signification of the camera.GetFocusDistances (for example [F@42032d78) value in mm?
Thanks.
 

Urishev

Member
Licensed User
Longtime User
I'm ashamed to ask primitive questions, but I don't know how to determine the components CamEx.GetFocusDistances.
How to work with Log (f(0)), Log (f(1)), Log (f(2))?
Thank you.
 
Upvote 0

Urishev

Member
Licensed User
Longtime User
Thanks for the quick reply, but unfortunately, there is no continuous focus.
Sub Camera1_Ready (Success As Boolean)
If Success Then
camEx.SetJpegQuality(90)
camEx.SetContinuousAutoFocus
camEx.CommitParameters
camEx.StartPreview
Log(camEx.GetPreviewSize)
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub
 
Last edited:
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
add the following to the class:
B4X:
Public Sub GetSupportedFocusModes As List
    r.target = parameters
    Return r.RunMethod("getSupportedFocusModes")
End Sub

Public Sub SetContinuousAutoFocus
    Dim modes As List = GetSupportedFocusModes
    If modes.IndexOf("continuous-picture") > -1 Then
        SetFocusMode("continuous-picture")
    Else If modes.IndexOf("continuous-video") > -1 Then
        SetFocusMode("continuous-video")
    Else
        Log("Continuous focus mode is not available")
    End If
End Sub

Public Sub SetFocusMode(Mode As String)
    r.target = parameters
    r.RunMethod2("setFocusMode", Mode, "java.lang.String")
End Sub
 
Upvote 0

Urishev

Member
Licensed User
Longtime User
Thank you. I use code CameraExClass. At the start of the program Log:"Continuous focus mode is not available"
The command "camEx.FocusAndTakePicture" takes effect, appears autofocus. But "camEx.SetContinuousAutoFocus" - no autofocus. Why?
The problem in the code or in Sumsung GT P1000 ? Or in me?
I think to go from CameraExClass to ACL. But ACL has no FocusDistance?
 
Last edited:
Upvote 0
Top