Skip to main content

OCR

OCR is performed only after the image has been aligned to 800 x 1200 pixels. The service reads two fixed rectangles:

OutputRectangle (x, y, width, height)
studentName(150, 100, 300, 50)
className(500, 100, 150, 50)

The production OCR implementation initializes Tess4J with relative path tessdata, language vie, and page segmentation mode 6. It converts each OpenCV Mat crop to a buffered image, runs Tesseract, and trims the result.

If Tesseract cannot initialize, the service logs the failure and returns OCR Disabled for OCR calls. OCR conversion or Tesseract exceptions are logged and return an empty string.

The test profile does not use Tesseract. It registers a dummy OCR service that always returns Dummy Student. Therefore the test suite does not measure native Tesseract installation, Vietnamese handwriting recognition, English recognition, crop quality, or real OCR accuracy.