From 171d4366a5ae5c70a0092654ed4bb6114f48ed48 Mon Sep 17 00:00:00 2001 From: Scott Monaghan Date: Tue, 23 Apr 2024 03:25:04 -0500 Subject: [PATCH] replace disutils with python3-semver (#970) Fix for - #969 I added a dependency for `python3-semver` to replace version parsing with `disutils`. Please let me know if you have any questions, concerns, or additional requested changes. --- camera_calibration/package.xml | 1 + camera_calibration/src/camera_calibration/calibrator.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/camera_calibration/package.xml b/camera_calibration/package.xml index 9bbea0e73..189154f7f 100644 --- a/camera_calibration/package.xml +++ b/camera_calibration/package.xml @@ -27,6 +27,7 @@ rclpy std_srvs sensor_msgs + python3-semver ament_copyright ament_flake8 diff --git a/camera_calibration/src/camera_calibration/calibrator.py b/camera_calibration/src/camera_calibration/calibrator.py index 1e3ef4d0b..ba0030e95 100644 --- a/camera_calibration/src/camera_calibration/calibrator.py +++ b/camera_calibration/src/camera_calibration/calibrator.py @@ -44,7 +44,7 @@ import sys import tarfile import time -from distutils.version import LooseVersion +from semver import VersionInfo from enum import Enum # Supported camera models @@ -1145,7 +1145,7 @@ def cal_fromcorners(self, good): if self.camera_model == CAMERA_MODEL.PINHOLE: print("stereo pinhole calibration...") - if LooseVersion(cv2.__version__).version[0] == 2: + if VersionInfo.parse(cv2.__version__).major < 3: cv2.stereoCalibrate(opts, lipts, ripts, self.size, self.l.intrinsics, self.l.distortion, self.r.intrinsics, self.r.distortion, @@ -1164,7 +1164,7 @@ def cal_fromcorners(self, good): flags = flags) elif self.camera_model == CAMERA_MODEL.FISHEYE: print("stereo fisheye calibration...") - if LooseVersion(cv2.__version__).version[0] == 2: + if VersionInfo.parse(cv2.__version__).major < 3: print("ERROR: You need OpenCV >3 to use fisheye camera model") sys.exit() else: