Class DocumentCleanupConfiguration

java.lang.Object
io.scanbot.sdk.imageprocessing.DocumentCleanupConfiguration

public class DocumentCleanupConfiguration extends Object
The document cleanup configuration.
  • Constructor Details

    • DocumentCleanupConfiguration

      public DocumentCleanupConfiguration(boolean keepText, int maxUndoRedoStackSize, int maxCleanupResolution, int maxMaskBoundingBoxArea)
      Constructs DocumentCleanupConfiguration with the given params.
      Parameters:
      keepText - If true, detected text is preserved. When enabled, text detection is run, which can be time-consuming. For a better user experience, consider constructing the document cleanup asynchronously. Default is `true`.
      maxUndoRedoStackSize - Maximum number of undo/redo operations to keep in memory. Must be non-negative. If 0, undo/redo operations are unavailable. When the number of operations exceeds this limit, the oldest entries can no longer be undone. Default is `3`.
      maxCleanupResolution - Maximum area (width × height) of the axis-aligned cleanup-region crop. If the mask's bounding rectangle exceeds this limit, the input image is downscaled before cleanup is applied. The cleaned result is then upscaled and written back into the original-resolution image. Use this option to limit peak memory consumption. Memory consumption depends on both the input image resolution and the cleanup area size. Set to 0 to disable the limit. For example, setting it to 1200000 uses approximately 0.5 GB for a 12 MP input image. Whenever possible, prefer running DocumentCleanup on smaller areas instead of relying on this option, as it reduces cleanup quality. Default is `0`.
      maxMaskBoundingBoxArea - Maximum allowed area (width × height, in pixels) of the axis-aligned bounding box enclosing all non-zero pixels of the mask passed to run(). If the mask's bounding box area exceeds this limit, cleanup is not performed: run() returns the current (unchanged) image with status ERROR_MASK_TOO_LARGE and the undo/redo history is left untouched. Use this option as a hard guard against unintentionally large cleanup regions that would take a long time to process. Execution time of a single cleanup call grows roughly with the mask's bounding-box area, so capping it bounds the worst-case latency of run(). Note the difference from maxCleanupResolution: maxCleanupResolution silently reduces quality by internal downscaling to bound peak memory, whereas maxMaskBoundingBoxArea rejects oversized masks outright so the caller can react (e.g. ask the user to select a smaller area). The default of 600000 (approximately 0.6 MP) is a good fit for typical interactive cleanup on a single object or text block. Set to 0 to disable the limit. Default is `600000`.
    • DocumentCleanupConfiguration

      public DocumentCleanupConfiguration()
      Constructs DocumentCleanupConfiguration with default parameters.
  • Method Details

    • getKeepText

      public boolean getKeepText()
      Getter for keepText field. See constructor documentation for more information about the field.
      Returns:
      keepText
    • setKeepText

      public void setKeepText(boolean keepText)
      Setter for keepText field. See constructor documentation for more information about the field.
      Parameters:
      keepText - Value to set.
    • getMaxUndoRedoStackSize

      public int getMaxUndoRedoStackSize()
      Getter for maxUndoRedoStackSize field. See constructor documentation for more information about the field.
      Returns:
      maxUndoRedoStackSize
    • setMaxUndoRedoStackSize

      public void setMaxUndoRedoStackSize(int maxUndoRedoStackSize)
      Setter for maxUndoRedoStackSize field. See constructor documentation for more information about the field.
      Parameters:
      maxUndoRedoStackSize - Value to set.
    • getMaxCleanupResolution

      public int getMaxCleanupResolution()
      Getter for maxCleanupResolution field. See constructor documentation for more information about the field.
      Returns:
      maxCleanupResolution
    • setMaxCleanupResolution

      public void setMaxCleanupResolution(int maxCleanupResolution)
      Setter for maxCleanupResolution field. See constructor documentation for more information about the field.
      Parameters:
      maxCleanupResolution - Value to set.
    • getMaxMaskBoundingBoxArea

      public int getMaxMaskBoundingBoxArea()
      Getter for maxMaskBoundingBoxArea field. See constructor documentation for more information about the field.
      Returns:
      maxMaskBoundingBoxArea
    • setMaxMaskBoundingBoxArea

      public void setMaxMaskBoundingBoxArea(int maxMaskBoundingBoxArea)
      Setter for maxMaskBoundingBoxArea field. See constructor documentation for more information about the field.
      Parameters:
      maxMaskBoundingBoxArea - Value to set.