(self, max_framerate=30.0, webcam_idx=0)
Read images from web camera.
        Argument:
            max_framerate {float}: the real framerate will be reduced below this value.
            webcam_idx {int}: index of the web camera on your laptop. It should be 0 by default.
Read images from web camera.
        Argument:
            max_framerate {float}: the real framerate will be reduced below this value.
            webcam_idx {int}: index of the web camera on your laptop. It should be 0 by default.
Read images from web camera . Argument : max_framerate { float } : the real framerate will be reduced below this value . webcam_idx { int } : index of the web camera on your laptop . It should be 0 by default .
def __init__(self, max_framerate=30.0, webcam_idx=0):
        ''' Read images from web camera.
        Argument:
            max_framerate {float}: the real framerate will be reduced below this value.
            webcam_idx {int}: index of the web camera on your laptop. It should be 0 by default.
        '''
        # Settings
        self._max_framerate = max_framerate
        queue_size = 3

        # Initialize video reader
        self._video = cv2.VideoCapture(webcam_idx)
        self._is_stoped = False

        # Use a thread to keep on reading images from web camera
        self._imgs_queue = queue.Queue(maxsize=queue_size)
        self._is_thread_alive = multiprocessing.Value('i', 1)
        self._thread = threading.Thread(
            target=self._thread_reading_webcam_images)
        self._thread.start()

        # Manually control the framerate of the webcam by sleeping
        self._min_dt = 1.0 / self._max_framerate
        self._prev_t = time.time() - 1.0 / max_framerate
def __init__ ( self , max_framerate = 30.0 , webcam_idx = 0 ) : # Settings self . _max_framerate = max_framerate queue_size = 3 # Initialize video reader self . _video = cv2 . VideoCapture ( webcam_idx ) self . _is_stoped = False # Use a thread to keep on reading images from web camera self . _imgs_queue = queue . Queue ( maxsize = queue_size ) self . _is_thread_alive = multiprocessing . Value ( 'i' , 1 ) self . _thread = threading . Thread ( target = self . _thread_reading_webcam_images ) self . _thread . start ( ) # Manually control the framerate of the webcam by sleeping self . _min_dt = 1.0 / self . _max_framerate self . _prev_t = time . time ( ) - 1.0 / max_framerate