×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    3

    Unhappy Problems taking pictures with the camera using gstreamer (on nokia N810)

    Hi

    Using the camera example for python here I added
    actual code to the buffer callback to actually save a picture, like so:

    Code:
    def buffer_cb(self, element, buffer, pad):
            if self.picture_taken:
                self.picture_taken = False
                print "picture taken"
                image = Image.fromstring("P", (640,480), buffer)
                image = image.convert("RGB")
                image.save("picture.jpg")
                
            return True
    The problem is that the picture turns out in grayscale. If I set the mode for the fromstring method to "RGB" or "CMYK" it gives a "ValueError: not enough image data" error, and only the "P" mode seems to work. This seems odd as looking at the size of the buffer recieved (as a string) it is definately big enough for a colour image at 640*480. Does anyone have any clue what's going on?

    Thanks in advance
    Last edited by phil232fm; 2008-12-11 at 20:29. Reason: missed model in title

  2. #2
    Super Contributor
    Join Date
    May 2004
    Location
    Tampere, Finland
    Posts
    524

    Re: Problems taking pictures with the camera (on nokia N810)

    You may need to configure the raw decoder to match the input format (see the raw decoder documentation):

    Code:
    image = Image.fromstring("RGB", (640, 480), buffer, "raw", "RGB", 0)
    Experiment with the raw mode and stride parameters to get a correct image.

    By the way, this forum is mainly populated by people who use PyS60 (Python for S60 phones). Maemo-specific questions probably get more answers on maemo.org developer mailing list or internettablettalk.com (soon to be called talk.maemo.org) forums.

Similar Threads

  1. Cellphones challenge cameras with sharper pictures
    By jennyyu in forum General Development Questions
    Replies: 0
    Last Post: 2008-06-18, 09:23
  2. Disable camera
    By Asmodeusz in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2008-04-30, 10:02
  3. embedable camera application??
    By zhengyu97 in forum Symbian
    Replies: 0
    Last Post: 2005-04-22, 11:09
  4. 7710 MMAPI camera snapsot gives low res pictures
    By akmits in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-03-09, 22:31
  5. Compatibility problems with camera API on 6600
    By fredrik99 in forum Symbian
    Replies: 3
    Last Post: 2003-12-10, 03:35

Posting Permissions

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