从图像中提取文本 [英] extraction text from image

查看:190
本文介绍了从图像中提取文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  class  ttt 
{
static String str;
静态 BufferedImage图像;
public static void main ( String [] args) throws IOException,TesseractException {


文件imageFile = 文件( 1.png );

Tesseract instance = Tesseract.getInstance();
instance.setDatapath( C:/ Program Files(x86)/ Java);

String result = instance.doOCR(imageFile);


}

}





以上代码工作正常但是out put不显示我试图显示图像中可以显示的任何文本但是没有发生请帮助我或给我任何提示

解决方案

在得到结果后尝试添加此行:

 System.out.println(结果)



祝你好运!


请参阅:

错误while-using-tesseract-to-extract-the-text-in-the-image-using-androidtarget =_ blanktitle =New Window> ^ ]

如何使用图像提取文本openCV或OCR tesseract? [ ^ ]


您需要显示存储在字符串变量结果中的图像文本。 />
所以最后添加这一行:



System.out.println(****结果是:**** **+结果);

class ttt
{
	static String str;
	static BufferedImage image;
	public static void main(String[] args) throws IOException, TesseractException {
		

		File imageFile = new File("1.png");

		Tesseract instance = Tesseract.getInstance();
		instance.setDatapath("C:/Program Files (x86)/Java");

		String result = instance.doOCR(imageFile);

		
	}
	
}



above code work fine but out put is not display i tried to display whatever text present in image that can be displayed in output but that was not happening please help me or give me any hint

解决方案

Try adding this line after you get the result:

System.out.println(result)


Good luck!


See:
Error while using tesseract to extract the text in the image [^]
How to extract text from image using openCV or OCR tesseract?[^]


You need to display the image text stored in String variable result.
so add this line at end :

System.out.println("**** RESULT IS: ******"+result);


这篇关于从图像中提取文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆