← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #232900]: [1.0] [HowTo] turn on text recognition --- solution

 

Question #232900 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/232900

syed posted a new comment:
Many Thanks RaiMan again for your useful input.
Eventually I have managed to get the Sikuli OCR working. The thing which Sikuli wasn't installing was the 'tessdata' folder with 'English' language provision(file) in it. It was showing sort of following Error on my 64-bit windows  command line window(not on my 32-bit laptop, although was not working there as well)
------Message on Command line Window-----------
Error opening data file F:/sikuli/libs/tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
-------------End---------------
So I what I did, I downloaded tess4j from the following link and unzip it, take the tessdata foler out of it and put it into the libs folder inside Sikuli and set the evnironment variable path of TESSDATA_PREFIX  to sikuli libs folder.
http://sourceforge.net/projects/tess4j/

And it was working fine after that on both systems i.e at my work(64-bit windows7) and at home(32-bit windows7).
Although it is doing OCR but sometimes mess up with digits which is most important in Testing :(. [emailed you screenshot]

I have tried other OCR Java API , AspriseOCR.jar , but its worse than Sikuli OCR built in API. 
Then I was trying to tess4j but couldn't get it right on my eclipse due to 64-bit system and it has 32-bit dll files. :(
If you don't bother and have time, could you please tell me how to setup tess4j on 64-bit system. It showing me following error
--------Error Message----------
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract302': Native library (win32-x86-64/libtesseract302.dll) not found in resource path 
------End-------------
There are already two dll files(liblept168.dll and libtesseract302.dll) which i copy-pasted on c:\windows\system32 folder and also include it in folder(tesseractlib) on my project folder. I have already the following jar files on my build path
ghost4j-0.3.1.jar
jna.jar
jai_imageio.jar
junit-4.10.jar
tess4.jar
and in my code i am also trying to load them by doing this
---------------code---------	
public static void main(String[] args) {
		System.setProperty("jna.library.path", "//tesseractlib//");
		File file=new File(System.getProperty("user.dir")+"//tempOCRImages//no1DropDown.png");
		Tesseract t4j= Tesseract.getInstance();
	    try{
	    	String text=t4j.doOCR(file);
	    	System.out.println("Text is :"+ text);
	    }catch(Exception e){
	    	System.out.println(" IN the exception : "+e);
	    }	
	}
---------End code-----------
Sorry to post a deviated post here but it may be help anyone else who really need OCRing the Image for Testing purposes.
Thanks

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.