DLSkew Class Reference

Skew detection algorithm. More...

#include <DLSkew.h>

List of all members.

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


Detailed Description

Skew detection algorithm.

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.


Member Function Documentation

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.

Parameters:
in input image.
Returns:
Best skew angle within the specified range, in degrees.

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.

Parameters:
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
Returns:
Best skew angle within the specified range, in degrees. For example, if the image had no skew, but the search bounds were [20,30], a value of 20 is returned.


The documentation for this class was generated from the following file:

DOCLIB is being developed under contract by a collaboration between:
The Laboratory for Language and Media Processing
Unviersity of Maryland, College Park
and
Booz | Allen | Hamilton

All Rights Reserved, 2003-2007