3 Replies - 9702 Views - Last Post: 05 April 2011 - 10:54 AM Rate Topic: -----

#1 cheenz87  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 25-July 07

OCR using MODI (Microsoft office document imaging)

Posted 05 April 2011 - 09:47 AM

Hello members ,

I m using a C# windows application in which I need to scan an image of plate number of vehicle and convert that image into corresponding text , for this I m using optical character recognition using Microsoft office document imaging type library 12.0 .
I m keeping in mind that MODI needs a tiff/mdi image as an input and I m also including the reference of MODI type library in my project.
here's my coding -

try
            {

                MODI.Document md = new MODI.Document();
                md.Create(@"c:\339.tif");
                md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, false, false);
                MODI.Image img = (MODI.Image)md.Images[0];
    MessageBox.Show(img.Layout.Text);
}

catch (Exception ex)
{

string ex1 = ex.ToString();
                MessageBox.Show(ex1);
}




the above coding is on the click of a button on a windows form , the error that I m getting is -

System.Runtime.InterOpServices.COMException(0xC6C8111A) IO Error at MODI.DocumentClass.Create()


Also , if I change the picture , the IO Error is converted into the error like - Binary File corrupted.

Is This A Good Question/Topic? 0
  • +

Replies To: OCR using MODI (Microsoft office document imaging)

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5675
  • View blog
  • Posts: 12,192
  • Joined: 02-June 10

Re: OCR using MODI (Microsoft office document imaging)

Posted 05 April 2011 - 10:34 AM

tif has a lot of options including compressing and support for different color spaces.My link

If it were me, I'd make several variants of the photo using Photoshop to find the specific needs:

  • RGB with LZW compression
  • without
  • CMYK with and without
  • etc.


Going over the documentation for MODI a couple more times can't hurt. There is a lot of it. There is probably some fine print somewhere that can shed some light on the requirements of the image.
Was This Post Helpful? 0
  • +
  • -

#3 cheenz87  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 25-July 07

Re: OCR using MODI (Microsoft office document imaging)

Posted 05 April 2011 - 10:46 AM

Oh yes , i went through the help documentation of MODI that stated about what are the variants of images that are not supported by OCR/MODI ... I tried making a tiff image in paint ( a vehicle number plate ) and used that as an input to the above mentioned coding , it worked and there was no error (but that will not solve my purpose in any case as I need pics of real number plates)
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5675
  • View blog
  • Posts: 12,192
  • Joined: 02-June 10

Re: OCR using MODI (Microsoft office document imaging)

Posted 05 April 2011 - 10:54 AM

Great analytical problem solving.
It proves a couple things.
  • You know your code works with a properly formatted tifs
  • You know the photos are not properly formatted tifs


So now you need to discover what is wrong in the formatting of the actual photo. I don't think Paint is going to be adequate for this task. You need to be able to change color depth, color space, compression options and so on.

At the very least you might have to pre-process the incoming photos by opening them programmatically into a Bitmap object, then resave them as a propertly formatted tiff in another directory.

This would probably help with workflow as well. Your application could watch for new photos in c:\RawPlates\ pre-process them and save them into c:\FormattedPlates\ then another thread sees the new photo arrive in c:\FormattedPlates\, does the OCR and saves the finished item in C:\ProcessedPlates\

This would give you an understandable workflow, as well as the ability to recover in the event of a power outage or program crash, and a built-in queue for when 10,000 plates arrive all at once. It also breaks up the big job into smaller desecrate tasks that can be farmed out well to multiple threads or parallel tasks for multi-core PCs.

This post has been edited by tlhIn`toq: 05 April 2011 - 10:56 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1