ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 OCR recognize C++ - What's wrong? (SOLVED!)
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

activer

Hungary
14 Posts

Posted - Nov 24 2013 :  12:34:53  Show Profile  Reply
Hi Support Team!

I wrote this method:

void __fastcall TForm5::Button1Click(TObject *Sender)
{
	_di_TIEVisionOCR OCR;
	_di_TIEVisionWString str;
	wchar_t *cstr;

	if (IEVisionAvailable()) {
		_di_TIEVisionImage image= ImageEnView1->IEBitmap->GetIEVisionImage();
		if (image) {
			   IEVisionLib()->createOCR("eng" , TIEVisionOCREngine::ievOCRFAST, false, OCR);
			   if (OCR) {
			       //OCR->setSegmentationMode(ievOCRAUTO );
				   OCR->recognize(image, IEVisionRect(0, 0, 0, 0), false, str);
				   str->c_str(false, cstr);
				   Memo1->Lines->Text = WideString(cstr);
			   }  else {
				   ShowMessage("visionocr error");
			   }
		} else {
			ShowMessage("image error");
		}
	} else ShowMessage("couldn't find ievision.dll");


}


I can build it but at the OCR->recognize line I get a dll violation error.

What's wrong? The dll is in the exe's folder together with the eng language files. I tried to use your 2.png file


The project is here: http://bit.ly/1bgegMV

I use XE3 C++ with ImageEn 5.0.5 and IEVISIOn 2.0.0.

(The c++ version of ievision OCR demo doesn't work.)

Thanks in advance!


xequte

38616 Posts

Posted - Nov 27 2013 :  11:32:42  Show Profile  Reply
Hi

Specifically, do you mean that an Access Violation arised in the call to createOCR?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

activer

Hungary
14 Posts

Posted - Nov 27 2013 :  13:09:57  Show Profile  Reply
It happens at
OCR->recognize(image, IEVisionRect(0, 0, 0, 0), false, str);
line.

See the picture:

Go to Top of Page

xequte

38616 Posts

Posted - Nov 27 2013 :  14:43:39  Show Profile  Reply
Hi

Does it happen with all images, i.e. including the ones with the IEVision demo? Does our compiled demo (www.imageen.com/demos/) fail on the same files?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

activer

Hungary
14 Posts

Posted - Nov 27 2013 :  15:16:24  Show Profile  Reply
I used your demo images only.

I downloaded the two OCR demos, both gives this message:



Do the two compiled OCR demos work perfectly for you?
Go to Top of Page

xequte

38616 Posts

Posted - Nov 27 2013 :  16:58:23  Show Profile  Reply
Yes, I do not encounter any errors on WinXP and Win7/64



What version of Windows are you using?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

activer

Hungary
14 Posts

Posted - Nov 28 2013 :  00:38:35  Show Profile  Reply
Hmmm, very interesting.

I'm using Win7/64bit Professional (Hungarian).

I tested again your compiled OCR demo but the error message appears always.

Are you using English version of Windows?
Go to Top of Page

xequte

38616 Posts

Posted - Nov 28 2013 :  13:33:29  Show Profile  Reply
Hi

Yes, English version of Windows, though that should not be an issue.

Try restarting Windows and running the demo before you start up anything else.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

activer

Hungary
14 Posts

Posted - Nov 28 2013 :  15:13:47  Show Profile  Reply
My sons have a box with Win7/64bit Home Premium ENGLISH version. I tried: your OCR demo works on this machine!!!
Go to Top of Page

activer

Hungary
14 Posts

Posted - Nov 28 2013 :  15:21:17  Show Profile  Reply
As you suggested I rebooted my machine (+switched off antivirus sw + I checked the clean dll environment before) but the demo doesn't work.

I added hun.traineddata file but it doesn't solve the problem.
Go to Top of Page

activer

Hungary
14 Posts

Posted - Nov 28 2013 :  16:00:43  Show Profile  Reply
I made a win7/64bit pro English install to a new VirtualBox machine. The Ocr demo works on it too.
Go to Top of Page

xequte

38616 Posts

Posted - Nov 29 2013 :  12:47:13  Show Profile  Reply
Hi

We test it on Italian Windows too, so I think your results may be indirect or coincidental.

It could be a path issue, try replacing:

IEVisionLib()->createOCR("eng", ievOCRFAST, false, OCR);


with:

IEVisionLib()->createOCR("C:\\path\path\\", "eng", ievOCRFAST, false, OCR);


Where "C:\\path\path\\" is the folder that contains the “eng.traineddata” file (double-slash only for C++).




Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

activer

Hungary
14 Posts

Posted - Nov 30 2013 :  02:51:55  Show Profile  Reply
SOLVED!

I installed Tesseract OCR some weeks ago then I uninstalled it. But the uninstaller didn't clear perfectly the registry: here remains a tag TESSDATA_PREFIX which points the original folder of traineddata files. Your demo (with the embedded Tesseract engine) tried to use this nonexisting folder... (I used Microsoft's Process Monitor to examine the situation.)
I deleted this key from registry (it had two entries), then rebooted the machine and OCR demo works now!
Thanks for your cooperation!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: