B4A Library [Class] CameraEx - Extends the camera library functionality

Discussion in 'Additional libraries, classes and official updates' started by Erel, Nov 28, 2012.

Thread Status:
Not open for further replies.
  1. moster67

    moster67 Expert Licensed User

    MarcoRome and Erel like this.
  2. Douglas Farias

    Douglas Farias Expert Licensed User

    @Erel i tested this example in 3 diferents devices, and when u take a picture using front camera in portrait, this flip on horizontal the image.
    only in front camera, back camera is normal.

    this bug dont happens on the preview, only on the final photo, on the saved image

    how can i fix this? tested in a moto g4 , samsung j2 and sony e4 (front camera + portrait = fliped horizontal picture)

    i know this is not right place to post this, but this bug is on the example too :)

    Last edited: Dec 22, 2016
  3. Erel

    Erel Administrator Staff Member Licensed User

    This is not a bug. For further discussion please start a new thread in the questions forum.
  4. Rusty

    Rusty Well-Known Member Licensed User

    CameraEx - If the device is set to automatically store GPS location, can CameraEx also automatically store the GPS location in the Exif data?
    Or do you have to update the Exif data yourself?
  5. Erel

    Erel Administrator Staff Member Licensed User

    You will need to add it yourself. It is a feature of the camera app.
  6. padvou

    padvou Active Member Licensed User

    Here's some Subs I added to the Class and I use in a project of mine:

    Public Sub GetSupportedWhiteBalance As List
        r.target = parameters
    Return r.RunMethod("getSupportedWhiteBalance")
    End Sub

    Public Sub GetWhiteBalance As String
        r.target = parameters
    Return r.RunMethod("getWhiteBalance")
    End Sub

    Public Sub SetWhiteBalance(Mode As String)
        r.target = parameters
    "setWhiteBalance", Mode, "java.lang.String")
    End Sub
    I also added this code in the Activity Module to test:

    Sub Button1_Click
    For i=0 To L.Size-1
    Dim testval As String=L.Get(i)
    If testval=CurMode Then
    If i <L.Size-1 Then CurMode=L.Get(i+1Else CurMode=L.Get(0)
    End If
    End Sub
    I have a question though.
    A device I'm using gives "manual" as one of the white balance modes.
    Does anyone know how to use it in code and send a manual value?
  7. biometrics

    biometrics Active Member Licensed User

    Has anyone used this with a Samsung J1 entry level phone?

    I have reports that it's failing to take a picture with .TakePicture.

    Unfortunately I don't have such a phone to test so that makes it difficult to sort out.
  8. cxdzbl

    cxdzbl Active Member Licensed User

    For a long time did not solve the problem of the direction of the photo, and finally solved today, thank you
  9. hayderOICO

    hayderOICO Member Licensed User

    hi erel

    I just upgraded from the 1.21 to the 1.3 library. added javaobjects. but the commit parameter fails.

    the "demo" camera app you bundled does work fine though. here's some of my code.

    using b4A v 5.02

    #Region  Project Attributes
    #ApplicationLabel: Cam
    #VersionCode: 5
    'SupportedOrientations possible values: unspecified, landscape or portrait.
        #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
    #End Region

    #Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
    #End Region

    Sub Process_Globals
    Private frontCamera As Boolean = False
    Private usbserial As felUsbSerial
    Private manager As UsbManager
    Dim DisableCameraTimer As Timer
    Dim TakePicTimer As Timer
    End Sub

    Sub Globals
    Private Panel1 As Panel
    Private Panel2 As Panel
    Private camEx As CameraExClass
    Private btnTakePicture As Button
    Dim awake As PhoneWakeState
    End Sub

    Sub Activity_Create(FirstTime As Boolean)

    If FirstTime Then
    End If

    End Sub

    Sub Activity_Resume
    End Sub

    Private Sub InitializeCamera
        camEx.Initialize(Panel2, frontCamera, Me, 
        frontCamera = camEx.Front
    End Sub

    Sub Activity_Pause (UserClosed As Boolean)
    End Sub

    Sub Camera1_Ready (Success As Boolean)
    If Success Then
    ToastMessageShow("Cannot open camera."True)
    End If
    End Sub

    Sub btnTakePicture_Click
    If mode_select = "I" Then
    End If
        btnTakePicture.Enabled = 
    End Sub

    Sub DisableCameraTimer1_Tick
    End Sub

    Sub pictimer_Tick
    End Sub

    Sub PicTake
        btnTakePicture.Enabled = 
    End Sub

    Sub Camera1_PictureTaken (Data() As Byte)
    End If
    End Sub
    Last edited: May 25, 2017
  10. Erel

    Erel Administrator Staff Member Licensed User

    1. Please don't limit your questions to a single member.

    2. Please start a new thread for this question and make sure to post:
    a. Whether the example as is worked for you.
    b. The error message.
  11. Rusty

    Rusty Well-Known Member Licensed User

    Is there a way to find a "new thread" as suggested above?
    It would be nice if a URL was posted in the "final" thread pointing to the new thread so we/I could easily find the "new thread" with a simple click...
    Just sayin'... :)
  12. Erel

    Erel Administrator Staff Member Licensed User

    Rusty likes this.
  13. NeoTechni

    NeoTechni Well-Known Member Licensed User

    I'm having trouble restarting the camera after it shuts down. Is there certain subs I should be calling to properly shut it down besides camEx.Release, and camEx.Initialize to turn it on? Or would you prefer this in a new thread?

    EDIT: I think I found the issue. The panel needed to be visible.
    Last edited: Jul 9, 2017
  14. Croïd

    Croïd Active Member Licensed User

    Do you know, how I can add a precision circle for focus mode? ( as Google camera)

  15. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread in the questions forum.
  16. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread in the questions forum.
  17. Croïd

    Croïd Active Member Licensed User


    JUAN CARLOSORDOÑEZ Member Licensed User

    Hello. When I run your example its shows "
    B4A Versión: 7.30
    Parseando código. (0.02s)
    Compilando código (0.07s)
    Compilado código de diseños (0.01s)
    Organizando librerías. (0.00s)
    Generando el fichero R. (0.05s)
    Compilando el código Java generado. (1.38s)
    Convirtiendo byte code a dex optimizado. Error
    java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
    Exception in thread "main"

    Please help me. thanks!!
  19. Erel

    Erel Administrator Staff Member Licensed User

  20. hears

    hears Active Member Licensed User

    can you share this library JAVA code? i try to make a same library now.
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice