c++ - How can we use both Hamming distance and distance between coordinates to match features? -
as known, tracking objects in opencv can use:
- featuredetector find features
- descriptormatcher match similarity between features of desired object , features of current frame in video
- and use findhomography find new position of object
for matching features descriptormatcher uses hamming distance (value of difference between 2 sequences of same size, not distance between coordinates).
i.e. find similar object in current frame, not nearest previous position (if know it).
how can use match both hamming distance , distance between coordinates, example, given weight of both, not hamming distance?
it solve following problems:
if start track object position (x,y) on previous frame, , current frame contains 2 similar objects, find similar, not nearest. due inertia coordinates changes slower similarity (a sharp change in light or rotation of object). , must find similar object nearest coordinates.
thus find features, not similar, give accurate homography, because exclude features, which, although similar, far away in coordinates , belong other objects.
what need like:
- compute matches usual.
dmatchhasqueryidx,trainidxindices. can use these retrieve corresponding keypoints. compute euclidean distance between them, , update valuedistanceifdmatchkind of weighting function.- sort matches distance (since
distancehas changed).
now matches vector sorted according both hamming distance between descriptors , euclidean distance between keypoints.
Comments
Post a Comment