Find the orientation of an image

前端 未结 1 1841
后悔当初
后悔当初 2021-01-06 06:23

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

相关标签:
1条回答
  • 2021-01-06 07:17

    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

    0 讨论(0)
提交回复
热议问题