diff --git a/resources/usage_examples/limited_frame_rate/12_fps.gif b/resources/usage_examples/limited_frame_rate/12_fps.gif new file mode 100644 index 0000000..5ed04d4 Binary files /dev/null and b/resources/usage_examples/limited_frame_rate/12_fps.gif differ diff --git a/resources/usage_examples/limited_frame_rate/5_fps.gif b/resources/usage_examples/limited_frame_rate/5_fps.gif new file mode 100644 index 0000000..df74ca3 Binary files /dev/null and b/resources/usage_examples/limited_frame_rate/5_fps.gif differ diff --git a/setup.py b/setup.py index 600a57f..f9f37a5 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='webcam', - version='1.10', + version='1.13', author='Eric-Canas', author_email='eric@ericcanas.com', url='https://github.com/Eric-Canas/webcam', @@ -12,7 +12,7 @@ long_description_content_type='text/markdown', license='MIT', packages=find_packages(), - python_requires='>=3.6', + python_requires='>=3.7', install_requires=[ 'numpy', 'opencv-python', diff --git a/webcam/webcam.py b/webcam/webcam.py index 788bbab..3a37368 100644 --- a/webcam/webcam.py +++ b/webcam/webcam.py @@ -147,7 +147,7 @@ def read_next_frame(self) -> np.ndarray: if self.max_frame_rate is not None: # Sleep to simulate the frame rate (0.8 is a magic number, just to compensate the execution resuming time) - time.sleep(max(0, (1/self.max_frame_rate)*0.8 - (time.time() - self.last_frame_timestamp))) + time.sleep(max(0, (1/self.max_frame_rate)*0.9 - (time.time() - self.last_frame_timestamp))) self.last_frame_timestamp = time.time() return frames[0] if self.batch_size is None else np.stack(frames, axis=0)