mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Set keypoints threshold range between 0 and 100.
This commit is contained in:
parent
9d02e2a42a
commit
93d3885a3c
@ -69,6 +69,7 @@
|
||||
#define SCALE_FACTOR (1.0f) // SCALE_STEP ^ SCALE_IDX
|
||||
#define PATTERN_SCALE (22)
|
||||
|
||||
#define MAX_KP_DIST (512)
|
||||
// number of points on each concentric circle (from outer to inner)
|
||||
const static int n[8] = {6,6,6,6,6,6,6,1};
|
||||
|
||||
@ -311,7 +312,7 @@ int16_t *freak_match_keypoints(kp_t *kpts1, int kpts1_size, kp_t *kpts2, int kpt
|
||||
for (int x=0; x<kpts1_size; x++) {
|
||||
kp_t *kp1 = &kpts1[x];
|
||||
int min_idx = 0;
|
||||
int min_dist = 512;
|
||||
int min_dist = MAX_KP_DIST;
|
||||
|
||||
for (int y=0; y<kpts2_size; y++) {
|
||||
kp_t *kp2 = &kpts2[y];
|
||||
@ -345,7 +346,7 @@ int16_t *freak_match_keypoints(kp_t *kpts1, int kpts1_size, kp_t *kpts2, int kpt
|
||||
}
|
||||
}
|
||||
|
||||
if (min_dist > t) {
|
||||
if ((((MAX_KP_DIST-min_dist)*100/MAX_KP_DIST)) < t) {
|
||||
//no match
|
||||
kpts_match[x] = -1;
|
||||
} else {
|
||||
|
||||
@ -1110,9 +1110,10 @@ static mp_obj_t py_image_match_keypoints(uint n_args, const mp_obj_t *args)
|
||||
py_kp_obj_t *kpts1 = ((py_kp_obj_t*)args[1]);
|
||||
py_kp_obj_t *kpts2 = ((py_kp_obj_t*)args[2]);
|
||||
|
||||
// sanity checks
|
||||
// Sanity checks
|
||||
PY_ASSERT_TYPE(kpts1, &py_kp_type);
|
||||
PY_ASSERT_TYPE(kpts2, &py_kp_type);
|
||||
PY_ASSERT_TRUE_MSG((threshold >=0 && threshold <= 100), "Expected threshold between 0 and 100");
|
||||
|
||||
if (kpts1->size == 0 || kpts2->size == 0) {
|
||||
return mp_const_none;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user