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
 Preparing image for OCR
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

EricNat

USA
37 Posts

Posted - Oct 05 2011 :  11:25:18  Show Profile  Reply
Prior to 4.0, I did the following to prepare an image for OCR (passing the TIFF image into another library) --

OCRImage->Proc->Resample(OCRImage->Bitmap->Width*2,-1,rfLanczos3);
OCRImage->Proc->ConvertToGray();
OCRImage->IO->Params->TIFF_Compression=ioTIFF_UNCOMPRESSED;
OCRImage->IO->SaveToFileTIFF(TIFPath);

This worked fine to upscale the image by 2x, convert it to gray, and save it as an uncompressed TIFF. But after upgrading to 4.01, the image that gets saved is corrupt. If I change rfLanczos3 to rfNone, it works. What am I doing wrong here? It will let me save it as another format.

Also, do you think Lanczos3 is the best algorithm to use for upscaling an image that contains text to be OCR'd?

Thanks for your help.

fab

1310 Posts

Posted - Oct 05 2011 :  13:52:01  Show Profile  Reply
You should also set BitsPerSample and SamplesPerPixel. For example, if you want an 8 bit gray scale image you should write:

OCRImage->IO->Params->TIFF_Compression = ioTIFF_UNCOMPRESSED;
OCRImage->IO->Params->BitsPerSample = 8;
OCRImage->IO->Params->SamplesPerPixel = 1;


quote:
Also, do you think Lanczos3 is the best algorithm to use for upscaling an image that contains text to be OCR'd?


In my opinion (and in my knowledge developing also IEVision, our future OCR plugin) upscaling as step for an OCR doesn't enhance quality of results. It is just a interpolation, it doesn't add information to the image. It is best to acquire the once high-resolution image to upscale it later.
Go to Top of Page

EricNat

USA
37 Posts

Posted - Oct 05 2011 :  14:37:16  Show Profile  Reply
Thanks! That did the trick. I appreciate the help.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: