Ask Your Question
0

return value matchShapes(contours) [closed]

asked 2016-11-16 07:56:24 -0600

stan123 gravatar image

I know that the return value of the matchShapes() function is different depending of the orientation of the contour. But I recognized that a twisted contour gets a smaller return value than a not twisted. How can this be?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by stan123
close date 2016-11-18 07:11:34.049968

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-11-17 11:47:43 -0600

essamzaky gravatar image

Here there are two methods you can do

Method1

1-convert contour1 to image using drawContour drawcontours

2-convert contour2 to image using drawContour

3-use find keypoints and feature matching , this method is rotation invariant you can follow the following example Feature Matching with FLANN

Method 2

1-You can extract features for the two contours using rotation invaraint feature such as HuMoments HuMoments

2-Compare the two moments if the distance is small the two objects are similar

edit flag offensive delete link more

Comments

matchShapes() is actually using the L2 distance of Hu moments (under the hood)

berak gravatar imageberak ( 2016-11-17 12:11:49 -0600 )edit

Thank you very much I tried Method 2 and it worked fine for my problem :-)

stan123 gravatar imagestan123 ( 2016-11-18 07:06:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-11-16 07:56:24 -0600

Seen: 896 times

Last updated: Nov 17 '16