mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-11 12:43:04 +08:00
Save feature information in attributes for consistency
This commit is contained in:
@@ -37,13 +37,17 @@ keypoints3 = corner_peaks(corner_harris(img3), min_distance=5)
|
||||
|
||||
extractor = BRIEF()
|
||||
|
||||
descriptors1, mask1 = extractor.extract(img1, keypoints1)
|
||||
descriptors2, mask2 = extractor.extract(img2, keypoints2)
|
||||
descriptors3, mask3 = extractor.extract(img3, keypoints3)
|
||||
extractor.extract(img1, keypoints1)
|
||||
keypoints1 = keypoints1[extractor.mask_]
|
||||
descriptors1 = extractor.descriptors_
|
||||
|
||||
keypoints1 = keypoints1[mask1]
|
||||
keypoints2 = keypoints2[mask2]
|
||||
keypoints3 = keypoints3[mask3]
|
||||
extractor.extract(img2, keypoints2)
|
||||
keypoints2 = keypoints2[extractor.mask_]
|
||||
descriptors2 = extractor.descriptors_
|
||||
|
||||
extractor.extract(img3, keypoints3)
|
||||
keypoints3 = keypoints3[extractor.mask_]
|
||||
descriptors3 = extractor.descriptors_
|
||||
|
||||
matches12 = match_descriptors(descriptors1, descriptors2, cross_check=True)
|
||||
matches13 = match_descriptors(descriptors1, descriptors3, cross_check=True)
|
||||
|
||||
@@ -21,21 +21,23 @@ tform = tf.AffineTransform(scale=(1.5, 1.5), rotation=0.5,
|
||||
img2 = tf.warp(img1, tform)
|
||||
|
||||
detector = CenSurE()
|
||||
keypoints1, scales1 = detector.detect(img1)
|
||||
keypoints2, scales2 = detector.detect(img2)
|
||||
|
||||
fig, ax = plt.subplots(nrows=1, ncols=2)
|
||||
|
||||
plt.gray()
|
||||
|
||||
detector.detect(img1)
|
||||
|
||||
ax[0].imshow(img1)
|
||||
ax[0].axis('off')
|
||||
ax[0].scatter(keypoints1[:, 1], keypoints1[:, 0], 2 ** scales1,
|
||||
facecolors='none', edgecolors='r')
|
||||
ax[0].scatter(detector.keypoints_[:, 1], detector.keypoints_[:, 0],
|
||||
2 ** detector.scales_, facecolors='none', edgecolors='r')
|
||||
|
||||
detector.detect(img2)
|
||||
|
||||
ax[1].imshow(img2)
|
||||
ax[1].axis('off')
|
||||
ax[1].scatter(keypoints2[:, 1], keypoints2[:, 0], 2 ** scales2,
|
||||
facecolors='none', edgecolors='r')
|
||||
ax[1].scatter(detector.keypoints_[:, 1], detector.keypoints_[:, 0],
|
||||
2 ** detector.scales_, facecolors='none', edgecolors='r')
|
||||
|
||||
plt.show()
|
||||
|
||||
@@ -27,9 +27,18 @@ tform = tf.AffineTransform(scale=(1.3, 1.1), rotation=0.5,
|
||||
img3 = tf.warp(img1, tform)
|
||||
|
||||
descriptor_extractor = ORB(n_keypoints=200)
|
||||
keypoints1, descriptors1 = descriptor_extractor.detect_and_extract(img1)
|
||||
keypoints2, descriptors2 = descriptor_extractor.detect_and_extract(img2)
|
||||
keypoints3, descriptors3 = descriptor_extractor.detect_and_extract(img3)
|
||||
|
||||
descriptor_extractor.detect_and_extract(img1)
|
||||
keypoints1 = descriptor_extractor.keypoints_
|
||||
descriptors1 = descriptor_extractor.descriptors_
|
||||
|
||||
descriptor_extractor.detect_and_extract(img2)
|
||||
keypoints2 = descriptor_extractor.keypoints_
|
||||
descriptors2 = descriptor_extractor.descriptors_
|
||||
|
||||
descriptor_extractor.detect_and_extract(img3)
|
||||
keypoints3 = descriptor_extractor.keypoints_
|
||||
descriptors3 = descriptor_extractor.descriptors_
|
||||
|
||||
matches12 = match_descriptors(descriptors1, descriptors2, cross_check=True)
|
||||
matches13 = match_descriptors(descriptors1, descriptors3, cross_check=True)
|
||||
|
||||
Reference in New Issue
Block a user