Skip to content

Commit

Permalink
Merge pull request #27 from blk-app/master
Browse files Browse the repository at this point in the history
Robust native version checker
  • Loading branch information
zsiki authored Jun 10, 2024
2 parents f7f4168 + b418c5a commit 86d7f7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion aruco_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
Simple application to generate ArUco markers of different dictionaries
"""
import argparse
import packaging.version
import cv2
from cv2 import aruco
import matplotlib.pyplot as plt

# handle incompatibility introduced in openCV 4.8
if cv2.__version__ < '4.7':
if packaging.version.parse(cv2.__version__) < packaging.version.parse('4.7'):
aruco.extendDictionary = aruco.Dictionary_create
aruco.getPredefinedDictionary = aruco.Dictionary_get
aruco.generateImageMarker = aruco.drawMarker
Expand Down
5 changes: 3 additions & 2 deletions gcp_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
import glob
import json
import argparse
import packaging.version
import numpy as np
from numpy.linalg import norm
import matplotlib.pyplot as plt
import cv2
from cv2 import aruco

# handle incompatibility introduced in openCV 4.8
if cv2.__version__ < '4.7':
if packaging.version.parse(cv2.__version__) < packaging.version.parse('4.7'):
aruco.extendDictionary = aruco.Dictionary_create
aruco.getPredefinedDictionary = aruco.Dictionary_get
aruco.DetectorParameters = aruco.DetectorParameters_create
Expand Down Expand Up @@ -182,7 +183,7 @@ def process_image(self, image_name):
else:
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# find markers
if cv2.__version__ < '4.8':
if packaging.version.parse(cv2.__version__) < packaging.version.parse('4.8'):
corners, ids, _ = aruco.detectMarkers(gray,
self.aruco_dict,
parameters=self.params)
Expand Down

0 comments on commit 86d7f7b

Please sign in to comment.