ORB: Change default threshold to 85 and min match to 5.

This commit is contained in:
iabdalkader 2017-01-10 04:11:41 +02:00
parent cfc677ed40
commit 58ef87cd85
3 changed files with 4 additions and 4 deletions

View File

@ -2714,7 +2714,7 @@ static mp_obj_t py_image_match_descriptor(uint n_args, const mp_obj_t *args, mp_
case DESC_ORB: { case DESC_ORB: {
py_kp_obj_t *kpts1 = ((py_kp_obj_t*)args[1]); py_kp_obj_t *kpts1 = ((py_kp_obj_t*)args[1]);
py_kp_obj_t *kpts2 = ((py_kp_obj_t*)args[2]); py_kp_obj_t *kpts2 = ((py_kp_obj_t*)args[2]);
int threshold = py_helper_lookup_int(kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_threshold), 70); int threshold = py_helper_lookup_int(kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_threshold), 85);
int filter_outliers = py_helper_lookup_int(kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_filter_outliers), false); int filter_outliers = py_helper_lookup_int(kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_filter_outliers), false);
// Sanity checks // Sanity checks

View File

@ -63,7 +63,7 @@ while (True):
# Match the first set of keypoints with the second one # Match the first set of keypoints with the second one
c=image.match_descriptor(image.ORB, kpts1, kpts2) c=image.match_descriptor(image.ORB, kpts1, kpts2)
match = c[6] # C[6] contains the number of matches. match = c[6] # C[6] contains the number of matches.
if (match>2): if (match>5):
img.draw_rectangle(c[2:6]) img.draw_rectangle(c[2:6])
img.draw_cross(c[0], c[1], size=10) img.draw_cross(c[0], c[1], size=10)
print(kpts2, "matched:%d dt:%d"%(match, c[7])) print(kpts2, "matched:%d dt:%d"%(match, c[7]))

View File

@ -39,9 +39,9 @@ while (True):
kpts1 = kpts2 kpts1 = kpts2
draw_keypoints(img, kpts1) draw_keypoints(img, kpts1)
elif kpts2: elif kpts2:
c = image.match_descriptor(image.ORB, kpts1, kpts2, threshold=70) c = image.match_descriptor(image.ORB, kpts1, kpts2, threshold=85)
match = c[6] # C[6] contains the number of matches. match = c[6] # C[6] contains the number of matches.
if (match>2): if (match>5):
img.draw_rectangle(c[2:6]) img.draw_rectangle(c[2:6])
img.draw_cross(c[0], c[1], size=10) img.draw_cross(c[0], c[1], size=10)