Modified:
trunk/kamera/opencvwidget.py
Log:
proper timeout selection
Modified: trunk/kamera/opencvwidget.py
==============================================================================
--- trunk/kamera/opencvwidget.py (original)
+++ trunk/kamera/opencvwidget.py Thu Nov 27 22:24:24 2008
@@ -23,8 +23,14 @@
class CamThread(QtCore.QThread):
def run(self):
camera = highgui.cvCreateCameraCapture(0)
+ timeout = highgui.cvGetCaptureProperty(camera,
highgui.CV_CAP_PROP_FPS)
+ #30 fps if cam gives no value
+ if not timeout > 0:
+ timeout = 33
+ else:
+ timeout = 1000 / timeout
while True:
- self.msleep(30)
+ self.msleep(timeout)
self.cvimage = highgui.cvQueryFrame(camera)
self.emit(QtCore.SIGNAL("image"), (self.cvimage))