![]() |
Leptonica 1.85.0
Image processing and image analysis suite
|
Go to the source code of this file.
Data Structures | |
| struct | L_Dewarpa |
| struct | L_Dewarp |
Macros | |
| #define | DEWARP_VERSION_NUMBER 4 |
Typedefs | |
| typedef struct L_Dewarpa | L_DEWARPA |
| typedef struct L_Dewarp | L_DEWARP |
Data structure to hold arrays and results for generating
horizontal and vertical disparity arrays based on textlines.
Each disparity array is two-dimensional. The vertical disparity
array gives a vertical displacement, relative to the lowest point
in the textlines. The horizontal disparty array gives a horizontal
displacement, relative to the minimum values (for even pages)
or maximum values (for odd pages) of the left and right ends of
full textlines. Horizontal alignment always involves translations
away from the book gutter.
We have intentionally separated the process of building models
from the rendering process that uses the models. For any page,
the building operation either creates an actual model (that is,
a model with at least the vertical disparity being computed, and
for which the 'success' flag is set) or fails to create a model.
However, at rendering time, a page can have one of two different
types of models.
(1) A valid model is an actual model that meets the rendering
constraints, which are limits on model curvature parameters.
See dewarpaTestForValidModel() for details.
Valid models are identified by dewarpaInsertRefModels(),
which sets the 'vvalid' and 'hvalid' fields. Only valid
models are used for rendering.
(2) A reference model is used by a page that doesn't have
a valid model, but has a nearby valid model of the same
parity (even/odd page) that it can use. The range in pages
to search for a valid model is given by the 'maxdist' field.
At the rendering stage, vertical and horizontal disparities are
treated differently. It is somewhat more robust to generate
vertical disparity models (VDM) than horizontal disparity
models (HDM). A valid VDM is required for any correction to
be made; if a valid VDM is not available, just use the input
image. Otherwise, assuming it is available, the use of the
HDM is controlled by two fields: 'useboth' and 'check_columns'.
(a) With useboth == 0, we use only the VDM.
(b) With useboth == 1, we require using the VDM and, if a valid
horizontal disparity model (HDM) is available, we also use it.
(c) With check_columns == 1, check for multiple columns and if
true, only use the VDM, even if a valid HDM is available.
Note that 'check_columns' takes precedence over 'useboth'
when there is more than 1 column of text. By default,
check_columns == 0.
The 'maxdist' parameter is input when the dewarpa is created.
The other rendering parameters have default values given in dewarp1.c.
All parameters used by rendering can be set (or reset) using accessors.
After dewarping, use of the VDM will cause all points on each
altered curve to have a y-value equal to the minimum. Use of
the HDA will cause the left and right edges of the textlines
to be vertically aligned if they had been typeset flush-left
and flush-right, respectively.
The sampled disparity arrays are expanded to full resolution,
using linear interpolation, and this is further expanded
by slope continuation to the right and below if the image
is larger than the full resolution disparity arrays. Then
the disparity correction can be applied to the input image.
If the input pix are 2x reduced, the expansion from sampled
to full res uses the product of (sampling) * (redfactor).
The most accurate results are produced at full resolution, and
this is generally recommended.
Definition in file dewarp.h.
| #define DEWARP_VERSION_NUMBER 4 |
Dewarp version for serialization
Note on versioning of the serialization of this data structure: The dewarping utility and the stored data can be expected to change. In most situations, the serialized version is ephemeral -- it is not needed after being used. No functions will be provided to convert between different versions.
Definition at line 110 of file dewarp.h.
Referenced by dewarpaReadStream(), dewarpaWriteStream(), dewarpReadStream(), and dewarpWriteStream().