Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Contributor
Posts: 34
Registered: ‎05-02-2013
My Device: 9700
My Carrier: Idea
Accepted Solution

Black berry camera programming

I want take pictures using black berry camera for my app, it is possible in v5.0 and yes then how?

Contributor
Posts: 13
Registered: ‎05-14-2013
My Device: 9700
My Carrier: Tata Indicom

Re: Black berry camera programming

4 down vote accepted


Yes it is definitely possible, but not a very simple task if you don't get some advice up front.

First and foremost, there is some sample code that is shipped with the Eclipse package at least (CameraDemo) that shows how to create a viewfiender using a Field, Player, and VideoScreen. The biggest issue is third party developers cannot overlay anything on top of the view finder (which is the what they'll call the Field after you set it as such with a VideoControl.

Also, you are very limited to what size you can set the Field -- I only got half size and fullscreen working, some dimensions got ignored and others caused it to not be displayed at all.

Here is some code that shows this:

private Field _videoField;
private Player _player;
private VideoControl _videoControl;

private void initCamera() {
try{
_player = Manager.createPlayer( "capture://video??encoding=jpeg&width=640&height=480" );
_player.realize();
_player.prefetch();
_videoControl = (VideoControl)_player.getControl("VideoControl");
_player.start();
if (_videoControl != null){

_videoField = (Field) _videoControl.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
_videoControl.setDisplayFullScreen(true);
add(_videoField);
}
}
catch(Exception e)
{
//show error
}
}

After you do this you can use

byte[] image = _videoControl.getSnapshot(sizeAndEncodingParamters);

o snap the picture. To determine what sizeAndEncodingParameters your device supports, you can use System.getProperty("video.snapshot.encodings"); which will return a String[] that you can iterate over to determine what to use.
Contributor
Posts: 34
Registered: ‎05-02-2013
My Device: 9700
My Carrier: Idea

Re: Black berry camera programming

how can i set size of captured image
Contributor
Posts: 13
Registered: ‎05-14-2013
My Device: 9700
My Carrier: Tata Indicom

Re: Black berry camera programming

Check this(Already mention in previous post):

byte[] image = _videoControl.getSnapshot(sizeAndEncodingParamters);
Developer
Posts: 285
Registered: ‎08-26-2011
My Device: 9900
My Carrier: Not Specified

Re: Black berry camera programming

See this below link which helps you:

 

 

http://stackoverflow.com/questions/8678365/how-to-save-captured-image-in-a-folder-in-blackberry/8678...

 

Any doubts please let me know.

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.