Taking Snapshots with the Z1010 camera
|
With a Java MIDlet you can use the video camera in the Z1010 to take snapshots for use in your application. Taking snapshots with the camera is an optional part of the Mobile Media API (MMAPI, JSR-135). The Z1010 supports this functionality, something that opens up a lot of new possible applications. The VideoController is used in two different ways to let the viewfinder appear either on a Form or a Canvas, as in this code: myPlayer = Manager.createPlayer("capture://video");// Set the viewfinder size
To capture an image, you just call: byte[] byteImage = vc.getSnapshot(null);Image camImage = Image.createImage(byteImage, 0, byteImage.length); Important to know is that the size of the captured image will always be size120 * 160. There are two things to note about this: Firstly, you cannot pass any size parameters to cretePlayer() to change this. For example, the following will not work: Manager.createPlayer("capture://video?encoding=png&width=80&height=60");
Secondly, the size of the viewfinder has no impact on the size of the captured image. Besides this, there is really not much more to it. The attached MIDlet is a simple example and shows the functionality. It will display a viewfinder and at the click on the "click" button, it will take a snapshot and show it on a Canvas. |


Technorati
