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

Status
Not open for further replies.
Example based on B4XPages: https://www.b4x.com/android/forum/threads/b4x-b4xpages-barcode-reader.120417/#content

CameraEx class wraps the Camera object and using reflection and other code it extends its functionality.

CameraEx class requires Android 2.3+ and depends on Camera library v2.20+
CameraEx features:
  • Easily open the back or front camera
  • Preview images and saved images orientation will match the device orientation (all orientations are supported)
  • Gives access to Camera.Parameters native class (flashmode, picture size, effects and other settings)
  • Includes methods to convert preview images to JPEG and to save the taken pictures.
  • It should be simple to add more methods to this class

SS-2012-11-28_12.18.31.png


See this page for the constant values and other possible methods:
https://developer.android.com/reference/android/hardware/Camera.Parameters.html

Note that you should call CommitParameters after changing one or more parameters.

CameraExClass module is included in the attached example.

V1.30 is attached - Includes various new methods.

v1.20 - Includes all the various posts in this thread as well as AutoFocusAndTakePicture method which first calls AutoFocus and then takes a picture (if AutoFocus was successful).

Edit (06/2018): A new version was uploaded with targetSdkVersion set to 26.
 

Attachments

Last edited:
Erel... All I was saying is that in his image, you can see just the top of the picture size button at the bottom of his image...

This is because his "view" is long and short... the button for picture size in your example is too low to show on his device... Your example, while fine for most rectangular formats in portrait or landscape, has too many buttons vertically to show on his shorter screen.
 
Last edited:
i think, the Glass res & ratio is equal to a 16:9 format - and that cant be handled by the "normal" classes and libs 'cause they are developed for another ratio (for smartphones).
MAYBE some time there will be 16:9 smartphones (thinking about how that should look like) :rolleyes:
 

Attachments

Try to change the zoom level:
Code:
Public Sub IsZoomSupported As Boolean
  r.target = parameters
  Return r.RunMethod("isZoomSupported")
End Sub
Public Sub GetMaxZoom As Int
  r.target = parameters
  Return r.RunMethod("getMaxZoom")
End Sub

Public Sub getZoom() As Int
  r.target = parameters
  Return r.RunMethod("getZoom")
End Sub
Public Sub setZoom(ZoomValue As Int)
  r.target = parameters
  r.RunMethod2("setZoom", ZoomValue, "java.lang.int")
End Sub

http://www.b4x.com/android/forum/th...ex-class-zoom-function-to-work.35829/#content
 
Yes...

I share with everybody this project....

Works very well with Google Glass, my Samsung Galaxy Tab 7, my Smartwach.

The APP is in Google Play in https://play.google.com/store/apps/details?id=com.visualnet.glasscolor

This may give inaccurate colors in low light. Is there a way to check if light is low and warn the user? How many colors database are you using (may be 500?)? I was wondering if the colors database could be stored locally in SQlite and used without sacrificing retrieval speed.
 
Yes, I work in a new version to put the database inside a project, not in internet.

and the check if light is low, yes, can be, look the google glass sensors:
The following sensors are supported on Glass:

The following sensors are not supported:


  • And the quantity of colors is 751, look the attachment
 

Attachments

Yes, I work in a new version to put the database inside a project, not in internet.

and the check if light is low, yes, can be, look the google glass sensors:
The following sensors are supported on Glass:

The following sensors are not supported:


  • And the quantity of colors is 751, look the attachment
Thank you for the links. :)I will study them
 
Hi Erel...

I'm using this class, but I've got an issue... the flash and the switch camera work fine in Release mode, but don't work at all in Release (Obfuscated).

Any idea why?
 
Status
Not open for further replies.
Back
Top