The class estimates the skew of a document page. The methodology is based on "Skew estimation of natural images based on a salient line detector", Hyung Il Koo and Nam Ik Cho
More...
#include <SkewEstimation.h>
|
cv::Mat | separability (const cv::Mat &srcImg, int w, int h, const cv::Mat &mask=cv::Mat()) |
| Computes the separability of two neighbouring regions based on mean and variance. More...
|
|
cv::Mat | edgeMap (const cv::Mat &separability, double thr, EdgeDirection direction=HORIZONTAL, const cv::Mat &mask=cv::Mat()) const |
| Computes the edge map based on the separability More...
|
|
QVector< QVector3D > | computeWeights (cv::Mat edgeMap, int delta, int epsilon, EdgeDirection direction=HORIZONTAL) |
| Computes the PPHT, detects straight lines and refines it More...
|
|
double | skewEst (const QVector< QVector3D > &weights, double imgDiagonal, bool &ok, double eta=0.35) |
| Computes the skew based oon the detected lines More...
|
|
bool | checkInput () const override |
| Checks the input - not yet implemented. More...
|
|
QString | debugName () const |
|
The class estimates the skew of a document page. The methodology is based on "Skew estimation of natural images based on a salient line detector", Hyung Il Koo and Nam Ik Cho
- See also
- Module
Enumerator |
---|
HORIZONTAL |
|
VERTICAL |
|
rdf::BaseSkewEstimation::BaseSkewEstimation |
( |
const cv::Mat & |
img = cv::Mat() , |
|
|
const cv::Mat & |
mask = cv::Mat() |
|
) |
| |
Initializes a new instance of the BaseSkewEstimation class.
- Parameters
-
img | The source img. |
mask | The optional mask. |
bool rdf::BaseSkewEstimation::checkInput |
( |
| ) |
const |
|
overrideprotectedvirtual |
Checks the input - not yet implemented.
- Returns
Implements rdf::Module.
bool rdf::BaseSkewEstimation::compute |
( |
| ) |
|
|
virtual |
Computes the skew angle based on "Skew Estimation of natural images based on a
salient line detector", Hyung Il Koo and Nam Ik Choo.
- Returns
- true if the angle could be computed
Implements rdf::Module.
QVector< QVector3D > rdf::BaseSkewEstimation::computeWeights |
( |
cv::Mat |
edgeMap, |
|
|
int |
delta, |
|
|
int |
epsilon, |
|
|
EdgeDirection |
direction = HORIZONTAL |
|
) |
| |
|
protected |
Computes the PPHT, detects straight lines and refines it
- Parameters
-
edgeMap | The edge map. |
delta | Delta parameter: max coordinate deviation for refined lines. |
epsilon | Epsilon parameter: max allowed deviation from line coordinates for the weight calculation (=2). |
direction | The direction (horizontal or vertical). |
- Returns
- The line weights
cv::Mat rdf::BaseSkewEstimation::edgeMap |
( |
const cv::Mat & |
separability, |
|
|
double |
thr, |
|
|
EdgeDirection |
direction = HORIZONTAL , |
|
|
const cv::Mat & |
mask = cv::Mat() |
|
) |
| const |
|
protected |
Computes the edge map based on the separability
- Parameters
-
separability | The separability map. |
thr | A threshold value for edges (=0.1). |
direction | The direction (horizontal or vertical). |
mask | The optional mask. |
- Returns
- The edge map.
double rdf::BaseSkewEstimation::getAngle |
( |
| ) |
|
Gets the skew angle.
- Returns
- The skew angle
QVector< QVector4D > rdf::BaseSkewEstimation::getSelectedLines |
( |
| ) |
const |
bool rdf::BaseSkewEstimation::isEmpty |
( |
| ) |
const |
|
overridevirtual |
Determines whether this instance is empty.
- Returns
- true if no src image is set.
Implements rdf::Module.
cv::Mat rdf::BaseSkewEstimation::separability |
( |
const cv::Mat & |
srcImg, |
|
|
int |
w, |
|
|
int |
h, |
|
|
const cv::Mat & |
mask = cv::Mat() |
|
) |
| |
|
protected |
Computes the separability of two neighbouring regions based on mean and variance.
- Parameters
-
srcImg | The source img. |
w | The width of the region. |
h | The height of the region. |
mask | The optional mask. |
- Returns
- The separability map
void rdf::BaseSkewEstimation::setFixedThr |
( |
bool |
f | ) |
|
void rdf::BaseSkewEstimation::setImages |
( |
const cv::Mat & |
img, |
|
|
const cv::Mat & |
mask = cv::Mat() |
|
) |
| |
Sets the images.
- Parameters
-
img | The source img. |
mask | The optional mask. |
double rdf::BaseSkewEstimation::skewEst |
( |
const QVector< QVector3D > & |
weights, |
|
|
double |
imgDiagonal, |
|
|
bool & |
ok, |
|
|
double |
eta = 0.35 |
|
) |
| |
|
protected |
Computes the skew based oon the detected lines
- Parameters
-
weights | The weights. |
imgDiagonal | The img diagonal. |
ok | Ok - is set to false if only one line is detected. |
eta | Eta - parameter to reject small lines. |
- Returns
QString rdf::BaseSkewEstimation::toString |
( |
| ) |
const |
|
overridevirtual |
Summarize the method as string. Not yet implemented.
- Returns
- Summary string.
Reimplemented from rdf::Module.
cv::Mat rdf::BaseSkewEstimation::mMask |
|
protected |
cv::Mat rdf::BaseSkewEstimation::mSrcImg |
|
protected |
The documentation for this class was generated from the following files: