Package io.scanbot.sdk.imageprocessing
Class DocumentCleanup
java.lang.Object
io.scanbot.sdk.imageprocessing.DocumentCleanup
- All Implemented Interfaces:
AutoCloseable
API for document cleanup.
Required licence feature(s): ImageProcessing.
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentCleanup(ImageRef image, DocumentCleanupConfiguration configuration) Constructs DocumentCleanup with the given params. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRedo()Returns whether a redo operation is currently available.booleancanUndo()Returns whether an undo operation is currently available.voidclose()Closes native resources held by the object.protected voidfinalize()redo()Re-applies the last undone cleanup operation.reset()Restores the original image, and clears the undo/redo history.cleans the masked areas up.undo()Reverts the last cleanup operation.
-
Constructor Details
-
DocumentCleanup
public DocumentCleanup(ImageRef image, DocumentCleanupConfiguration configuration) throws InvalidImageRefException, LicenseException Constructs DocumentCleanup with the given params.- Parameters:
image- The image to process.configuration- The document cleanup configuration.- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
-
Method Details
-
run
cleans the masked areas up.- Parameters:
mask- Specifies the regions to clean up. Non-zero pixels indicate the region to be cleaned up.- Returns:
- Cleanup result with status and the cleaned up image.
- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
undo
Reverts the last cleanup operation. If no operations are available to undo, returns the current image unchanged. The number of available undo operations is limited by maxUndoRedoStackSize. When the operation limit is exceeded, the oldest operations cannot be undone.- Returns:
- Image with last operation reverted, or current image if no operations to undo.
- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
redo
Re-applies the last undone cleanup operation. If no operations are available to redo, returns the current image unchanged. Performing a new cleanup operation after undo will clear the redo history.- Returns:
- Image with last undone operation re-applied, or current image if no operations to redo.
- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
reset
Restores the original image, and clears the undo/redo history. After reset, both canUndo and canRedo return false.- Returns:
- The original, unmodified image.
- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
canUndo
public boolean canUndo()Returns whether an undo operation is currently available. This is true when at least one cleanup operation has been performed and not yet fully undone.- Returns:
- True if undo is available, false otherwise.
-
canRedo
public boolean canRedo()Returns whether a redo operation is currently available. This is true when at least one undo operation has been performed and not yet overwritten by a new cleanup.- Returns:
- True if redo is available, false otherwise.
-
close
public void close()Closes native resources held by the object.- Specified by:
closein interfaceAutoCloseable
-
finalize
-