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 with C++ Builder
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

nitinchandra

India
1 Posts

Posted - Dec 10 2011 :  11:56:44  Show Profile  Reply
Hi Fabrizio,

I was checking out IEVision and intend to update the ImageEnDemo to include the new features. I tried the OCR part first in IEVision and have a few queries...


I wanted to confirm if this is the correct method of doing so as also if I should release the "FinalText" variable here or would that be taken care of by IEVision. The function works as expected...so far :)

There are a couple of other things I wanted to know...

1. Is a 24 bit conversion required for OCR? I tried the UINT1 with 1 channel etc options, did not work. Tesseract requires a 1 BPP image and as far as OCR is concerned, I have used ImageEn in the past to convert images into 1 BPP with cleanup for OCR. First reducing the image to 1BPP suitable for OCR and then reconverting it back to 24 BPP is an overhead. Perhaps I could not figure out how to, or, maybe currently it's not an option.

2. How would I get word/line boxes and confidence levels in the recognized text? Somewhat like the hocr config in Tesseract...would that be an option in a future version?

The OCR function is as follows:

void __fastcall TImageEnVectDemo::OCRImage1Click(TObject *Sender)
{
_di_TIEVisionImage IEVImage;
_di_TIEVisionOCR IEVOCR;
_di_TIEVisionWString IEVString;
wchar_t *FinalText;

if ( IEVisionAvailable() )
{
// 24 bit seems to be required...so save current
ImageEn->Proc->AutoUndo = false;
ImageEn->Proc->SaveUndo();

ImageEn->LockPaint();
ImageEn->LockUpdate();

Screen->Cursor = crHourGlass;

ImageEn->Proc->ConvertTo24Bit();

ImageEn->IEBitmap->Origin = ieboTOPLEFT;
IEVisionLib->createImage( ImageEn->IEBitmap->Width, ImageEn->IEBitmap->Height, ievUINT8, 3, ImageEn->IEBitmap->Rowlen, ImageEn->IEBitmap->ScanLine[0], true, IEVImage );

IEVisionLib->createOCR( ":ENG", true, IEVOCR );
IEVOCR->setAccuracy( ievACCURATE, true );
IEVOCR->recognize( IEVImage, IEVisionRect(0,0,0,0), true, IEVString );

IEVString->c_str( true, FinalText );

ImageEn->Proc->Undo();
ImageEn->Proc->AutoUndo = true;

ImageEn->UnLockUpdate();
ImageEn->UnLockPaint();

Screen->Cursor = crDefault;

MessageDlg( FinalText, mtInformation, TMsgDlgButtons() << mbOK, 0 );
}
else
MessageDlg( "IEVision DLL is required in the system path", mtError, TMsgDlgButtons() << mbOK, 0 );
}


Regards,
Nitin Chandra

fab

1310 Posts

Posted - Dec 11 2011 :  07:27:16  Show Profile  Reply
Hi Nitin,

quote:
1. Is a 24 bit conversion required for OCR?


24 bit conversion is required for IEVision 1.0.0. From next minor release IEVision will accept also 1bpp and 8 bit gray scale images.

quote:
2. How would I get word/line boxes and confidence levels in the recognized text? Somewhat like the hocr config in Tesseract...would that be an option in a future version?


It is the same. Current version doesn't allow word boxes and line boxes. Next minor release will allow word boxes.
It will allow more simplified code avoiding this:
ImageEn->IEBitmap->Origin = ieboTOPLEFT;
IEVisionLib->createImage( ImageEn->IEBitmap->Width, ImageEn->IEBitmap->Height, ievUINT8, 3, ImageEn->IEBitmap->Rowlen, ImageEn->IEBitmap->ScanLine[0], true, IEVImage );
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: