I am using SimpleCV with Python to detect a set of circles on a piece of paper. At first I used code similar to:
cam = SimpleCV.Camera()
img = cam.getImage()
(process the image)
This processed the image very slowly. I then tried taking and saving the image separately, then loading it into my program like this:
img = SimpleCV.Image("image.jpg")
(process the image)
For some reason the image processing here is much faster (perhaps 3 or 4 times faster). I don't understand why this is? Surely once the image has been acquired it doesn't matter whether it came from the camera or a file? Or is the camera still running something in the background that is taking up resources?
I have tried using commands such as del cam
to remove the variable, and I've even tried:
cam = SimpleCV.Camera()
img = cam.getImage()
img.save("image.jpg")
img = SimpleCV.Image("image.jpg")
(process the image)
but this wasn't any faster. It just seems that if the line SimpleCV.Camera()
is anywhere in my program, the whole thing is slowed down massively!
I would verify with the following via the SimpleCV shell that is the camera:
> cam = Camera()
> %timeit cam.getImage()
> %timeit Image('blah.png')
This should give you a good idea of the time difference
I am using SimpleCV with Python to detect a set of circles on a piece of paper. At first I used code similar to:
cam = SimpleCV.Camera()
img = cam.getImage()
(process the image)
This processed the image very slowly. I then tried taking and saving the image separately, then loading it into my program like this:
img = SimpleCV.Image("image.jpg")
(process the image)
For some reason the image processing here is much faster (perhaps 3 or 4 times faster). I don't understand why this is? Surely once the image has been acquired it doesn't matter whether it came from the camera or a file? Or is the camera still running something in the background that is taking up resources?
I have tried using commands such as del cam
to remove the variable, and I've even tried:
cam = SimpleCV.Camera()
img = cam.getImage()
img.save("image.jpg")
img = SimpleCV.Image("image.jpg")
(process the image)
but this wasn't any faster. It just seems that if the line SimpleCV.Camera()
is anywhere in my program, the whole thing is slowed down massively!
I would verify with the following via the SimpleCV shell that is the camera:
> cam = Camera()
> %timeit cam.getImage()
> %timeit Image('blah.png')
This should give you a good idea of the time difference
0 commentaires:
Enregistrer un commentaire