APIs to use the Camera on BlackBerry 10


The main forum for questions depends on the software stack being used:


Shows how to set up a Cascades foreign window and connect the Camera viewfinder to it.

Shows how to set up a Camera viewfinder in a non-cascades environment using libscreen.

Shows how to record videos using the Camera. This sample is based on the HelloCamera sample so it also illustrates how to set up a Cascades foreign window and connect the Camera viewfinder to it.

A camera application that let’s you take photos and then have them “bombed” by somebody. The app shows how to use the Cascades multimedia library with Camera, take a picture, manipulate the image, and add an image over another image.

BestCamera Demonstrates best-practices for using the native C camera API in a barebones Cascades camera app. This app properly handles powerdown/resume, resource sharing, rotation, aspect ratios, photo & video modes, resolution discovery, etc.

BBJam Samples

A collection of sample apps demonstrated in the Native Camera API Deep-Dive session at the BlackBerry JAM conferences in San Jose, Amsterdam, and Orlando. Some of these samples are similar to those listed above, but with a focus on more in-line documentation, as well as notes on best-practices and “gotchas”. Some more advanced samples and demos are also found in this section.

Viewfinder A simple sample using libscreen which illustrates how to start a viewfinder. Includes notes on how to inventory available cameras and search for cameras based on the features you require.

RecordVideo Builds on the Viewfinder sample by adding the ability to record a video. Shows how to play a start/stop tone and how to select a filename on the camera roll to save the video to.

TakePhoto This is similar to the NativeCamera sample, but with some additional documentation. Demonstrates how to take a picture and save it to the camera roll.

TakeBurst This sample demonstrates how to do a burst photo capture and provides recommendations for efficiently saving full-resolution images at 15fps through the use of buffering. Burst capture can be used as the basis for many interesting effects such as HDR, exposure bracketing, and is used to implement the time-warp effect in the BB10 camera app.

FlashPhoto A Cascades photo-taking sample which illustrates how to query available flash modes, how to configure the flash, and how to detect whether the flash has fired when a photo is captured.

SceneZoom A Cascades photo-taking sample which illustrates how to query available scene modes and how to switch between scene modes. Also demonstrates the two mechanisms for adjusting the zoom level and how to determine the range for zoom values.

Focus A Cascades photo-taking sample which demonstrates how to operate the various focus modes available on the device. Shows how to query the available modes, how to configure them, and provides controls for interacting with the various modes (eg. sliders for manual focus or a touch-interface to focus on a particular region of the scene).

FaceFilter A C video recording sample which illustrates how to apply in-line filter effects to the live camera video stream. Face-detect metadata reporting is enabled, the face co-ordinates are extracted from the preview image stream, and the video buffer is modified with a pixelating mosaic effect. If you tap to enable video recording, you will find that the mosaic effect is present when the video is played back. This sample also illustrates the concept of event-based access to the camera buffers. For read/write buffer access, the familiar callback mechanism cannot be used.

Camera3D A C camera sample which shows how to render the camera viewfinder into an OpenGL texture. Also demonstrates the use of the event-mode interface, and the RGB video viewfinder. This sample extends the GoodCitizen 3d-cube demo.

Heartbeat A Cascades sample showing how the camera viewfinder can be used in some interesting ways. Specifically, this sample uses the video viewfinder to measure your heartrate when your finger is held over the on-board videolight. The algorithm was hastily put together, so this sample is ripe for someone who has a bit more time to implement a proper FFT. Community contribution welcome!

Character A GamePlay3D sample which illustrates how to render the camera viewfinder as a texture in a 3D scene! This uses a similar approach as the Camera3D sample. This sample extends the stock “character” sample from the GamePlay3D repository Here.

Moustacher A face-detection sample written in C which superimposes a moustache on your face. Similar to the FaceFilter sample. Illustrates in-line filter effects and parsing of face-detect data. Moustaches will also be present in your recorded videos!

SlaveFlash A C sample which was written to illustrate other interesting things that can be done with retroactive burst capture. A circular buffer of past images is maintained and when a large jump in review-frame brightness is detected followed by a similar decrease in brightness, we assume that an external flash has fired. The full-resolution image with the matching timestamp is extracted from the circular buffer, saved to disk, and then opened in the picture viewer card. The decision to try this with an external flash was to demonstrate that if you don’t like the on-board flash, you can try using your professional strobes!

Presentations, Articles and Other Media

Also See

Cascades, WebWorks, Native