diff --git a/depthai_sdk/requirements.txt b/depthai_sdk/requirements.txt index 61240d643..f9e126ab5 100644 --- a/depthai_sdk/requirements.txt +++ b/depthai_sdk/requirements.txt @@ -1,7 +1,5 @@ -opencv-python==4.5.1.48 ; platform_machine != "aarch64" and platform_machine != "armv6l" and platform_machine != "armv7l" -opencv-contrib-python==4.5.1.48 ; platform_machine != "aarch64" and platform_machine != "armv6l" and platform_machine != "armv7l" -opencv-python==4.4.0.46 ; platform_machine == "armv6l" or platform_machine == "armv7l" -opencv-contrib-python==4.4.0.46 ; platform_machine == "armv6l" or platform_machine == "armv7l" -blobconverter==1.2.2 -pytube==11.0.1 -depthai +opencv-python>4 +opencv-contrib-python>4 +blobconverter>=1.2.2 +pytube>=11.0.1 +depthai>2 diff --git a/depthai_sdk/setup.py b/depthai_sdk/setup.py index 9bd1d6c71..c3e8e45c0 100644 --- a/depthai_sdk/setup.py +++ b/depthai_sdk/setup.py @@ -7,7 +7,7 @@ setup( name='depthai-sdk', - version='1.1.1', + version='1.1.2', description='This package contains convenience classes and functions that help in most common tasks while using DepthAI API', long_description=io.open("README.md", encoding="utf-8").read(), long_description_content_type="text/markdown", diff --git a/depthai_sdk/src/depthai_sdk/fps.py b/depthai_sdk/src/depthai_sdk/fps.py index 83a53121b..37469dc42 100644 --- a/depthai_sdk/src/depthai_sdk/fps.py +++ b/depthai_sdk/src/depthai_sdk/fps.py @@ -1,6 +1,7 @@ import collections import time import cv2 +import warnings class FPSHandler: @@ -15,10 +16,11 @@ class FPSHandler: _fpsType = cv2.FONT_HERSHEY_SIMPLEX _fpsLineType = cv2.LINE_AA - def __init__(self, cap=None): + def __init__(self, cap=None, maxTicks = 100): """ Args: - cap (cv2.VideoCapture): handler to the video file object + cap (cv2.VideoCapture, Optional): handler to the video file object + maxTicks (int, Optional): maximum ticks amount for FPS calculation """ self._timestamp = None self._start = None @@ -28,6 +30,11 @@ def __init__(self, cap=None): self._iterCnt = 0 self._ticks = {} + if maxTicks < 2: + raise ValueError(f"Proviced maxTicks value must be 2 or higher (supplied: {maxTicks})") + + self._maxTicks = maxTicks + def nextIter(self): """ Marks the next iteration of the processing loop. Will use :obj:`time.sleep` method if initialized with video file @@ -52,7 +59,7 @@ def tick(self, name): name (str): Specifies timestamp name """ if name not in self._ticks: - self._ticks[name] = collections.deque(maxlen=100) + self._ticks[name] = collections.deque(maxlen=self._maxTicks) self._ticks[name].append(time.monotonic()) def tickFps(self, name): diff --git a/requirements.txt b/requirements.txt index fca990d9c..2ac6f7f61 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,7 @@ argcomplete==1.12.1 -e ./depthai_sdk --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/ depthai==2.10.0.0.dev+7a0749a61597c086c5fd6e579618ae33accec8df +opencv-python==4.5.1.48 ; platform_machine != "aarch64" and platform_machine != "armv6l" and platform_machine != "armv7l" +opencv-contrib-python==4.5.1.48 ; platform_machine != "aarch64" and platform_machine != "armv6l" and platform_machine != "armv7l" +opencv-python==4.4.0.46 ; platform_machine == "armv6l" or platform_machine == "armv7l" +opencv-contrib-python==4.4.0.46 ; platform_machine == "armv6l" or platform_machine == "armv7l" \ No newline at end of file