OcrEngine

scalacv.OcrEngine
trait OcrEngine

A pluggable OCR engine.

scalacv owns the OpenCV half of OCR — the grayscale → denoise → threshold → deskew preprocessing that makes or breaks recognition (image.forOcr) — and this contract. The engine is yours to supply, because Tesseract (and the cloud OCRs) are heavy, separately-licensed native dependencies that do not belong in a thin OpenCV wrapper. Implementing it is a few lines over tess4j or bytedeco's tesseract preset — see the OCR guide.

val engine: OcrEngine = myTesseractEngine
val text = Image.read("scan.jpg").map(img => try Ocr.read(img, engine).text finally img.close())

Attributes

Source
Ocr.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def recognize(image: Image): OcrResult

Reads the text in image. The image is borrowed (read only), not consumed. Implementations get the best results on an image already run through image.forOcr.

Reads the text in image. The image is borrowed (read only), not consumed. Implementations get the best results on an image already run through image.forOcr.

Attributes

Source
Ocr.scala