finding contours displacement

I found contours on two images with same object and I want to find displacement and rotation of this object. I've tried with rotated bounding boxes of this contours and then its angles and center points but rotations of bounding boxes don't tell about contour rotation correctly because it's the same for angles a+0, a+90, a+180 etc. degrees. Is it any other good way to find rotation and displacement of contours? Maybe some use of convex hull, convexity defects? I've read in Learning OpenCv about matching contours but it hasn't helped. Could someone give some example?

//edit: Maybe there is some way to use something similar to freeman chains to this? But I can't figure out algorithm at the moment. Making chain with angles between sequence point and then checking sequence match isn't working good...


If the object has convexity defects then you could choose one defect, make a vector from the centroid of the first contour to the centroid of this defect. Then you could check the defects in the second contour and match the one that you used before.Again a vector from the centroid of the contour to the centroid of the matched defect.

From this you get 2 segments (vectors) from which you could obtain a displacement and a rotation.

链接地址: http://www.djcxy.com/p/10066.html

上一篇: 收集集合中的对象的属性

下一篇: 寻找轮廓位移