java图片去掉文字_java解出图片中的文字

本文介绍了如何使用Java结合Tesseract库进行图像文字识别,通过处理图像去除干扰并创建训练集提高识别准确性。遇到问题时,尝试了模板匹配和Captcha-caffe方案,但未达到理想效果。
摘要由CSDN通过智能技术生成

测试代码:public static String crackImage(String filePath) {

File imageFile = new File(filePath);

ITesseract instance = new Tesseract();

instance.setDatapath("D:\\Users\\DetectText\\tessdata");

try {

String result = instance.doOCR(imageFile);

return result;

} catch (TesseractException e) {

System.err.println(e.getMessage());

return "Error while reading image";

}

}

public static void main(String[] args) {

// TODO Auto-generated method stub

System.out.println(ImageCracker.crackImage("D:\\Users\\DetectText\\tessdata\\captcha1.png"));

}

用博客的验证码试了试,几乎可以算完全识别不出来

看来不使用针对性训练数据不行排除样本中的干扰文字和干扰折线,只保留红色文字BufferedImage initImage;

try {

initImage = ImageIO.read(new File(filePath));

int width = ini

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值