mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-11 21:43:17 +08:00
Recarray changes made in example
This commit is contained in:
committed by
Johannes Schönberger
parent
172c5ae1ec
commit
a9106ab9d3
@@ -23,23 +23,21 @@ img = rgb2gray(img_color)
|
||||
transformed_img = rgb2gray(transformed_img_color)
|
||||
|
||||
# Extracting oFAST keypoints and computing their rBRIEF descriptors
|
||||
keypoints1, orientations1, scales1 = keypoints_orb(img, n_keypoints=500)
|
||||
keypoints1 = keypoints_orb(img, n_keypoints=500)
|
||||
keypoints1.shape
|
||||
descriptors1, keypoints1 = descriptor_orb(img, keypoints1, orientations1,
|
||||
scales1)
|
||||
descriptors1, keypoints1 = descriptor_orb(img, keypoints1)
|
||||
keypoints1.shape
|
||||
descriptors1.shape
|
||||
|
||||
keypoints2, orientations2, scales2 = keypoints_orb(transformed_img,
|
||||
keypoints2 = keypoints_orb(transformed_img,
|
||||
n_keypoints=500)
|
||||
keypoints2.shape
|
||||
descriptors2, keypoints2 = descriptor_orb(transformed_img, keypoints2,
|
||||
orientations2, scales2)
|
||||
descriptors2, keypoints2 = descriptor_orb(transformed_img, keypoints2)
|
||||
keypoints2.shape
|
||||
descriptors2.shape
|
||||
|
||||
#Initializing parameters for Descriptor matching
|
||||
match_threshold = 0.25
|
||||
match_threshold = 0.3
|
||||
match_cross_check = True
|
||||
|
||||
pairwise_hamming_distance(descriptors1, descriptors2)
|
||||
@@ -55,8 +53,8 @@ matched_keypoints.shape
|
||||
# Plotting the matched correspondences in both the images using matplotlib
|
||||
src = matched_keypoints[:, 0, :]
|
||||
dst = matched_keypoints[:, 1, :]
|
||||
src_scale = 10 * (scales1[mask1] + 1) ** 1.5
|
||||
dst_scale = 10 * (scales2[mask2] + 1) ** 1.5
|
||||
src_scale = 10 * (keypoints1.octave[mask1] + 1) ** 1.5
|
||||
dst_scale = 10 * (keypoints2.octave[mask2] + 1) ** 1.5
|
||||
|
||||
img_combined = np.concatenate((img_as_float(img_color),
|
||||
img_as_float(transformed_img_color)), axis=1)
|
||||
@@ -71,7 +69,7 @@ ax.axis((0, 2 * offset[1], offset[0], 0))
|
||||
ax.set_title('Matched correspondences : Rotation = %f; Scale = %s; Translation = %s; threshold = %f; cross_check = %r' % (rotate, scaling, translate, match_threshold, match_cross_check))
|
||||
|
||||
for m in range(len(src)):
|
||||
c = np.random.rand(3,1)
|
||||
c = np.random.rand(3,1)
|
||||
ax.plot((src[m, 1], dst[m, 1] + offset[1]), (src[m, 0], dst[m, 0]), '-', color=c)
|
||||
ax.scatter(src[m, 1], src[m, 0], src_scale[m], facecolors='none', edgecolors=c)
|
||||
ax.scatter(dst[m, 1] + offset[1], dst[m, 0], dst_scale[m], facecolors='none', edgecolors=c)
|
||||
|
||||
@@ -199,7 +199,7 @@ def descriptor_orb(image, keypoints, downscale=1.2, n_scales=8):
|
||||
|
||||
curr_keypoints = curr_keypoints[border_mask]
|
||||
|
||||
curr_scale_kpts = np.ascontiguousarray(curr_scale_kpts[border_mask].astype(np.intp))
|
||||
curr_scale_kpts = np.ascontiguousarray(np.round(curr_scale_kpts[border_mask]).astype(np.intp))
|
||||
curr_scale_orientation = np.ascontiguousarray(curr_keypoints.orientation)
|
||||
curr_scale_descriptors = _orb_loop(curr_image, curr_scale_kpts,
|
||||
curr_scale_orientation)
|
||||
|
||||
@@ -34,10 +34,9 @@ def test_keypoints_orb_desired_no_of_keypoints():
|
||||
|
||||
def test_keypoints_orb_less_than_desired_no_of_keypoints():
|
||||
img = rgb2gray(lena())
|
||||
keypoints = keypoints_orb(img, n_keypoints=15,
|
||||
fast_n=12,
|
||||
fast_threshold=0.33,
|
||||
downscale=2, n_scales=2)
|
||||
keypoints = keypoints_orb(img, n_keypoints=15, fast_n=12,
|
||||
fast_threshold=0.33, downscale=2, n_scales=2)
|
||||
|
||||
exp_row = np.array([ 67., 247., 269., 413., 435., 230., 264.,
|
||||
330., 372.])
|
||||
exp_col = np.array([ 157., 146., 111., 70., 180., 136., 336.,
|
||||
@@ -48,6 +47,7 @@ def test_keypoints_orb_less_than_desired_no_of_keypoints():
|
||||
exp_orientations = np.array([-105.76503839, -96.28973044, -53.08162354,
|
||||
-173.4479964 , -175.64733392, -106.07927215,
|
||||
-163.40016243, 75.80865813, -154.73195911])
|
||||
|
||||
exp_response = np.array([ 0.13197835, 0.24931321, 0.44351774,
|
||||
0.39063076, 0.96770745, 0.04935129,
|
||||
0.21431068, 0.15826555, 0.42403573])
|
||||
@@ -66,7 +66,7 @@ def test_descriptor_orb():
|
||||
descriptors, filtered_keypoints = descriptor_orb(img, keypoints)
|
||||
|
||||
descriptors_120_129 = np.array([[ True, False, False, True, False, False, False, False, False, False],
|
||||
[ True, True, False, False, True, False, False, True, False, True],
|
||||
[ True, True, False, False, True, False, False, True, False, True],
|
||||
[False, True, True, False, True, False, True, True, True, True],
|
||||
[False, False, False, True, True, False, True, False, True, False],
|
||||
[False, True, True, True, True, False, True, True, True, False],
|
||||
|
||||
Reference in New Issue
Block a user