Remove patch file

pull/1172/head
Piero Toffanin 2020-10-28 14:17:50 -04:00
rodzic 76cd655eec
commit eb2d85ea44
1 zmienionych plików z 0 dodań i 47 usunięć

Wyświetl plik

@ -1,47 +0,0 @@
diff --git a/opensfm/context.py b/opensfm/context.py
index a01dd700..f54fcf87 100644
--- a/opensfm/context.py
+++ b/opensfm/context.py
@@ -17,6 +17,9 @@ BOW_PATH = os.path.join(abspath, 'data', 'bow')
# Handle different OpenCV versions
+OPENCV5 = int(cv2.__version__.split('.')[0]) >= 5 #future proofing SIFT support test (see features.py)
+OPENCV4 = int(cv2.__version__.split('.')[0]) >= 4
+OPENCV44 = int(cv2.__version__.split('.')[0]) == 4 and int(cv2.__version__.split('.')[1]) >= 4 # for SIFT support (see features.py)
OPENCV3 = int(cv2.__version__.split('.')[0]) >= 3
if hasattr(cv2, 'flann_Index'):
diff --git a/opensfm/features.py b/opensfm/features.py
index 3e80224b..78e51ce5 100644
--- a/opensfm/features.py
+++ b/opensfm/features.py
@@ -87,7 +87,13 @@ def _in_mask(point, width, height, mask):
def extract_features_sift(image, config):
sift_edge_threshold = config['sift_edge_threshold']
sift_peak_threshold = float(config['sift_peak_threshold'])
- if context.OPENCV3:
+ # SIFT support is in cv2 main from version 4.4.0
+ if context.OPENCV44 or context.OPENCV5:
+ detector = cv2.SIFT_create(
+ edgeThreshold=sift_edge_threshold,
+ contrastThreshold=sift_peak_threshold)
+ descriptor = detector
+ elif context.OPENCV3:
try:
detector = cv2.xfeatures2d.SIFT_create(
edgeThreshold=sift_edge_threshold,
@@ -105,7 +110,12 @@ def extract_features_sift(image, config):
while True:
logger.debug('Computing sift with threshold {0}'.format(sift_peak_threshold))
t = time.time()
- if context.OPENCV3:
+ # SIFT support is in cv2 main from version 4.4.0
+ if context.OPENCV44 or context.OPENCV5:
+ detector = cv2.SIFT_create(
+ edgeThreshold=sift_edge_threshold,
+ contrastThreshold=sift_peak_threshold)
+ elif context.OPENCV3:
detector = cv2.xfeatures2d.SIFT_create(
edgeThreshold=sift_edge_threshold,
contrastThreshold=sift_peak_threshold)