I\'m doing pattern matching with OpenCv. I have a model and I compare targets with the function cvMatchShapes. It works but I want to know the orientation of the target. Ho
Are bounding rotated rectangle suited for case when contour orientation differs 180 degrees for example?
Another way for solving your problem is to calculate contours moments (I suppose you are ussing contours in cvMatchShapes, you can compute image moments in similar way too) OpenCV Contours Moments?, then calculating principal axes angle from formula:
atan2((float)(-2)*Ixy,Ix - Iy)/2
This angle says about rotation. More theory about this issue: http://farside.ph.utexas.edu/teaching/336k/newton/node67.html