How to OCR a specific region of a MODI.Document?

Posted by Mark Kadlec on Stack Overflow See other posts from Stack Overflow or by Mark Kadlec
Published on 2011-03-05T06:44:28Z Indexed on 2011/03/05 7:25 UTC
Read the original article Hit count: 283

Filed under:
|
|

I need to OCR a specific region of a scanned document and I am using MODI (Microsoft's Document Imaging COM object).

My code currently OCR's the entire page (quite accurately!), but I would like to target a specific region of the page where the text is always static (order number). How can I do this?

Here is my code for the page:

MODI.Document md = new MODI.Document();

md.Create("c:\\temp\\mpk.tiff");

md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
MODI.Image image = (MODI.Image)md.Images[0];

FileStream createFile = new FileStream("c:\\temp\\mpk.txt", FileMode.CreateNew);

StreamWriter writeFile = new StreamWriter(createFile);
writeFile.Write(image.Layout.Text);
writeFile.Close();

md.Close();

Can I somehow specify the region of the image?

Any help would be greatly appreciated!

© Stack Overflow or respective owner

Related posts about .NET

Related posts about ocr