change from on_frame to on_texture and .03 to 1/30

This commit is contained in:
akshayaurora 2011-11-17 00:13:16 +05:30
parent 428bbf56e5
commit 8fa70eb1e1
4 changed files with 7 additions and 7 deletions

View File

@ -57,7 +57,7 @@ class CameraBase(EventDispatcher):
super(CameraBase, self).__init__()
self.register_event_type('on_load')
self.register_event_type('on_frame')
self.register_event_type('on_texture')
self.init_camera()
@ -116,9 +116,9 @@ class CameraBase(EventDispatcher):
return
self._texture.blit_buffer(self._buffer, colorfmt=self._format)
self._buffer = None
self.dispatch('on_frame')
self.dispatch('on_texture')
def on_frame(self):
def on_texture(self):
pass
def on_load(self):

View File

@ -63,7 +63,7 @@ class CameraOpenCV(CameraBase):
#get fps
self.fps = cv.GetCaptureProperty(self._device, cv.CV_CAP_PROP_FPS)
if self.fps <= 0:
self.fps = .03
self.fps = 1/30
if not self.stopped:
self.start()

View File

@ -34,7 +34,7 @@ class CameraVideoCapture(CameraBase):
self._device.setResolution(self.resolution[0], self.resolution[1])
except:
raise Exception('VideoCapture: Resolution not supported')
self.fps = .03
self.fps = 1 / 30
def _update(self, dt):
data, camera_width, camera_height = self._device.getBuffer()

View File

@ -89,7 +89,7 @@ class Camera(Image):
resolution=self._on_index)
self._on_index()
def on_frame(self, *l):
def on_tex(self, *l):
self.canvas.ask_update()
def _on_index(self, *largs):
@ -101,7 +101,7 @@ class Camera(Image):
self._camera.bind(on_load=self._camera_loaded)
if self.play:
self._camera.start()
self._camera.bind(on_frame=self.on_frame)
self._camera.bind(on_texture=self.on_tex)
def _camera_loaded(self, *largs):
self.texture = self._camera.texture