UPDATE! - Zoom, Current & Supported - Advanced Camera Library V2.00
I'm glad to announce my fourth library!
This library is a modification of the existing camera library with more options.
So the standard procedures of the camera still apply.
Basic4android - Camera
You can find the Advanced Camera Library in the attachements.
To use: Extract and Copy the Advanced Camera.xml and Advanced Camera.jar to the library folder in "Anywhere Software\Basic4android\Libraries".
.:!BIG UPDATE!:.
Advanced Camera Library has been updated to version 2.0 with tons of new features!
See post #19
http://www.b4x.com/forum/52479-post19.html
So, let's start
1) Flashlight
a.
b.
c.
2) Camera's
a.
b.
3) Orientation
a.
b.
4) Pictures
a.
b.
5) Antibanding
6) Colour Effects
a.
7) Focus Mode
8) Scene Mode
9) White Balance
If there are any bugs, questions or features you want to add to the library, please post them on this forum.
Credits and feedback are really much appreciated!
Thank you very much!
XverhelstX
Full example:
Hello everyone!
B4X:
Sub Globals
Dim camera1 As AdvancedCamera ' New lib
End Sub
I'm glad to announce my fourth library!
This library is a modification of the existing camera library with more options.
So the standard procedures of the camera still apply.
Basic4android - Camera
You can find the Advanced Camera Library in the attachements.
To use: Extract and Copy the Advanced Camera.xml and Advanced Camera.jar to the library folder in "Anywhere Software\Basic4android\Libraries".
.:!BIG UPDATE!:.
Advanced Camera Library has been updated to version 2.0 with tons of new features!
See post #19
http://www.b4x.com/forum/52479-post19.html
.:Index:.
[1] Flashlight
[2] Camera's
[3] Orientation
[4] Pictures
[5] Antibanding
[6] Colour Effects
[7] Focus Mode
[8] Scene Mode
[9] White Balance
[1] Flashlight
[2] Camera's
[3] Orientation
[4] Pictures
[5] Antibanding
[6] Colour Effects
[7] Focus Mode
[8] Scene Mode
[9] White Balance
So, let's start
1) Flashlight
a.
"FlashAuto": Enables the flashlight to turn on automatically.
B4X:Camera1.FlashAuto()
b.
"FlashOn": Turns the flashlight on.
B4X:Camera1.FlashOn()
c.
"FlashOff": Turns the flashlight off.
B4X:Camera1.FlashOff()
2) Camera's
a.
"CameraBack": Sets the back camera as primary camera.
B4X:Camera1.CameraBack()
b.
"CameraFront": Sets the front camera as primary camera.
B4X:Camera1.CameraPortrait()
3) Orientation
a.
"OriLandscape": Sets the orientation to landscape mode.
B4X:Camera1.OriLandscape()
b.
"OriPortrait": Sets the orientation to portrait mode.
B4X:Camera1.OriPortrait()
4) Pictures
a.
"PictureSize": Sets the size of the picture in pixels.
The parameters must be modified before Camera1.StartPreview.
B4X:Camera1.PictureSize(480,320)
b.
"Quality": Sets the quality of the JPEG picture. Range between 0 - 100, with 100 being the best.
The parameters must be modified before Camera1.StartPreview.
B4X:Camera1.Quality = 100
5) Antibanding
"setAntibanding": Sets the Antibanding. This is used to remove noises like when you take a picture of a monitor/television screen.
- ANTIBANDING_50HZ: Sets the antibanding to 50Hz.
- ANTIBANDING_60HZ: Sets the antibanding to 60Hz.
- ANTIBANDING_AUTO: Sets the antibanding to automatic mode.
- ANTIBANDING_OFF: Sets the antibanding off.
B4X:Camera1.setAntibanding = "ANTIBANDING_AUTO"
6) Colour Effects
a.
"setEffect": Sets the color effect of your picture.
- AQUA
- BLACKBOARD
- MONO
- NEGATIVE
- NONE
- POSTERIZE
- SEPIA
- SOLARIZE
- WHITEBOARD
B4X:Camera1.setEffect = "SEPIA"
7) Focus Mode
"setFocusMode": Sets the focus mode of your picture.
- MACRO: Close-up.
- INFINITY: Far distance.
- FIXED: If the camera has auto-focus, this mode can fix the focus.
- AUTO: Auto-focus mode.
- EDOF: Focusing is done digitally and continuously.
B4X:Camera1.setFocusMode = "MACRO"
8) Scene Mode
"setSceneMode": Sets the scene mode of your picture.
- ACTION: Take photos of fast moving objects.
- AUTO: Scene mode is off.
- BEACH: Take pictures on the beach.
- CANDLELIGHT: Capture scenes lit by candles.
- FIREWORKS: Take pictures of fireworks.
- LANDSCAPE: Take pictures on distant objects.
- NIGHT: Take photos at night.
- PARTY: Indoor low-light shot.
- PORTRAIT: Take people pictures.
- SNOW: in the snow.
- STEADYPHOTO: Avoid blurry pictures (handshake).
- SUNSET: Take Sunset photos.
- THEATRE: Take photos in a theater.
B4X:Camera1.setScene = "BEACH"
9) White Balance
"setWhiteBalance": Sets the white balance of your picture.
- AUTO
- CLOUDY_DAYLIGHT
- DAYLIGHT
- FLUORESCENT
- INCANDESCENT
- SHADE
- TWILIGHT
- WARM_FLUORESCENT
B4X:Camera1.setWhiteBalance = "WARM_FLUORESCENT"
If there are any bugs, questions or features you want to add to the library, please post them on this forum.
Credits and feedback are really much appreciated!
Thank you very much!
XverhelstX
Full example:
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim camera1 As AdvancedCamera
Dim Panel1 As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Menu")
activity.AddMenuItem("Take Picture","mnuTakePicture")
activity.AddMenuItem("Set Effect","mnuSetEffect")
activity.AddMenuItem("Flash On","mnuFlashOn")
activity.AddMenuItem("Focus Mode","mnuFocusMode")
End Sub
Sub Activity_Resume
camera1.Initialize(panel1, "Camera1")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
camera1.StopPreview
camera1.Release
End Sub
Sub mnuFlashOn_Click
camera1.FlashOn()
End Sub
Sub mnuSetEffect_Click
Camera1.setEffect = "SEPIA"
End Sub
Sub Camera1_Ready (Success As Boolean)
If success Then
Camera1.StartPreview
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub
Sub Camera1_PictureTaken (Data() As Byte)
camera1.StartPreview
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, "Image.jpg", False)
out.WriteBytes(data, 0, data.Length)
out.Close
ToastMessageShow("Image saved: " & File.Combine(File.DirRootExternal, "Image.jpg"), True)
End Sub
Sub mnuTakePicture_Click
camera1.TakePicture
End Sub
Sub mnuFocusMode_Click
camera1.setFocusMode = "MACRO"
End Sub
Attachments
Last edited: