@Service
public class OCRService
extends Object
OCR服务
尊重知识产权,CV 请保留版权,海文科技 https://hiver.cc 出品,不允许非法使用,后果自负
- 作者:
- Yazhi Li
-
-
方法概要
doOCR(org.springframework.web.multipart.MultipartFile file,
String language)
对上传的图片文件进行 OCR 识别,返回识别出的文字
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
构造器详细资料
-
OCRService
public OCRService(@Value("${tesseract.datapath}")
String tessDataPath)
-
方法详细资料
-
doOCR
public String doOCR(org.springframework.web.multipart.MultipartFile file,
String language)
throws Exception
对上传的图片文件进行 OCR 识别,返回识别出的文字
- 参数:
file - 上传的图片文件(MultipartFile)
- 返回:
- 识别出的文字内容
- 抛出:
Exception - 如果识别失败或文件有问题,抛出异常