Views
No views yet
1// detection
2IDetectionPredictor easyDetectionPredictor = OnnxDetectionPredictor.easyOcr(PATH_TO_DETECTION_MODEL); // e.g. "itext-EasyOCR-craft_mlt_25k.onnx"
3// recognition
4IRecognitionPredictor recognition = OnnxRecognitionPredictor.easyOcr(PATH_TO_RECOGNITION_MODEL, EasyOcrMapper.LATIN_G2); // your recognition ONNX model + appropriate mapper
5// combine into an engine
6try(OnnxOcrEngine ocrEngine = new OnnxOcrEngine(detection, recognition);) {
7 /* Your OCR processing here */
8}1IDetectionPredictor easyDetectionPredictor = OnnxDetectionPredictor.easyOcr(PATH_TO_DETECTION_MODEL);
2IRecognitionPredictor recognition = OnnxRecognitionPredictor.easyOcr(PATH_TO_RECOGNITION_MODEL, EasyOcrMapper.LATIN_G2);
3// orientation predictor (MobileNetV3 variant)
4OnnxOrientationPredictor orientation = OnnxOrientationPredictor.mobileNetV3(PATH_TO_ORIENTATION_MODEL);
5try(OnnxOcrEngine ocrEngine = new OnnxOcrEngine(detection, orientation, recognition)) {
6 /* Your OCR processing here */
7 }1OcrPdfCreator ocrPdfCreator = new OcrPdfCreator(ocrEngine);
2ocrPdfCreator.createPdfFile(Collections.singletonList(new File(imagePath)), new File(outPdfFile))