The Behavior of the cv2.ORB algorithm changes from version 4.1.2.30 to 4.2.0.32
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 5.4k
- Forks
- 1k
- Ø Merge
- 22 Std. 17 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
Expected behaviour
I use the ORB image registration algorithm and it worked until 4.1.2.30. Same solution on same data!
Actual behaviour
From Version 4.1.2.32 to newest (4.5.1.48) it has a different (wrong) solution on the same data AND it needs about 3 times more time.
Steps to reproduce
def alignImages(im, imRef):
MAX_FEATURES = 1000
GOOD_MATCH_PERCENT = 0.5
# Detect ORB features and compute descriptors.
orb = cv2.ORB_create(MAX_FEATURES, scaleFactor=2, WTA_K=4, scoreType=cv2.ORB_HARRIS_SCORE, patchSize=61)
keypoints1, descriptors1 = orb.detectAndCompute(im, None)
keypoints2, descriptors2 = orb.detectAndCompute(imRef, None)
#print('after kp2: ', time.time() - t)
print('len keypoints:', len(keypoints1), ' ',len(keypoints2))
# Match features.
matcher = cv2.DescriptorMatcher_create(cv2.DESCRIPTOR_MATCHER_BRUTEFORCE_HAMMING)
matches = matcher.match(descriptors1, descriptors2, None)
#print('after matcher: ', time.time() - t)
# Sort matches by score
matches.sort(key=lambda x: x.distance, reverse=False)
# Remove not so good matches
numGoodMatches = int(len(matches) * GOOD_MATCH_PERCENT)
matches = matches[:numGoodMatches]
# Extract location of good matches
points1 = np.zeros((len(matches), 2), dtype=np.float32)
points2 = np.zeros((len(matches), 2), dtype=np.float32)
for i, match in enumerate(matches):
points1[i, :] = keypoints1[match.queryIdx].pt
points2[i, :] = keypoints2[match.trainIdx].pt
# Find homography
h, mask = cv2.findHomography(points1, points2, cv2.RANSAC)
return h
- operating system: WIN 10 64-bit
Issue submission checklist
sorry, i don't know if it is a opencv-python issue or a opencv issue.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem Inline-Reproducer für alignImages und führen Sie ihn mit den aufgeführten OpenCV-Python-Versionen unter Windows 10 und identischen Eingabebildern aus. Vergleichen Sie ORB-Keypoints, Matches, Homografie und Laufzeit, um festzustellen, ob die Regression im Python-Paket oder im OpenCV-Kern liegt. Als erledigt gilt die Aufgabe, wenn die Regression erklärt und behoben ist oder das Issue mit einem minimal reproduzierbaren Fall an das zuständige Projekt weitergeleitet wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- opencv, python
- Bereich
- computer-vision
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100