Packages

  • package root
    Definition Classes
    root
  • package web
    Definition Classes
    root
  • package utils
    Definition Classes
    web
  • object Utils

    Functional utilities for image processing with safe IO using Either.

    Functional utilities for image processing with safe IO using Either.

    All operations that involve reading or writing files return Either[String, File], where Left(errorMessage) indicates failure and Right(file) indicates success.

    Definition Classes
    utils
  • OCR
  • PaletteMaker

object OCR

Utility object for performing image preprocessing tasks for OCR.

This includes rotation correction, grayscale conversion, contrast adjustment, and optional binarization. All functions that manipulate pixels are pure and do not perform IO.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. OCR
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. sealed trait ContrastLevel extends AnyRef

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def binarize(image: ImmutableImage, threshold: Int = 128): ImmutableImage

    Binarizes an image by converting all pixels to either black or white based on a brightness threshold.

    Binarizes an image by converting all pixels to either black or white based on a brightness threshold.

    image

    the input image

    threshold

    cutoff intensity (0–255) to determine black or white (default: 128)

    returns

    a new binary (black-and-white) ImmutableImage

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  7. def contrast(image: ImmutableImage, level: ContrastLevel): ImmutableImage

    Adjusts image contrast by scaling the distance of pixel intensities from the midpoint (128).

    Adjusts image contrast by scaling the distance of pixel intensities from the midpoint (128).

    image

    the input image

    returns

    a new ImmutableImage with adjusted contrast

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  11. def grayscale(image: ImmutableImage): ImmutableImage

    Converts an image to grayscale using a weighted luminance filter.

    Converts an image to grayscale using a weighted luminance filter.

    image

    the input image

    returns

    a new grayscale ImmutableImage

  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  17. def prepareOCR(image: ImmutableImage, tilt: Double = 0.0, contrastFactor: Double = 1.4, threshold: Int = 128, doBinarize: Boolean = true): ImmutableImage

    Performs a complete preprocessing pipeline for OCR: rotation correction, grayscale conversion, contrast adjustment, and optional binarization.

    Performs a complete preprocessing pipeline for OCR: rotation correction, grayscale conversion, contrast adjustment, and optional binarization.

    image

    the input image

    tilt

    rotation angle in degrees (default: 0.0)

    contrastFactor

    contrast multiplier (default: 1.4)

    threshold

    threshold for binarization (default: 128)

    doBinarize

    whether to perform binarization (default: true)

    returns

    the processed ImmutableImage ready for OCR

  18. def rotate(image: ImmutableImage, radians: Double): ImmutableImage

    Rotates an image to correct tilt or skew.

    Rotates an image to correct tilt or skew.

    image

    the input image

    radians

    rotation angle in radians (positive = counterclockwise)

    returns

    a new ImmutableImage rotated by the specified angle

  19. def saveAsJpeg(image: ImmutableImage, path: String, quality: Int = 90): Either[String, File]

    Saves an image to disk in JPEG format with adjustable compression quality.

    Saves an image to disk in JPEG format with adjustable compression quality.

    image

    the image to save

    path

    destination file path

    quality

    compression quality (0–100, default: 90)

    returns

    Either[String, File] with the output file or error message

  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. object ContrastLevel

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped