Advanced Camera Sample & Problem

COBRASoft

Active Member
Licensed User
Longtime User
Hi,

I'm trying to make a full sample project for the Advanced Camera Library.

I have a big problem when the user wants to select another resolution. I want my preview panel to adjust in ratio according to the selected resolution but still be as big as possible on the devices screen. This seems to fail, it keeps the original width and height as it was when the camera was initialized.

Any idea how to solve the problem with the aspect ratio of the camera preview? xVerhelstx?

Please feel free to play with the included the project. I'll add more functionalities and 'gadgets' in the coming days. Specially the HUD above the camera has to be improved and I'll try to find better pictures. Be sure to check the menu out, 3 more settings are available there.

EDIT:
Post #5: updated version.

Greetings,
Sigurd
 

Attachments

  • Q2CCamera.zip
    119.7 KB · Views: 892
Last edited:

vb1992

Well-Known Member
Licensed User
Longtime User
You could add some error checking for flash
this crashed in Froyo, but worked with this code


B4X:
Try 
      lstFlashMode.Clear
      lstFlashMode.AddAll(objCamera.SupportedFlashMode)
      If LastFlashMode.Length = 0 Then LastFlashMode = objCamera.CurrentFlashMode
      SetFlashMode
      Catch
      Msgbox("You have no flash","FLASH")
      End Try
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
I also don't see much difference in file size
from

objCamera.Quality = 60


to

objCamera.Quality = 95


But the overall quality at 95 is much better
in the final saved photo/jpg

I think this should be set to 95
 
Upvote 0

COBRASoft

Active Member
Licensed User
Longtime User
Hi,

Thanks for testing! I've put 60 just as example. I'll add a feature for the user to choose this setting.

About error checking... I have to add it to many places. This is my first real 'test' with the camera and I have B4A only 1 week .

I already have an idea to make it work better and to make the resolution change work with a work around. I hope to post a new build tomorrow.

Greetings,
Sigurd
 
Upvote 0

COBRASoft

Active Member
Licensed User
Longtime User
Hi,

I've updated the sample with some basic HUD elements (text for the moment). I also force the camera to initialize again when the resolution has changed. This way the preview is respecting the aspect ratio (please test).

The HUD info can be turned off via the menu (info).

Please let me know if problems arise or if you have suggestions...

P.S.: the updated zip can be found in the first post of this thread.

Greetings,
Sigurd
 
Upvote 0

mcmanu

Active Member
Licensed User
Longtime User
Hi

Thanks your Example

But it doesn´t work in my app to set oriportrait

But now i fixed it, if you use try catch than it works perfectly

code-->
Sub Camera1_Ready (Success As Boolean)

If success Then
Try
camera1.OriPortrait
Catch
End Try
Camera1.StartPreview
button5.Enabled = True
Else
ToastMessageShow("Kamera konnte nicht geöffnet werden.", True)
End If
End Sub

Sorry because of my english
 
Upvote 0

rtesluk

Member
Licensed User
Longtime User
Combining Portrait & Landscape

This also works

B4X:
      If Activity.Width > Activity.Height Then
         Try
            Camera1.OriLandscape
         Catch
            Msgbox     (LastException.Message,"Camera1_Ready - Land") 
         End Try
      Else
         Try
            Camera1.OriPortrait
         Catch
            Msgbox(LastException.Message,"Camera1_Ready - Port") 
         End Try
      End If

rtesluk
 
Upvote 0

COBRASoft

Active Member
Licensed User
Longtime User
Samsung Galaxy SII

Hi xVerhelstx,

For some reason the camera.release is giving problems on the Samsung Galaxy SII. It takes a really long time to release the camera. Strangely enough, in debug mode the release is almost instant.

Any idea what this could be? I don't have the problem on my SE Xperia Arc S and Motorola Droid...

Greetings,
Sigurd
 
Upvote 0

rtesluk

Member
Licensed User
Longtime User
Use Tools -> Clean Project

Mar 21 2012
07:30 Houe

I found out that 'cleaning' the project seemed to remove some niggling problems using the ACL (Advanced Camera Library).

rtesluk

:sign0104:
 
Upvote 0

COBRASoft

Active Member
Licensed User
Longtime User
I clean my project often because I use Nine Patch Images now for most drawings and backgrounds. So this is not the reason. And since it's working on my other 2 devices with exactly the same build... It must be something weired in the release code (my guess).
 
Upvote 0

Mickster

Active Member
Licensed User
Longtime User


I developed my app on HoneyComb and had a working Camera feature. Since updating to ICS, I've been seeing this same issue. Did you ever solve it?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…