#include <DLSkew.h>
Static Public Member Functions | |
static double | dlDetectSkewTwoBit (const DLImage &in) |
static double | dlDetectSkew (const DLImage &image, const DLAngle &lowerBound, const DLAngle &upperBound, const DLAngle &delta) |
static double | dlDetectSkew (const DLImage &image, double lowerBound=-20, double upperBound=20, double delta=1) |
Classes | |
struct | DLSkewSpot |
The algorithm is implemented as a static function, so no object of class DLSkew needs to be instantiated. See below for a usage example.
Definition at line 17 of file DLSkew.h.
static double DLSkew::dlDetectSkewTwoBit | ( | const DLImage & | in | ) | [static] |
Detect the skew angle of an image using the method from TwoBit (elaboration needed). This feature is not yet complete.
in | input image. |
static double DLSkew::dlDetectSkew | ( | const DLImage & | image, | |
const DLAngle & | lowerBound, | |||
const DLAngle & | upperBound, | |||
const DLAngle & | delta | |||
) | [static] |
Detect the skew angle of an image using projection method.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static double DLSkew::dlDetectSkew | ( | const DLImage & | image, | |
double | lowerBound = -20 , |
|||
double | upperBound = 20 , |
|||
double | delta = 1 | |||
) | [static] |
Detect the skew angle of an image using projection method - fast algorithm. The algorithm searches angles in increments given by delta
in the range [lowerBound
, upperBound
]. Positive angles correspond to a clockwise rotation; negative angles are counterclockwise.
The following example detects the skew of an image, checking the angles {-30, -29.9, -29.8, ... , +30}:
DLImage i("test.tif"); double ang = DLSkew::dlDetectSkew(i, -30, 30, 0.1)
The algorithm used operates directly on a grayscale image. Therefore, if the input image is not grayscale, a conversion is automatically performed on a copy of the input image. The input image itself is not modified. If the input image is binary, DLBitsPerPixelConverter::dlBinary2Gray() is used to convert the binary image to a grayscale image. If input image is color, DLBitsPerPixelConverter::dlDownscaleColor2Binary_threshold() is used to downscale to binary and then DLBitsPerPixelConverter::dlBinary2Gray() is used to upscale to grayscale.
image | input image. | |
lowerBound | the skew angle in degrees where the search starts. Valid angles from -45 to 45 degrees. | |
upperBound | the skew angle in degrees where the search ends. Valid angles from -45 to 45 degrees. | |
delta | the step size in angle increment in degrees |