T O P I C R E V I E W |
nitinchandra |
Posted - Dec 10 2011 : 11:56:44 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 |
1 L A T E S T R E P L I E S (Newest First) |
fab |
Posted - Dec 11 2011 : 07:27:16 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 ); |
|
|