Package io.scanbot.sdk.documentscanner
Class DocumentEnhancer
- java.lang.Object
-
- io.scanbot.sdk.documentscanner.DocumentEnhancer
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class DocumentEnhancer extends java.lang.Object implements java.lang.AutoCloseableAPI for document enhancement. Required licence feature(s): DocumentScanner, ImageProcessing.
-
-
Constructor Summary
Constructors Constructor Description DocumentEnhancer()Constructs DocumentEnhancer with the given params.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes native resources held by the object.protected voidfinalize()static booleanisStraighteningModeAvailable(DocumentStraighteningMode mode)Check if the specified straightening mode is available (i.e.DocumentStraighteningResultstraighten(ImageRef image, DocumentStraighteningParameters parameters, java.util.List<PointF> priorCornersNormalized)Straightens the document effectively straightening its edges and text.
-
-
-
Constructor Detail
-
DocumentEnhancer
public DocumentEnhancer() throws LicenseExceptionConstructs DocumentEnhancer with the given params.- Throws:
LicenseException- If license requirements for the API are not met
-
-
Method Detail
-
straighten
public DocumentStraighteningResult straighten(ImageRef image, DocumentStraighteningParameters parameters, java.util.List<PointF> priorCornersNormalized) throws InvalidImageRefException, LicenseException
Straightens the document effectively straightening its edges and text.- Parameters:
image- The image of the document to straighten.parameters- The parameters to use for straightening.priorCornersNormalized- If 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.
- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
isStraighteningModeAvailable
public static boolean isStraighteningModeAvailable(DocumentStraighteningMode mode)
Check if the specified straightening mode is available (i.e. required assets are present).- Parameters:
mode- The straightening mode to check.- Returns:
- True if the straightening mode is available, false otherwise.
-
close
public void close()
Closes native resources held by the object.- Specified by:
closein interfacejava.lang.AutoCloseable
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-