Skip to content

Commit

Permalink
max fps update
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Canas committed Jul 11, 2023
1 parent c061944 commit 4760b93
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='webcam',
version='1.10',
version='1.13',
author='Eric-Canas',
author_email='[email protected]',
url='https://github.com/Eric-Canas/webcam',
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion webcam/webcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4760b93

Please sign in to comment.