This forum is disabled, please visit https://forum.opencv.org

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

- 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.

2 | No.2 Revision |

Two ideas came to my ~~mind.
1. ~~mind.

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

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.

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.