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

Native Development

Reply
Contributor
hamlatzis
Posts: 27
Registered: ‎08-06-2012
My Device: PlayBook
Accepted Solution

Question regarding camera buffer

Hi!

 

Does anyone know the format of the raw data for the camera buffer? I want to port an application of mine from the PC and I would like to know some things for the camera buffer so that I can manipulate the pixels.

 

For instance in my application (PC version) the stream from the web camera has the frame upside down (like a bmp file) and depending on how I set the connection to the web camera the data could be either in jpg or bmp (raw) format.

Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: Question regarding camera buffer

I'm looking into this and will get back to you.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: Question regarding camera buffer

[ Edited ]

We support the following two formats:

 

1. NV12 – this is YUV420 semi-planar (UV planes interleaved)
2. RGB (actually BGRA if you want to get technical).

 

You can see what the NV12 colour format looks like in the PDF slides here:

 

https://bbjam.blackberryconferences.net/asia2013/connect/sessionDetail.ww?SESSION_ID=1551
Slide 23.

If you want to work with NV12 (the default), then you select that mode in your API calls.


If you want RGB, then you have to be aware of some limitations. RGB is usually only used by folks who are integrating with opengl or similar. NV12 (YUV) is standard for video as this is what video compressors take as input.

 

Example mode selection:
camera_set_videovf_property(handle, CAMERA_IMGPROP_FORMAT, CAMERA_FORMAT_NV12);

 

Example app:

 

https://github.com/blackberry/Presentations/tree/master/2013-BlackBerryJam-Americas/JAM40/Heartbeat

 

Special thanks to @sdlmcveigh for providing me with this information. Hope it gives you what you need.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Contributor
hamlatzis
Posts: 27
Registered: ‎08-06-2012
My Device: PlayBook

Re: Question regarding camera buffer

Thanks, you're a saviour!!!!!!!!!
Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30

Re: Question regarding camera buffer

It's worth noting that you can also get a constant stream of jpegs if you operate in burst capture mode. What you want depends on your usecase. NV12 is quite easy to work with, however.

 

There are a whole bunch of camera samples on Github: http://blackberry.github.io/Community/Camera.html

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker