package kr.co.swh.lecture.opensource.ocr; 

import java.io.File;

import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

/**
 * <pre>
 * kr.co.swh.lecture.opensource.ocr 
 * ImageToText.java
 *
 * 설명 :
 * </pre>
 * 
 * @since : 2020. 10. 25.
 * @author : tobby48
 * @version : v1.0
 */
public class ImageToText {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		File image = new File("C:\\Users\\tobby48\\git\\swh-opensource\\src\\main\\python\\kr\\co\\swh\\lecture\\opensource\\ocr_tts\\data\\test3.PNG");
		Tesseract tesseract = new Tesseract();
		tesseract.setDatapath("C:\\Program Files\\Tesseract-OCR\\tessdata");
		tesseract.setLanguage("kor");
		tesseract.setPageSegMode(1);
		tesseract.setOcrEngineMode(1);
		try {
			String result = tesseract.doOCR(image);
			System.out.println(result);
		} catch (TesseractException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
