public class Skew
Image rotation and skew detection methods.
public static float SWEEP_RANGE
Default range for sweep, will detect rotation of + or - 30 degrees.
public static float SWEEP_DELTA
Default sweep delta, reasonably accurate within 0.05 degrees.
public static int SWEEP_REDUCTION
Default sweep reduction, one-eighth the size of the original image.
public static int SEARCH_REDUCTION
Default sweep reduction, one-fourth the size of the original image.
public static float SEARCH_MIN_DELTA
Default search minimum delta, reasonably accurate within 0.05 degrees.
public static float findSkew(Pix pixs)
Finds and returns the skew angle using default parameters.
pixs - Input pix (1 bpp).public static float findSkew(Pix pixs, float sweepRange, float sweepDelta, int sweepReduction, int searchReduction, float searchMinDelta)
Finds and returns the skew angle, doing first a sweep through a set of equal angles, and then doing a binary search until convergence.
Notes:
pixs - Input pix (1 bpp).sweepRange - Half the full search range, assumed about 0; in degrees.sweepDelta - Angle increment of sweep; in degrees.sweepReduction - Sweep reduction factor = 1, 2, 4 or 8.searchReduction - Binary search reduction factor = 1, 2, 4 or 8; and must not exceed sweepReduction.searchMinDelta - Minimum binary search increment angle; in degrees.