Android Question cameraEx Photo Size (with,heigh)

TheArkhangel

Member
Licensed User
Longtime User
Greetings to all
Would like to know using the library and the module cameraEx as forcing the device to take a picture with a certain size (4260x3180), knowing in advance that the device has the resolution.

The application on my LG G4 makes the images with a resolution of (5312x2988) whereas if I install a BQ Aquarius M5 always makes the photos (160x200) and click on the button indicates resolution change ..... that is selected (4680x3120).

Can anyone tell me where failure?
 

TheArkhangel

Member
Licensed User
Longtime User
B4X:
Sub Camera1_Ready (Success As Boolean)
    If Success Then
        camEx.SetJpegQuality(96)
        camEx.SetFocusMode("continuous-video")
        'camEx.SetPictureSize(4160,3120)
        Log(camEx.GetSupportedPicturesSizes)
        camEx.CommitParameters
        camEx.StartPreview
        Log(camEx.GetPreviewSize)
       
    Else
        ToastMessageShow("Camara no disponible.", True)
    End If
End Sub

the log...

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
0
[Lb4a.example.cameraexclass$_camerasize;@dcad7f3
[Height=1080, IsInitialized=false, Width=1920
]


My smartphone are a LG g4 the photos size default with the app are (5312x2988), the same app installed at BQ Aguarius M5 photo size are 160x200 but when touch the resolution button the message see (4160x3120) but no make the photo at this size, I don`t have the BQ device to connect and see the log.

I use the line commented to change the photo size and send the app but now i don't have a response if it's ok or failed.

Why can made to app detect the max resolution and set it for default photo ?
 
Upvote 0

TheArkhangel

Member
Licensed User
Longtime User
I use your code this is de log.

B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
0
5312 & 2988
3984 & 2988
3840 & 2160
3264 & 2448
3264 & 1836
3200 & 2400
2560 & 1920
2592 & 1944
2688 & 1512
2048 & 1536
1920 & 1080
1600 & 1200
1536 & 864
1280 & 960
1280 & 768
1280 & 720
1024 & 768
800 & 600
864 & 480
800 & 480
720 & 480
640 & 480
640 & 360
352 & 288
320 & 240

de commented line 'camEx.SetPictureSize(4160,3120) I change for first resolution and ok........ my question.....how to made the app use ever the first resolution o the most high ? Becouse I dont have other smartphone to know who resolution are ok.....
 
Upvote 0

TheArkhangel

Member
Licensed User
Longtime User
Thanks Erel
All correct, now the app detect de max resolution of the device and take the photo with it.

This is the code for event camera ready

B4X:
ub Camera1_Ready (Success As Boolean)
    If Success Then
        camEx.SetJpegQuality(96)
        camEx.SetFocusMode("continuous-video")
        camEx.SetPictureSize(5312,2988)
        camEx.CommitParameters
        camEx.StartPreview
        Dim maxSize As CameraSize
        For Each cs As CameraSize In camEx.GetSupportedPicturesSizes
           If Power(cs.Width, 2) + Power(cs.Height, 2) > Power(maxSize.Width, 2) + Power(maxSize.Height, 2) Then maxSize = cs
        Next
        Log($"${maxSize .Width} & ${maxSize .Height}"$)
   
    Else
        ToastMessageShow("Camara no disponible.", True)
    End If
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This is the code for event camera ready
You should learn from the code.

You always set the picture size to 5312x2988. No matter if the camera support this resolution or not.
Then you calculate the biggest resolution... But you do not use the info you found.
 
Upvote 0

TheArkhangel

Member
Licensed User
Longtime User
DonManfred sorry, at the code I not comment the line

camEx.SetPictureSize(5312,2988)

As you see it this line set the picture size resolution to 5312x2988

At my code the line are commented and the app work fine.

Thanks.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…