Ask Your Question

getimage has stale frames

asked 2013-03-15 21:16:11 -0500

kalefler gravatar image

I have a very simple program:

cam = Camera(prop_set={'width': 320, 'height': 240})

while True:

img = cam.getImage()

I get 1 or 2 fresh images and then the display is frozen, with no new images The SimpleCV getImage() documentation states "if you experience problems with stale frames from the camera’s hardware buffer, increase the flushcache number to dequeue multiple frames before retrieval". I can't find anywhere how to do this.

Any ideas?

edit retag flag offensive close merge delete


You may also want to try it without threading. Camera(threaded=False). It is set to true by default but it seems the RaspberryPi does better with it disabled.

xamox gravatar imagexamox ( 2013-03-18 09:11:44 -0500 )edit

Thanks for the suggestion.I tried it, but it still get the same error (see comment in answer below)

kalefler gravatar imagekalefler ( 2013-03-19 10:17:00 -0500 )edit

3 Answers

Sort by » oldest newest most voted

answered 2013-03-16 16:43:30 -0500

kalefler gravatar image

updated 2013-03-17 14:52:07 -0500

Thanks for the response. Yes, I had that originally. Using the display object has the same problem.

The Logitech webcam (no model number on camera) is connected to a raspberry pi. The camera used to capture fine. I've now realized this problem started after I upgraded from the 2012-12-16-wheezy-raspbian.img to the 2013-02-09 image. I'll re-image my disk back to the 12-16 image and see if it works again.

OK, I re-imaged my disk back to 2012-12-16 and it works fine. Maybe there is some driver incompatibility between my webcam and the 02-09 image.

edit flag offensive delete link more


Aha! The truth comes out! It would have been helpful from the start to tell us you were using a RaspberryPi. We're still kicking the tires on the Pi. A Logitech should work but you will probably want to plug it into a powered USB hub. We're working hard to get things running better on the Pi.

kscottz gravatar imagekscottz ( 2013-03-17 18:22:30 -0500 )edit

Here is more information after more testing. The program works with the 2012-12-16 image, but only for 10's of seconds. Running under idle, it just stops and the Restart line appears. Running it under the python interpreter it stops with the message "... (pygame parachute) Segmentation Fault"

kalefler gravatar imagekalefler ( 2013-03-19 10:12:04 -0500 )edit

It maybe a Pygame bug. Sorry about that. Getting pygame on raspberrypi has been a bit of a pain. Can you do'browser'). This will render to your webbrowser instead and may be a temporary work around.

xamox gravatar imagexamox ( 2013-03-19 11:21:08 -0500 )edit

from SimpleCV import Camera cam = Camera(prop_set={'width': 320, 'height': 240}, threaded=False) curImage = cam.getImage()"browser") - still gets segmenatation fault

kalefler gravatar imagekalefler ( 2013-03-19 11:42:40 -0500 )edit

Are you running from the shell? Does it happen when you run .show()? You could try and find out exactly by running and posting the output.txt to a gist ( for me to look at:

strace -f -o output.txt python

xamox gravatar imagexamox ( 2013-03-19 21:02:00 -0500 )edit

answered 2013-03-16 16:11:02 -0500

pap-x gravatar image

I would suggest try using the display object. Try this code:

from SimpleCV import *
cam = Camera()
disp = Display()

while disp.isNotDone():
        img = cam.getImage()
edit flag offensive delete link more

answered 2013-03-16 16:48:56 -0500

kscottz gravatar image

Can you tell us a bit more about your hardware? What platform/OS/camera model? Does it work when you don't pass the camera a property set? Camera properties are highly hardware dependent, so setting the camera properties could be part of your properties.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-03-15 21:16:11 -0500

Seen: 617 times

Last updated: Mar 17 '13