Full Resolution Camera Access in j2me
Asked Answered
C

3

5

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?

Cablegram answered 28/10, 2008 at 0:50 Comment(0)
A
6

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.

Adagietto answered 2/12, 2008 at 14:40 Comment(0)
T
3

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.

Tranquillize answered 7/12, 2008 at 8:57 Comment(0)
B
1

The 'quality' of a JPEG (As interpreted by the code) is nothing to do with the resolution. Rather it is to do with how compressed the image is. A 640x480 image at 100 quality will be noticably better looking than a 640x480 image at 50, but will use more storage space.

Try this instead:

jpg = mVideoControl.getSnapshot("encoding=jpeg&quality=100&width=2048&height=1536");
Booboo answered 28/10, 2008 at 8:48 Comment(1)
Thanks for the help, but this creates another issue (see edit).Cablegram

© 2022 - 2024 — McMap. All rights reserved.