Esempio n. 1
0
 def main(self):
     """
     Run and time the main loop.
     """
     logging.info("Starting main video capture loop now, press 'q' to quit")
     key = hg.cvWaitKey(1)
     
     num_frames = 0
     start_time = time.time()
     
     while(key is not "q" and key != '\x1b'):
         num_frames +=1
         self.process()
         key = hg.cvWaitKey(5)
         
     total_time = float(time.time()) - float(start_time)
     
     hg.cvDestroyWindow(self.title)
     cv.cvReleaseCapture(self.camera)
     
     logging.debug("Main loop complete")
     logging.debug("Total time took %e" % total_time)
     
     logging.info("Average time per frame: %e" % (total_time/num_frames) )
     logging.info("Average frames per second: %f" % (num_frames/total_time) )
    def main(self):
        """
        Run and time the main loop.
        """
        logging.info("Starting main video capture loop now, press 'q' to quit")
        key = hg.cvWaitKey(1)

        num_frames = 0
        start_time = time.time()

        while (key is not "q" and key != '\x1b'):
            num_frames += 1
            self.process()
            key = hg.cvWaitKey(5)

        total_time = float(time.time()) - float(start_time)

        hg.cvDestroyWindow(self.title)
        cv.cvReleaseCapture(self.camera)

        logging.debug("Main loop complete")
        logging.debug("Total time took %e" % total_time)

        logging.info("Average time per frame: %e" % (total_time / num_frames))
        logging.info("Average frames per second: %f" %
                     (num_frames / total_time))
Esempio n. 3
0
	def stop_capture(self):
                if self.capture:
                        cv.cvReleaseCapture( self.capture )

		self.capture = None