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: