Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full Resolution Camera Access in j2me

I'm trying to do an image capture on a high end Nokia phone (N95). The phone's internal camera is very good (4 megapixels) but in j2me I only seem to be able to get a maximum of 1360x1020 image out. I drew largely from this example http://developers.sun.com/mobility/midp/articles/picture/

What I did was start with 640x480 and increase the width and height by 80 and 60, respectively until it failed. The line of code is:

jpg = mVideoControl.getSnapshot("encoding=jpeg&quality=100&width=" + width + "&height=" + height);

So the two issues are: 1. The phone throws an exception when getting an image larger than 1360x1020. 2. The higher resolution images appear to be just smoothed versions of the smaller ones. E.g. When I take a 640x480 image and increase it in photoshop I can't tell the difference between this and one that's supposedly 1360x1020.

Is this a limitation of j2me on the phone? If so does anyone know of a way to get a higher resolution from within a j2me application and/or how to access the native camera from within another application?

like image 664
Cory Avatar asked Oct 28 '08 00:10

Cory


2 Answers

This explanation on Nokia forum may help you.

It says that "The maximum image size that can be captured depends on selected image format, encoding options and free heap memory available."

and

"It is thus strongly adviced that at least larger images (larger than 1mpix) are captured as JPEG images and in a common image size (e.g. 1600x1200 for 2mpix an so on). Supported common image sizes are dependent on product and platform version."

So I suggest you to take some tries 1. with 1600x1200, 1024x768 and whatever image resolution your N95 guide mentions 2. with BMP and PNG as well.

Anyway, based on my earlier experiences (that could be outdated), j2me implementations are full of bugs, so there may not be a working solution to your problem.

like image 181
rics Avatar answered Sep 25 '22 07:09

rics


Your cameras resolution is natively: 2582 x 1944 . Try capturing there to see how that goes.

This place: http://developers.sun.com/mobility/midp/articles/picture/index.html

Mentions the use of:

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

The use of raw seems interesting, to get the native resolution.

like image 22
SuperRoach Avatar answered Sep 24 '22 07:09

SuperRoach