Scanbot SDK
Loading...
Searching...
No Matches
DocumentStraightener

Provides functionality to straighten document photos by eliminating physical deformations and surface warping, such as folds, creases, wrinkles, crumples, page and geometric bends. More...

Public Member Functions

None __init__ (self)
 Initialize the document enhancer.
 
DocumentStraighteningResult run (self, *, ImageRef image, Optional[DocumentStraighteningParameters] parameters=None, Optional[Sequence[PointF]] prior_corners_normalized=None)
 Straightens document photos by eliminating physical deformations and surface warping, such as folds, creases, wrinkles, crumples, page curls, and geometric bends.
 
bool is_straightening_mode_available (cls, *, DocumentStraighteningMode mode)
 Check if the specified straightening mode is available (i.e.
 

Detailed Description

Provides functionality to straighten document photos by eliminating physical deformations and surface warping, such as folds, creases, wrinkles, crumples, page and geometric bends.

Required licence feature(s): DocumentScanner, ImageProcessing.

Member Function Documentation

◆ is_straightening_mode_available()

bool is_straightening_mode_available ( cls,
* ,
DocumentStraighteningMode mode )

Check if the specified straightening mode is available (i.e.

required assets are present).

Parameters
modeThe straightening mode to check.
Returns
True if the straightening mode is available, false otherwise.

◆ run()

DocumentStraighteningResult run ( self,
* ,
ImageRef image,
Optional[DocumentStraighteningParameters] parameters = None,
Optional[Sequence[PointF]] prior_corners_normalized = None )

Straightens document photos by eliminating physical deformations and surface warping, such as folds, creases, wrinkles, crumples, page curls, and geometric bends.

Parameters
imageThe image of the document to straighten.
parametersThe parameters to use for straightening.
prior_corners_normalizedIf it is known where the document corners (e.g. from a prior detection), those can be provided here. The enhancer may take them into account to locate the document more accurately. As part of the straightening process, it may be necessary to detect the document corners. That's why providing them here can speed up the process (given the corners are already available). Corners must be provided in the clockwise order: top-left, top-right, bottom-right, bottom-left. The coordinates must be normalized to the range [0, 1] relative to the image dimensions. For x coordinates, 0 corresponds to the left edge of the image and 1 to the right edge. For y coordinates, 0 corresponds to the top edge of the image and 1 to the bottom edge. Note, that when a coordinate is normalized, correct formula for x coordinate is: x_normalized = x_pixel / (image_width - 1), and for y coordinate is: y_normalized = y_pixel / (image_height - 1).
Returns
The detection result.

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