diff --git a/calango/__init__.py b/calango/__init__.py index c3a802a..2a7500d 100644 --- a/calango/__init__.py +++ b/calango/__init__.py @@ -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) diff --git a/calango/media.py b/calango/media.py index 45fbb34..9ad54d2 100644 --- a/calango/media.py +++ b/calango/media.py @@ -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) @@ -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