how are detect() and compute() different from detectAndCompute()

Viewed 401

I want to make some real time image comparison. FAST seems to perform well, but for matching purposes I have difficulties getting the keypoints described correctly.

In my testing, I tried the following code:

import cv2


# initiate some stuff
detector = cv2.FastFeatureDetector_create(20)
orb = cv2.ORB_create(150)
bf = cv2.BFMatcher()

# detect and compute keypoints for imageA in separate steps
imageA = cv2.imread("imageA.png", 0)
kpA = detector.detect(imageA, None)
kpA_computed, desA = orb.compute(imageA, kpA)
drawAkp = cv2.drawKeypoints(imageA, kpA_computed, None, flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)

# detect and compute keypoints for imageB in 1 step
imageB = cv2.imread("imageB.png", 0)
kpB_computed, desB = orb.detectAndCompute(imageB, None)
drawBkp = cv2.drawKeypoints(imageB, kpB_computed, None, flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)

# these shouldn't be that different from one another
cv2.imshow("A", drawAkp)
cv2.imshow("B", drawBkp)

cv2.waitKey(0)

For some reason, the keypoints in imageA are not "rich" at all. drawAkp and drawBkp side to side

I understand that the 2 images are using different algorithms for the keypoints detection, but I expected that imageA will have the sizes and orientations included after the compute() I think understanding the reason behind that will help me with my matching problems.

0 Answers
Related