Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions examples/tracking/visual/PyCV_TrackFeaturesFwdBck.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,21 @@ function goodFeaturesToTrack(im1, feature_params; mask=nothing)
cv.goodFeaturesToTrack(collect(reinterpret(UInt8, im1)), mask=collect(reinterpret(UInt8,mask)), feature_params...)
end

function goodFeaturesToTrackORB(im1; mask=nothing, orb = cv.ORB_create(), downsample::Int=5, tolerance::Real = 0.1)
function goodFeaturesToTrackORB(im1; mask=nothing, orb = cv.ORB_create(), downsample::Int=1, tolerance::Real = 0.1)
# gray = cv2.cvtColor(im1,cv.COLOR_BGR2GRAY)
# kypts, decrs = orb.detectAndCompute(gray,None)
# https://docs.opencv.org/3.4/d1/d89/tutorial_py_orb.html
# find the keypoints with ORB
img = collect(reinterpret(UInt8, im1))
kp = orb.detect(img, collect(reinterpret(UInt8,mask)))

# downselect a better distribution of features
rows, cols = size(img,1), size(img,2)
sel_kp = ssc(kp, orb.getMaxFeatures() ÷ downsample, tolerance, cols, rows)
sel_kp = if 1 < downsample
# downselect a better distribution of features
rows, cols = size(img,1), size(img,2)
ssc(kp, orb.getMaxFeatures() ÷ downsample, tolerance, cols, rows)
else
kp
end

# compute the descriptors with ORB
kp_, des = orb.compute(img, sel_kp)
Expand Down