Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There is a common technique used in OCR software that does the following (pseudocode):

threshold the image with an automatic global method (i.e. Otsu)
foreach (angle in angleRange)
    rotate original image by angle degrees
    count the number of white pixels (background) in each row
    store this number in a vector together with the associated angle
find the angle corresponding to the maximum value in the vector

This works because when the image is straight, in every row there is the maximum value of background pixels.