Ask Your Question
0

calculate blob angle

asked 2013-02-17 10:53:32 -0500

boudi gravatar image

Hello there,

Is it possible to detect the blob angle ? I am currently working on a project to detect letters out of a picture. My letters are on a conveyor belt and a camera takes a picture. In this picture i use blob detection to search for my letter. Because the camera detects lots of other things and since i am only interested in the letter i can easy filter then with filterbyarea. So i get this result

image description

Now assume the letter on the conveyor belt is on an angle greater then 20 degrees. If i use the same program is impossible to detect the letter H. This comes because OCR can only detect letters with an angle of max 20 degrees.

image description

With Quaternion calculation i should be able to calculate this angle, but i can't find any information about this. Is this even possible ?

To make a long story short i want to search the angle X in order to use OCR. image description

All help is welcome Thanks in advance

Best Regards,

Kenny

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-02-17 11:45:48 -0500

Guanta gravatar image

updated 2013-02-17 11:50:30 -0500

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

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

edit flag offensive delete link more

Comments

thanks for the respond i will look into both solutions

boudi gravatar imageboudi ( 2013-02-17 11:53:29 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-02-17 10:53:32 -0500

Seen: 2,002 times

Last updated: Feb 17 '13