0

I am getting the following error when I run the code below:

Error: Camera instance has no attribute 'release'

from SimpleCV import *
import time
def camera(self):
    try:
        cam=Camera(0)
                while cam is not None:
                    try:
                        img = cam.getImage()
                        img.show()
                        time.sleep(0.1)
                    except Exception as e:
                        print(e)
    except Exception as e:
        print(e)
    finally:
        cam.release()
        del cam

Any suggestions how to correct it?

2 Answers2

0

First of all, looking at the documentation/source, it doesn't look like release() is an attribute (i.e. a method) inside the class Camera of SimpleCV, (as the error suggests,) so you're trying to call something that doesn't exist. I would guess that you could omit the line cam.release() since del cam already calls the destructor __del__ which closes the camera for you.

Please correct me if I'm wrong. Documentation: https://github.com/sightmachine/SimpleCV/blob/master/SimpleCV/Camera.py

So just:

finally:
    del cam

PS: I would have just posted a comment but I'm a new user with no rep :)

Leo R
  • 16
  • 2
0

You cannot turn off the Camera using SimpleCv. To overcome this issue use OpenCV in that we can turn off the camera.