0% found this document useful (0 votes)
14 views

Modules First Description

This document discusses how to capture images from a device's video camera within a MIDlet application. It explains that you first obtain a Player object from the Manager to get access to the camera. Then you display the live camera video feed using a VideoControl object and capture an image by calling the VideoControl's getSnapshot() method, which returns the image data in byte array format. By default, images are in PNG format.

Uploaded by

qwertr707936
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Modules First Description

This document discusses how to capture images from a device's video camera within a MIDlet application. It explains that you first obtain a Player object from the Manager to get access to the camera. Then you display the live camera video feed using a VideoControl object and capture an image by calling the VideoControl's getSnapshot() method, which returns the image data in byte array format. By default, images are in PNG format.

Uploaded by

qwertr707936
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Capturing The Video:

Once the camera video is shown on the device, capturing an image is easy. All you need to do is call Video Controls get Snapshot() method. The get Snapshot() method returns an array of bytes, which is the image data in the format you requested. The default image format is PNG (Portable Network Graphic). The Mobile Media API (MMAPI) extends the functionality of the J2ME platform by providing audio, video and other time-based multimedia support to resource-constrained devices. Getting a Video Capture Player: The first step in taking pictures (officially called video capture) in a MIDlet is obtaining a Player from the Manager. Player mPlayer = Manager.createPlayer("capture://video"); The Player needs to be realized to obtain the resources that are needed to take pictures. mPlayer.realize(); Showing the Camera Video The video coming from the camera can be displayed on the screen either as an Item in a Form or as part of a Canvas. A Video Control makes this possible. To get a VideoControl, just ask the Player for it: VideoControl mVideoControl = (VideoControl)mPlayer.getControl("VideoControl"); Capturing an Image Once the camera video is shown on the device, capturing an image is easy. All you need to do is call VideoControl's getSnapshot() method. The getSnapshot() method returns an array of bytes, which is the image data in the format you requested. The default image format is PNG (PortableNetwork Graphic).

byte[] raw = mVideoControl.getSnapshot(null); Image image = Image.createImage(raw, 0, raw.length);

You might also like