From 67405a9de1f50a1ae2d05485af7ca9a365029035 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Mon, 13 Mar 2023 15:58:03 +0100 Subject: Updating library to work with Python 3.11 and OpenCV 4.7. --- setup.py | 4 ++-- src/argaze/ArUcoMarkers/ArUcoCamera.py | 6 +++--- src/argaze/ArUcoMarkers/ArUcoDetector.py | 2 +- src/argaze/ArUcoMarkers/ArUcoMarker.py | 8 ++++---- src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py | 2 +- src/argaze/ArUcoMarkers/ArUcoScene.py | 4 ++-- src/argaze/AreaOfInterest/AOIFeatures.py | 2 +- src/argaze/TobiiGlassesPro2/TobiiData.py | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/setup.py b/setup.py index e7ac240..01072f9 100644 --- a/setup.py +++ b/setup.py @@ -34,8 +34,8 @@ setup( package_dir={'':'src'}, packages=find_packages(where='src'), - python_requires='>=3.6, <4', - install_requires=['opencv-python==4.6.0.66', 'opencv-contrib-python==4.6.0.66', 'numpy', 'av', 'rtsp', 'netifaces', 'pandas', 'matplotlib', 'shapely'], + python_requires='>=3.11', + install_requires=['opencv-python>=4.7.0', 'opencv-contrib-python>=4.7.0', 'numpy', 'av', 'rtsp', 'netifaces', 'pandas', 'matplotlib', 'shapely', 'scipy'], project_urls={ 'Bug Reports': 'https://git.recherche.enac.fr/projects/argaze/issues', diff --git a/src/argaze/ArUcoMarkers/ArUcoCamera.py b/src/argaze/ArUcoMarkers/ArUcoCamera.py index 4ed8f9f..b2e4614 100644 --- a/src/argaze/ArUcoMarkers/ArUcoCamera.py +++ b/src/argaze/ArUcoMarkers/ArUcoCamera.py @@ -19,13 +19,13 @@ class CalibrationData(): rms: float = field(default=0) """Root Mean Square error of calibration.""" - dimensions: numpy.ndarray = field(default=numpy.array([0, 0])) + dimensions: numpy.array = field(default_factory=numpy.array([0, 0])) """Frame dimensions in pixels from which the calibration have been done.""" - K: numpy.ndarray = field(default=K0) + K: numpy.array = field(default_factory=K0) """Intrinsic parameters matrix (focal lengths and principal point).""" - D: numpy.ndarray = field(default=D0) + D: numpy.array = field(default_factory=D0) """Distorsion coefficients vector.""" @classmethod diff --git a/src/argaze/ArUcoMarkers/ArUcoDetector.py b/src/argaze/ArUcoMarkers/ArUcoDetector.py index 53f56ff..0ce1753 100644 --- a/src/argaze/ArUcoMarkers/ArUcoDetector.py +++ b/src/argaze/ArUcoMarkers/ArUcoDetector.py @@ -32,7 +32,7 @@ class DetectorParameters(): .. note:: More details on [opencv page](https://docs.opencv.org/4.x/d1/dcd/structcv_1_1aruco_1_1DetectorParameters.html) """ - __parameters = aruco.DetectorParameters_create() + __parameters = aruco.DetectorParameters() __parameters_names = [ 'adaptiveThreshConstant', 'adaptiveThreshWinSizeMax', diff --git a/src/argaze/ArUcoMarkers/ArUcoMarker.py b/src/argaze/ArUcoMarkers/ArUcoMarker.py index 62da2ca..df82523 100644 --- a/src/argaze/ArUcoMarkers/ArUcoMarker.py +++ b/src/argaze/ArUcoMarkers/ArUcoMarker.py @@ -21,16 +21,16 @@ class ArUcoMarker(): size: float """Size of marker in centimeters.""" - corners: numpy.ndarray = field(init=False, repr=False) + corners: numpy.array = field(init=False, repr=False) """Estimated 2D corner positions in camera image referential.""" - translation: numpy.ndarray = field(init=False, repr=False) + translation: numpy.array = field(init=False, repr=False) """Estimated 3D center position in camera world referential.""" - rotation: numpy.ndarray = field(init=False, repr=False) + rotation: numpy.array = field(init=False, repr=False) """Estimated 3D marker rotation in camera world referential.""" - points: numpy.ndarray = field(init=False, repr=False) + points: numpy.array = field(init=False, repr=False) """Estimated 3D corners positions in camera world referential.""" @property diff --git a/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py b/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py index 4f87881..9be895b 100644 --- a/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py +++ b/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py @@ -84,7 +84,7 @@ class ArUcoMarkersDictionary(): self.__number = int(dict_name_split[2]) - self.__aruco_dict = aruco.Dictionary_get(all_aruco_markers_dictionaries[self.__name]) + self.__aruco_dict = aruco.getPredefinedDictionary(all_aruco_markers_dictionaries[self.__name]) @property def name(self)-> str: diff --git a/src/argaze/ArUcoMarkers/ArUcoScene.py b/src/argaze/ArUcoMarkers/ArUcoScene.py index 47e30df..63aa136 100644 --- a/src/argaze/ArUcoMarkers/ArUcoScene.py +++ b/src/argaze/ArUcoMarkers/ArUcoScene.py @@ -26,10 +26,10 @@ ArUcoSceneType = TypeVar('ArUcoScene', bound="ArUcoScene") class Place(): """Define a place as a pose and a marker.""" - translation: numpy.ndarray + translation: numpy.array """Position in scene referential.""" - rotation: numpy.ndarray + rotation: numpy.array """Rotation in scene referential.""" marker: dict diff --git a/src/argaze/AreaOfInterest/AOIFeatures.py b/src/argaze/AreaOfInterest/AOIFeatures.py index c1df8f1..583c755 100644 --- a/src/argaze/AreaOfInterest/AOIFeatures.py +++ b/src/argaze/AreaOfInterest/AOIFeatures.py @@ -17,7 +17,7 @@ AreaOfInterestType = TypeVar('AreaOfInterest', bound="AreaOfInterest") class AreaOfInterest(numpy.ndarray): """Define Area Of Interest as an array of points of any dimension.""" - def __new__(cls, points: numpy.ndarray = numpy.empty(0)) -> AreaOfInterestType: + def __new__(cls, points: numpy.array = numpy.empty(0)) -> AreaOfInterestType: """View casting inheritance.""" return numpy.array(points).view(AreaOfInterest) diff --git a/src/argaze/TobiiGlassesPro2/TobiiData.py b/src/argaze/TobiiGlassesPro2/TobiiData.py index 87af44a..0e28054 100644 --- a/src/argaze/TobiiGlassesPro2/TobiiData.py +++ b/src/argaze/TobiiGlassesPro2/TobiiData.py @@ -62,14 +62,14 @@ class Event(): class Accelerometer(): """Define accelerometer data (ac).""" - value: numpy.ndarray + value: numpy.array """Accelerometer value""" @dataclass class Gyroscope(): """Define gyroscope data (gy).""" - value: numpy.ndarray + value: numpy.array """Gyroscope value""" @dataclass -- cgit v1.1