Skip to content

Commit

Permalink
fix loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsneto committed Mar 14, 2023
1 parent 5509c75 commit 6f45ddb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion calango/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
from .devices import Mouse
from .media import Image, VideoWriter, Video

VERSION = "2.2.5.final.0"
VERSION = "2.2.6.final.0"
__version__ = get_version_pep440_compliant(VERSION)
5 changes: 4 additions & 1 deletion calango/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,9 @@ def __get_next_frame(self) -> Union[np.ndarray, Image, None]:
self._t0 = time.time()
self._fps_time = self._t0 # for fps on show
_, image = self._cap.next_frame
if image is None:
self.stop()
return None
image = self._frame_func_preprocess(Image(image))
if not isinstance(image, Image):
image = Image(image)
Expand Down Expand Up @@ -911,7 +914,7 @@ def get_batch_frames(self, kernel_size, strides=1, take_number_frame=False):

@property
def fps(self):
if self._th_show_running and not self._cap.is_webcam:
if self._th_show_running:
time_it = (time.time() - self._fps_time)
if time_it >= 1:
return self._count_frames / time_it
Expand Down

0 comments on commit 6f45ddb

Please sign in to comment.