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
 IEVision How to for C++
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

gajendra

16 Posts

Posted - Dec 29 2011 :  07:43:44  Show Profile  Reply
Hi, I am new to using the IEVision plug.

Could you please guide me on how to use it in RAD C++?
Some sample source code in C++ would be great.

Need to know how to access the fuctions, what to include in the header etc.

Thanks

fab

1310 Posts

Posted - Jan 02 2012 :  04:01:52  Show Profile  Reply
Hi,
handling IEVision with C++ is a bit twisted because you have to handle return values manually.
First you have to link ievision unit with (among other "pragmas"):

#pragma link "ievision"

Next here is a sample to perform OCR on a image (assume you have a TImageEnView and a TMemo object on the form):


   // check if "ievision.dll" is available
   if (!IEVisionAvailable()) {
	   ShowMessage("ievision.dll not loaded!");
	   exit;
   }

   // open image
   ImageEnView1->IO->LoadFromFile(ImageEnView1->IO->ExecuteOpenDialog());

   // embed ImageEnView1 image into a "image" object. This step will be simplified in next version of ImageEn
   ImageEnView1->Proc->ConvertTo24Bit();
   ImageEnView1->IEBitmap->Origin = ieboTOPLEFT;
   _di_TIEVisionImage image;
   IEVisionLib->createImage(
				ImageEnView1->IEBitmap->Width,
				ImageEnView1->IEBitmap->Height,
				ievUINT8, 3,
				ImageEnView1->IEBitmap->Rowlen,
				ImageEnView1->IEBitmap->ScanLine[0],
				false, image);

   // perform OCR and put results in "str"
   _di_TIEVisionOCR OCR;
   IEVisionLib->createOCR(":ENG", false, OCR);
   _di_TIEVisionWString str;
   OCR->recognize(image, IEVisionRect(0, 0, 0, 0), false, str);

   // extract unicode string from "str" and put it into Memo1
   wchar_t *cstr;
   str->c_str(false, cstr);
   Memo1->Lines->Text = WideString(cstr);


A complete C++ example will be added in next ImageEn version.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: