Scanbot SDK
Loading...
Searching...
No Matches
DocumentCleanup

API for document cleanup. More...

Public Member Functions

None __init__ (self, *, ImageRef image, Optional[DocumentCleanupConfiguration] configuration=None)
 Initializes the document cleanup.
 
DocumentCleanupResult run (self, *, ImageRef mask)
 cleans the masked areas up.
 
ImageRef undo (self)
 Reverts the last cleanup operation.
 
ImageRef redo (self)
 Re-applies the last undone cleanup operation.
 
ImageRef reset (self)
 Restores the original image, and clears the undo/redo history.
 
bool can_undo (self)
 Returns whether an undo operation is currently available.
 
bool can_redo (self)
 Returns whether a redo operation is currently available.
 

Detailed Description

API for document cleanup.

Required licence feature(s): ImageProcessing.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self,
* ,
ImageRef image,
Optional[DocumentCleanupConfiguration] configuration = None )

Initializes the document cleanup.

When the keepText option is enabled (see DocumentCleanupConfiguration), text detection will be run, which can be time-consuming. For better user experience, consider running the document cleanup constructor asynchronously.

Parameters
imageThe image to process.
configurationThe document cleanup configuration.

Member Function Documentation

◆ can_redo()

bool can_redo ( self)

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.

◆ can_undo()

bool can_undo ( self)

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.

◆ redo()

ImageRef redo ( self)

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.

◆ reset()

ImageRef reset ( self)

Restores the original image, and clears the undo/redo history.

After reset, both canUndo and canRedo return false.

Returns
The original, unmodified image.

◆ run()

DocumentCleanupResult run ( self,
* ,
ImageRef mask )

cleans the masked areas up.

Parameters
maskSpecifies 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.

◆ undo()

ImageRef undo ( self)

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.

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