diff --git a/ext/services/OpenCVFeatures.jl b/ext/services/OpenCVFeatures.jl index 1901c11..97f89d7 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, distthreshold=100) +function getPoseSIFT(imgA, imgB, K; mask=nothing) # Initiate SIFT detector sift = cv.SIFT_create() # sift = cv.ORB_create() @@ -148,10 +148,10 @@ function getPoseSIFT(imgA, imgB, K; mask=nothing, distthreshold=100) # Apply ratio test good = [] for mat in matches - for m in mat - if m.distance < distthreshold - push!(good, (distance=m.distance, queryIdx=m.queryIdx+1, trainIdx=m.trainIdx+1)) - end + 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)) end end