×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Oct 2004
    Posts
    158

    Accessing the camera twice in a row

    I'm using a viewfinder in my app, but somehow I can't run the script twice in a row. I have to restart python to be able to run the script again. This obviously has to do with releasing resources, such as the camera, but it's not clear to me where the error is. It may be with 'camera._my_camera = _camera.Camera()' and setting it to None again....

    Code:
    def startViewfinder(self):
        self.take_photo_now = False
        self.viewFinderRunning = 1
        appuifw.app.exit_key_handler = self.quitViewFinder
        import _camera
        camera._my_camera = _camera.Camera()
        while self.viewFinderRunning:
            if self.take_photo_now:
                pic = camera.take_photo(size=self.pictureSize,exposure=self.exposure)
                self.pictureRecorded = True
                self.take_photo_now = False
                self.viewFinderRunning = 0
            else:
                self.image = camera.take_photo(size = (160,120))
                canvas.blit(self.image,target=(8,12,168,132),scale=0)
        camera._my_camera = None

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Re: Accessing the camera twice in a row

    Hi,

    The reason for this might be that freeing the camera resource (actual camera head) might take some time. So keeping the camera reserved for whole time while app is running is one option.

    Br,

    -sami

Similar Threads

  1. Accessing camera app's images
    By dav_coleman in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2005-08-11, 11:16
  2. Extreme Problems accessing the Camera by an Midlet on the NOKIA 6230
    By n3po in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-01-24, 09:36
  3. Replies: 1
    Last Post: 2005-01-13, 21:01
  4. Exception while accessing Camera on 6230
    By n3po in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-12-14, 10:11
  5. Accessing camera on 7250
    By anilmvs in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2003-08-15, 23: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
  •  
×