Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Two ideas came to my mind. 1. The more difficult one: You could compute the two main axes by principal component analysis (pca) and from these the angle. A more complete answer to achieve this is given in this post: http://stackoverflow.com/questions/1532168/what-are-the-second-moments-of-a-region

  1. The easier solution: Apply findContours to the filtered letter, then search for the minimal rotated Rectangle using cv::minAreaRect(<the_contour>) which returns a RotatedRect from which you can get the angle.

Two ideas came to my mind. 1. mind.

  1. The more difficult one: You could compute the two main axes by principal component analysis (pca) and from these the angle. A more complete answer to achieve this is given in this post: http://stackoverflow.com/questions/1532168/what-are-the-second-moments-of-a-region

    1. The easier solution: Apply findContours to the filtered letter, then search for the minimal rotated Rectangle using cv::minAreaRect(<the_contour>) which returns a RotatedRect from which you can get the angle.