Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4android > Additional libraries, classes and official updates
Documentation Wiki Register Members List Windows Mobile Search Today's Posts Mark Forums Read

Additional libraries, classes and official updates Users contributed libraries, classes and official updates. This forum is open for licensed users only.

Advanced Camera Library V1.00

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-25-2011, 07:26 PM
XverhelstX's Avatar
Basic4android Expert
 
Join Date: Mar 2011
Location: Belgium
Posts: 886
Default UPDATE! - Zoom, Current & Supported - Advanced Camera Library V2.00

Hello everyone!

Code:
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.basic4ppc.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


So, let's start

1) Flashlight

a.
Quote:
"FlashAuto": Enables the flashlight to turn on automatically.
Code:
Camera1.FlashAuto()
b.
Quote:
"FlashOn": Turns the flashlight on.
Code:
Camera1.FlashOn()
c.
Quote:
"FlashOff": Turns the flashlight off.
Code:
Camera1.FlashOff()
2) Camera's

a.
Quote:
"CameraBack": Sets the back camera as primary camera.
Code:
Camera1.CameraBack()
b.
Quote:
"CameraFront": Sets the front camera as primary camera.
Code:
Camera1.CameraPortrait()
3) Orientation

a.
Quote:
"OriLandscape": Sets the orientation to landscape mode.
Code:
Camera1.OriLandscape()
b.
Quote:
"OriPortrait": Sets the orientation to portrait mode.
Code:
Camera1.OriPortrait()
4) Pictures

a.
Quote:
"PictureSize": Sets the size of the picture in pixels.
The parameters must be modified before Camera1.StartPreview.
Code:
Camera1.PictureSize(480,320)
b.
Quote:
"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.
Code:
Camera1.Quality = 100
5) Antibanding

Quote:
"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.
Code:
Camera1.setAntibanding = "ANTIBANDING_AUTO"
6) Colour Effects

a.
Quote:
"setEffect": Sets the color effect of your picture.
  • AQUA
  • BLACKBOARD
  • MONO
  • NEGATIVE
  • NONE
  • POSTERIZE
  • SEPIA
  • SOLARIZE
  • WHITEBOARD
Code:
Camera1.setEffect = "SEPIA"
7) Focus Mode

Quote:
"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.
Code:
Camera1.setFocusMode = "MACRO"
8) Scene Mode

Quote:
"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.
Code:
Camera1.setScene = "BEACH"
9) White Balance

Quote:
"setWhiteBalance": Sets the white balance of your picture.
  • AUTO
  • CLOUDY_DAYLIGHT
  • DAYLIGHT
  • FLUORESCENT
  • INCANDESCENT
  • SHADE
  • TWILIGHT
  • WARM_FLUORESCENT
Code:
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:

Code:


'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
Attached Files
File Type: zip ACL4.4.zip (364.7 KB, 936 views)
File Type: zip ACL4.5.zip (33.5 KB, 586 views)
File Type: zip ACL4.6.zip (359.4 KB, 1799 views)
__________________
B4A Docs|B4A Wiki|B4A Unofficial Chat
I'm a freelance library developer! Check out this topic!


Last edited by XverhelstX : 12-16-2011 at 10:19 PM.
Reply With Quote
  #2 (permalink)  
Old 05-25-2011, 08:48 PM
Merlot2309's Avatar
Senior Member
 
Join Date: Feb 2009
Location: Spain
Posts: 362
Default

Hi,

Will test and use it asap.
Glad that you found B4A

Greets,

Helen
__________________
Samsung Galaxy Note - IPhone 4 - HTC Legend - Android 2.2 Tablet 10.2" (Chinese Superpad 3)
Reply With Quote
  #3 (permalink)  
Old 05-25-2011, 09:21 PM
Basic4android Expert
 
Join Date: May 2011
Posts: 749
Default

Awesome

Just so we don't have to memorize those strings, I'd suggest a way to obtain them from the lib.

ie: returning a list of them
function PollColorModes() as list

Makes me wish we had an enum type.
Reply With Quote
  #4 (permalink)  
Old 05-25-2011, 09:26 PM
XverhelstX's Avatar
Basic4android Expert
 
Join Date: Mar 2011
Location: Belgium
Posts: 886
Default

@merlot, Thanks! I'm glad I've found B4A.

@neo, there is a way with the IDE. Just start typing like camera1. Then select it from the list and the info will be displayed with all functions.

XverhelstX

Sent from my SE Xperia Play using Tapatalk.
__________________
B4A Docs|B4A Wiki|B4A Unofficial Chat
I'm a freelance library developer! Check out this topic!

Reply With Quote
  #5 (permalink)  
Old 05-25-2011, 10:49 PM
ZJP's Avatar
ZJP ZJP is offline
Knows the basics
 
Join Date: Dec 2010
Posts: 145
Default

Do not forget
Quote:
Sub Globals
Dim camera1 As AdvancedCamera ' New lib
End Sub
The parameters must be modified before :
Quote:
Camera1.StartPreview
Thx


JP

Last edited by ZJP : 05-25-2011 at 11:50 PM.
Reply With Quote
  #6 (permalink)  
Old 05-26-2011, 04:02 AM
Basic4android Expert
 
Join Date: May 2008
Posts: 792
Default

Thank you XverhelstX! You always create fantastic libraries.
__________________
I'm not good at English, please understand. Thank you.
Reply With Quote
  #7 (permalink)  
Old 05-26-2011, 05:12 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 25,881
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Great work XverhelstX.
I recommend you to change the name of this library to AdvancedCamera. The space can do all kinds of strange problems.
Reply With Quote
  #8 (permalink)  
Old 05-26-2011, 03:30 PM
XverhelstX's Avatar
Basic4android Expert
 
Join Date: Mar 2011
Location: Belgium
Posts: 886
Default

@ ZJP; Thanks, I will add it to the topic.

@ susu; Thank you ;D, I got a lot of help from other people too.

@ Erel; Name of library has been changed, thanks.

@ All; Added a complete example of the Advanced Camera Library.

XverhelstX
__________________
B4A Docs|B4A Wiki|B4A Unofficial Chat
I'm a freelance library developer! Check out this topic!


Last edited by XverhelstX : 05-26-2011 at 03:45 PM.
Reply With Quote
  #9 (permalink)  
Old 05-27-2011, 05:27 AM
Newbie
 
Join Date: May 2011
Posts: 6
Default

Thanks XverhelstX, as always a great library.

Just a question, if i try to issue a camera1.CameraFront i get a java.lang.NullPointerException, it means that in 2.2 still can't use frontcam?
Reply With Quote
  #10 (permalink)  
Old 05-27-2011, 08:41 PM
Senior Member
 
Join Date: Mar 2011
Posts: 362
Default

Hi

I cannot make th portrait to work
what am i doing wrong:


Sub Camera1_Ready (Success As Boolean)
If success Then
Camera1.OriPortrait
Camera1.StartPreview
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
CCD Camera Library dzt Additional Libraries 35 11-16-2011 08:36 PM
Advanced Camera Library XverhelstX Basic4android Updates and Questions 34 11-08-2011 08:34 PM
New Camera library - v1.00 Erel Additional libraries, classes and official updates 16 05-20-2011 10:13 PM
Advanced Search Issue splatt Forum Discussion 3 04-01-2011 11:46 AM
CCD Camera Library/DLL? willisgt Questions (Windows Mobile) 2 11-01-2007 07:09 PM


All times are GMT. The time now is 05:51 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0