0

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!

brasofilo
  • 25,496
  • 15
  • 91
  • 179
Scott Vinay
  • 171
  • 1
  • 1
  • 6

1 Answers1

0

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

xamox
  • 2,599
  • 4
  • 27
  • 30