Skip to main content

OCR

Production OCR service

TesseractOcrServiceImpl is active when the Spring profile is not test. Its constructor:

  • Creates a Tess4J Tesseract instance.
  • Sets the data path to tessdata.
  • Selects language vie.
  • Sets page segmentation mode 6.

It converts each OpenCV Mat crop to a BufferedImage, calls Tesseract, and trims the returned text. A conversion or Tesseract exception is logged and returns an empty string. If initialization fails, the service returns OCR Disabled for later extraction calls.

Test OCR double

The test profile excludes the production implementation and registers DummyOcrServiceImpl. That test double returns Dummy Student for every crop. The five controller tests therefore validate the multipart/controller and OMR path without proving production name or class OCR accuracy.

No source-backed guarantee currently exists for handwriting accuracy, supported languages beyond the configured vie mode, OCR throughput, or concurrent use.