×

Discussion Board

Results 1 to 4 of 4

Hybrid View

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    13

    jsr135 highest supported camera resolutions for getSnapShot() on N95

    Hi,

    Could someone please tell me what is the highest camera resolution(s) supported for jsr135 getSnapShot() on the N95 phone ?

    I have been having a lengthly discussion with JDoe in the related thread - jsr234 camera getSnapShot() on Nokia N95 - in the Media (Graphics & Sounds).

    For my N95 (sourced out of Asia-Singapore) with original rom 10.0.018 2007-03-15, now updated to 11.0.0.026 2007-04-17, the highest resolution I can use is -

    "encoding=jpeg&width=1024&height=768"

    - however I can only write this to the filesystem ok - I cannot create an Image object from the returned byte array - getting an error dialogue 'Unhandled Exception, Close Application ? Yes No.

    Whereas JDoe ( using N95 from Finland ) is able to use "encoding=jpeg&width=1024&height=768" ok and is also able to create an Image object successfully.

    Best I can do successfully is -

    "encoding=jpeg&width=960&height=720"

    ( This is with no other applications running concurrently and using the default camera settings in the supplied Nokia Camera application ).

    Any details / comments / suggestion appreciated.

    Regards

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    62

    Re: jsr135 highest supported camera resolutions for getSnapShot() on N95

    Are you perhaps running out of memory?

    An Image object containing data for a 1024x768 RGBA image needs to allocate 3145728 (= 1024x768x4) bytes of memory, roughly three megabytes.

    In addition, there are several processes happening concurrently if you create the Image directly after the snapshot has been taken:

    - The phone's native camera application has been invoked and loaded in memory.
    - The native camera has captured the 1024x768 RGBA image, allocating to itself the needed 3145728 bytes.
    - The native camera application has compressed this data into a JPEG image byte stream. This array of JPEG bytes is naturally smaller than 3145728 bytes, but rather large anyways.
    - This JPEG image data array is passed on to your MIDlet as the return value of the VideoControl.getSnapshot() method.
    - In your Java code, you call the Image.createImage() passing on the received array of JPEG bytes as a method parameter.
    - The Image.createImage() method decodes the JPEG image data back to a 1024x768 RGBA image bitmap, allocating a new 3145728 bytes.


    As you see, there are several large memory allocations happening at the same time. According to http://3lib.ukonline.co.uk/s60history.htm the N95 has only 20 MB of free RAM for applications after the operating system has loaded. And this amount of memory is not fully available to Java MIDlets, since when running MIDlets the Java VM needs to be loaded in memory, too.

    You stated already that you have no applications running in the background. Try running your image capture MIDlet just after you have re-started your phone, that might help too. And try to optimize your MIDlet so that no other large objects are allocated, to save memory. Perhaps capturing the image will be successful then?
    Last edited by knorring; 2007-05-30 at 01:32. Reason: typo

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    13

    Re: jsr135 highest supported camera resolutions for getSnapShot() on N95

    Hi,

    Thanks for your comments & suggestions. I think the N95 is running out of memory when trying to capture images of 1024x768 or higher, but it is not giving any useful messages, sometimes with 'unhandled exception' in Image.createImage() calls despite having try catch blocks (!) and sometimes symbian os error: -4 (whatever that is...)

    Based on your optimization suggestion, I modified the sample application I've been using ( 'MainMidlet' by JDoe, see my thread about jsr234 ) to 'deallocate' memory prior to attempting to display the image object from the snapshot - ( setting Videocontrol to null and stopping and closing the Player ). This worked OK for 1024x768. I was also able to get 1280x960 to capture a snapshot and write it to the filesystem, but could not display the image with usual 'unhandled exception' error. This is not repeatable unless I reboot the phone between each execution otherwise I get symbian os: -4 errors.

    However 1024x768 is repeatable without having to keep rebooting.

    I also installed a trail version of Best TaskMan version 1.01 from -

    http://www.smartphoneware.com/produc...askman60_3.php

    This was useful to see what memory is allocated when using the MainMidlet, I found -

    After reboot - 18.18 to 20.25mb free

    After load MainMidlet & display videocontrol preview - 10mb free - with MainMidlet using 2.36mb

    After snaphot & display image (1024x768) 11.7mb free.

    Anyway I'm pleased to finally get 1024x768 working ok, thanks for your help.

    Regards

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    62

    Re: jsr135 highest supported camera resolutions for getSnapShot() on N95

    Quote Originally Posted by garyjamessilva
    I think the N95 is running out of memory when trying to capture images of 1024x768 or higher, but it is not giving any useful messages, sometimes with 'unhandled exception' in Image.createImage() calls despite having try catch blocks (!) and sometimes symbian os error: -4 (whatever that is...)
    Heh. Looking at http://www.newlc.com/Symbian-OS-Error-Codes.html we can see that -4 is the Symbian OS error code KErrNoMemory, with description "Not enough memory".

    Quote Originally Posted by garyjamessilva
    After load MainMidlet & display videocontrol preview - 10mb free - with MainMidlet using 2.36mb

    After snaphot & display image (1024x768) 11.7mb free.
    Yes, but I believe that between the VideoControl preview with 10 MB free and after snapshot with 11.7 MB free the amount of memory has been very low for a short period of time. You need to remember that the 3 MB native camera bitmap + compressed JPEG data array + 3 MB Java Image object bitmap are allocated from this available 10 MB.

    Quote Originally Posted by garyjamessilva
    Anyway I'm pleased to finally get 1024x768 working ok, thanks for your help.
    No problem. Trying to solve J2ME problems is always fun.

Similar Threads

  1. Nokia N-Series Complete Model Line-Up
    By Dopod in forum General Development Questions
    Replies: 6
    Last Post: 2008-07-22, 20:16
  2. jsr234 camera getSnapShot() on Nokia N95
    By garyjamessilva in forum Mobile Java Media (Graphics & Sounds)
    Replies: 21
    Last Post: 2008-07-02, 15:14
  3. Problem enumerating camera sizes on N95
    By rvogt in forum Symbian Media (Closed)
    Replies: 10
    Last Post: 2007-11-29, 22:53
  4. Camera API on Symbian 9.1 (Nokia N80)
    By srigans1 in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2007-10-20, 05:31
  5. N95 browser supported issue
    By liting in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2007-04-27, 05:07

Posting Permissions

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