Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Java
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
Posted
Updated 4-Oct-13 1:04am
v2
Comments
Richard MacCutchan 4-Oct-13 7:06am    
You need to add some code to do the displaying.
ramamne9595@gmail.com 4-Oct-13 7:21am    
i will add system.out.ptrintln(result); but result was not displaying
Richard MacCutchan 4-Oct-13 7:33am    
What is the content of result?
ZurdoDev 4-Oct-13 7:20am    
What do you mean? If you can extract the text and that is working then why can't you display the text? That seems like the trivial part.
ramamne9595@gmail.com 4-Oct-13 7:24am    
no. suppose i will give image i do not know which text present in image i want to know that text

Try adding this line after you get the result:
System.out.println(result)

Good luck!
 
Share this answer
 
v2
Comments
ramamne9595@gmail.com 4-Oct-13 7:26am    
sir i am adding that what you said but output is null
E.F. Nijboer 4-Oct-13 13:04pm    
Looks like the image didn't result in any actual text.
Do you use an IDE like Eclipse? You could then easy use the debugger to set breakpoints and step through your code.
ramamne9595@gmail.com 4-Oct-13 7:27am    
what can i do??? please help me
ramamne9595@gmail.com 5-Oct-13 1:57am    
i will debug that code in result variable 0 value is stored
E.F. Nijboer 7-Oct-13 9:40am    
It seems that when you said "the code works fine", you meant "code compiles and runs without error", because it seems it ain't working fine. Have you checked out the answer of ridoy? No need for me to repeat that ;-)
You need to display the image text stored in String variable result.
so add this line at end :

System.out.println("**** RESULT IS: ******"+result);
 
Share this answer
 
Comments
Richard MacCutchan 25-Mar-15 8:12am    
Please do not post non-answers; especially in questions more than 1 year old.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900