From 24315405350d4d06acc64256e909e67424841f5e Mon Sep 17 00:00:00 2001 From: Johannes Terblanche Date: Wed, 24 Apr 2024 11:57:05 +0200 Subject: [PATCH] check all matches agains threshold --- ext/services/OpenCVFeatures.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/services/OpenCVFeatures.jl b/ext/services/OpenCVFeatures.jl index 97f89d7..1901c11 100644 --- a/ext/services/OpenCVFeatures.jl +++ b/ext/services/OpenCVFeatures.jl @@ -133,7 +133,7 @@ function goodFeaturesToTrackORB( return kp_, des end -function getPoseSIFT(imgA, imgB, K; mask=nothing) +function getPoseSIFT(imgA, imgB, K; mask=nothing, distthreshold=100) # Initiate SIFT detector sift = cv.SIFT_create() # sift = cv.ORB_create() @@ -148,10 +148,10 @@ function getPoseSIFT(imgA, imgB, K; mask=nothing) # Apply ratio test good = [] for mat in matches - m = mat[1] - n = mat[2] - if m.distance < 0.75 * n.distance - push!(good, (distance=m.distance, queryIdx=m.queryIdx+1, trainIdx=m.trainIdx+1)) + for m in mat + if m.distance < distthreshold + push!(good, (distance=m.distance, queryIdx=m.queryIdx+1, trainIdx=m.trainIdx+1)) + end end end