×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    2

    Why getting only a part of a taken snapshot???

    Hey,

    i try to get a snapshot from the camera of Nokia 5230 (S60 5th 40.xx Firmware, J2ME). I need a full resolution image (1200x1600) in portrait orientation for image processing. The code below captures a 1200x1600 image, but the image content is much smaller than the image content when taking an image with the build-in normal camera. It seems like the image is cut on top and bottom.

    Has anybody an idea how to get an image with the full content, like taking a picture with the build-in camera?

    Thanks for your help!!!



    public Image captureVideo() {
    Image image=null;
    Form form = new Form("View");
    try {
    try {
    player = Manager.createPlayer("capture://video");
    } catch (IOException ex) {
    ex.printStackTrace();
    settext("Fehler " + ex.getMessage());
    } catch (MediaException ex) {
    ex.printStackTrace();
    settext("Fehler "+ ex.getMessage());
    }
    player.realize();
    if ((videoControl = (VideoControl)player.getControl("VideoControl")) != null)
    {
    form.append((Item) videoControl.initDisplayMode(videoControl.USE_GUI_PRIMITIVE, null));
    }

    player.prefetch();
    player.start();

    videoControl = (VideoControl)player.getControl("VideoControl");
    videoControl.setDisplaySize(360, 640);
    byte[] raw = videoControl.getSnapshot("width=1200&height=1600");
    image = Image.createImage(raw, 0, raw.length);

    ImageItem Ii = new ImageItem("pic", image, 0, "");
    form.append(Ii);
    dis.setCurrent(form);
    //snapshot=image;
    player.close();
    player = null;
    videoControl = null;
    } catch (MediaException me) { settext("Fehler " + me.getMessage());}

    return image;
    }

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Why getting only a part of a taken snapshot???

    Could be that you just cannot get an image that large in "raw". Have you tried using jpeg image format? (yes I know it is not optimal for image processing)

    Some tidbits on this in here
    http://library.forum.nokia.com/topic...D8F1EE772.html

    "Snapshots are always taken with the next largest image size supported by the product. For example, if 460x345 is requested, then a 640x480 image is taken and resized down. If the requested size is larger than the largest image size supported by the product, then the largest possible image is taken and enlarged to the requested size. If the aspect ratio requested does not match the default, the resulting image will be distorted.

    The maximum image size that can be captured depends on selected image format, encoding options and free heap memory available. The images are generally first captured as raw image data and then encoded to selected image format. The raw image as well as image resizing and encoding steps use quite lot of memory. If memory is exhausted, then OutOfMemoryError will be thrown.

    If a JPEG image is requested in a common size that is directly supported by the camera, then the image is captured directly to JPEG image by camera and no resizing or encoding are needed. In this case far less memory is used and image capturing is faster. 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."

    Hartti

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    2

    Re: Why getting only a part of a taken snapshot???

    Hi Hartti,

    thanks for your reply!
    I just tried it with an jpg and a resolution of 640x480, but the problem is still there. I also get an image with the right resolution but only a part the content. It seems not only to be a problem of the snapshot function, because the showed videocontrol at the canvas also shows the reduced content.
    But i found out, that when i start the programm by holding the phone in a landscape orientation and then rotate it in a portrait orientation and take a picture, the full content is shown. The saved picture is rotate 90 degree. When i turn off the rotation sensor, this trick does not work any longer.

    Do you have any other ideas?

    Greets!

Similar Threads

  1. Changing resolution of snapshot taken
    By cryptyritu in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2010-09-13, 08:43
  2. Only few contacts are getting Decrypted......... Why?
    By jennie in forum Symbian User Interface
    Replies: 4
    Last Post: 2007-10-30, 05:22
  3. Replies: 9
    Last Post: 2007-06-16, 08:47
  4. Series 40 - draw only a part of the image
    By ionutianasi in forum Mobile Java Media (Graphics & Sounds)
    Replies: 11
    Last Post: 2003-09-08, 04:25
  5. Copy only a part of an image
    By FatalError in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2003-05-11, 07:51

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×