Android Question CameraEx High quality?

carlos7000

Well-Known Member
Licensed User
Longtime User
Hi.

Testing the example of Camera, I see that the photographs taken by CameraEx are of lower quality than those taken by the application that brings the equipment.

The photos that I attached, were taken with tripod and with a difference of 10 seconds.

The photo taken with the application included in the device is made to the maximum possible resolution, without effects, etc.

The photo taken with cameraEx was taken with the maximum resolution that the application showed and with a jpg quality of 100.

¿Why is the photo taken with cameraEx so dark, greater noise and less deficit if they were taken on the same device without moving the equipment and with a few seconds difference?

The original images can be found in the following link. They will be available for one week from this moment. If you cannot download them, please inform me to upload them again.

Notes:
  • The 20191029-13_32_51-1572373971800.jpg image was taken by CameraEx at 2019 Oct 29 13:32:51Pm, and the IMG_20191029_133301840_HDR.jpg image was taken at 2019 Oct 29 13:33:01Pm. 10 seconds later, without moving the equipment.

  • Attachments have not been altered.
https://we.tl/t-KJe4k75y3U

Thanks
 

JordiCP

Expert
Licensed User
Longtime User
The manufacturer app can be more fine tuned to this specific hardware.
Also, according to the 2nd picture name, it seems to be taken in HDR, that extends the dynamic range.
If your camera supports it (getSupportedSceneModes), you could select hdr mode (setSceneMode("hdr")) and compare results.

(Totally untested, but this is the idea :))

Add this to the CameraEx class
B4X:
Public Sub GetSupportedSceneModes As List
    r.target = parameters
    Return r.RunMethod("getSupportedSceneModes")
End Sub

Public Sub SetSceneMode(sceneMode As String)
    r.target = parameters
    r.RunMethod2("setSceneMode", sceneMode, "java.lang.String")
End Sub

And this to your main module
B4X:
'Add this Sub
Public Sub SetSceneModeIfSupported(newMode as String)
    Dim supportedSceneModesList as List = CamEx.GetSupportedSceneModes
    For k=0 to supportedSceneModesList.size-1
        Dim mode as String = supportedSceneModesList.Get(k)
        Log("Supported scene mode "&k&": "& mode)
        if mode = newMode Then
           camEx.SetSceneMode(newMode)
        End if
    Next
End Sub

Sub Camera1_Ready (Success As Boolean)
    If Success Then
        camEx.SetJpegQuality(90)
        camEx.SetContinuousAutoFocus

        SetSceneModeIfSupported("hdr")     '<--- Add this line before 'commitParameters' (needed)

        camEx.CommitParameters
        camEx.StartPreview
        Log(camEx.GetPreviewSize)
    Else
        ToastMessageShow("Cannot open camera.", True)
    End If
End Sub
 
Upvote 0

carlos7000

Well-Known Member
Licensed User
Longtime User
Also, according to the 2nd picture name, it seems to be taken in HDR, that extends the dynamic range.
If your camera supports it (getSupportedSceneModes), you could select hdr mode (setSceneMode("hdr")) and compare results.

(Totally untested, but this is the idea :))

Add this to the CameraEx class
B4X:
Public Sub GetSupportedSceneModes As List
    r.target = parameters
    Return r.RunMethod("getSupportedSceneModes")
End Sub

Public Sub SetSceneMode(sceneMode As String)
    r.target = parameters
    r.RunMethod2("setSceneMode", sceneMode, "java.lang.String")
End Sub

And this to your main module
B4X:
'Add this Sub
Public Sub SetSceneModeIfSupported(newMode as String)
    Dim supportedSceneModesList as List = CamEx.GetSupportedSceneModes
    For k=0 to supportedSceneModesList.size-1
        Dim mode as String = supportedSceneModesList.Get(k)
        Log("Supported scene mode "&k&": "& mode)
        if mode = newMode Then
           camEx.SetSceneMode(newMode)
        End if
    Next
End Sub

Sub Camera1_Ready (Success As Boolean)
    If Success Then
        camEx.SetJpegQuality(90)
        camEx.SetContinuousAutoFocus

        SetSceneModeIfSupported("hdr")     '<--- Add this line before 'commitParameters' (needed)

        camEx.CommitParameters
        camEx.StartPreview
        Log(camEx.GetPreviewSize)
    Else
        ToastMessageShow("Cannot open camera.", True)
    End If
End Sub

Hi.

It already includes the code. I will prove that it works.

Thank you.
 
Last edited:
Upvote 0
Top