eginning in BREW 2.1, QUALCOMM introduced the ICamera API to support still and motion image capture from the image sensor found on many of today's mid- and high-end BREW-enabled wireless handsets. This interface lets you configure the image sensor, obtain bitmaps suitable for painting on the display to present an image viewfinder, as well as capture and encode still and moving images in formats including JPEG and 3GPP. In this article, you'll learn how to configure and use QUALCOMM's BREW ICamera interface in C.
Before you begin, it's important to look at the business case for your camera-based application. There are many kinds of applications that can be camera-enabled: inventory control, entertainment, and messaging applications, for example, not to mention special applications that require video such as character, bar-code, or facial recognition applications.
In conjunction with the business case, not all handsets have ICamera support, so you should be sure to check the handset data sheets available from QUALCOMM. Moreover, some handsets support different options for ICamera; some handsets offer greater control over image capture options such as exposure settings and the like.
Another business-case concern you must consider is that of the requirements of the operators through which you will launch your application. For example, some carriers dictate that images may only be moved from the handset using the Multimedia Messaging Service (MMS) available as part of their service package, so if you're considering building an application that relies on sharing images off-handset, you'd be wise to consider this restriction when establishing your business case.
As with BREW's other multimedia interfaces, the ICamera interface is a highly asynchronous interface, with your interaction being split between setting parameters, issuing requests through method calls, and responding to ICamera requests through the callback you register. The typical flow when using ICamera is this:
- You begin by calculating the screen bounds on the display where you will show the camera viewfinder.
- Next, create an instance of the ICamera interface using ISHELL_CreateInstance.
- With the newly-created ICamera interface in hand, register a callback handler that the ICamera interface invokes when changing state or as new images become available.
- After creating the ICamera interface and registering a callback handler, you will set basic options controlling the camera's behavior including exposure options. Most applications should set the camera to a fully automatic mode; some high-performance applications, or those intended for integration with the handset firmware, might provide a sophisticated user interface controlling all of the ICamera interface's options for exposure control, white balance, and so forth.
- Once the camera is configured, interaction with ICamera consists of interpreting user events (such as a request for image capture) and invoking the appropriate ICamera methods, or responding to ICamera requests through your callback function.