How to OCR a specific region of a MODI.Document?
- by Mark Kadlec
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!