Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

OCR examples

The question I posted last week seems to have been removed, so please allow me to try again.

 

I need to develop an OCR application. I've tried using the 2 examples provided in LabVIEW 8.2 but they appear not to run properly, or at least the way they run doesn't make much sense to me. I've also searched for OCR tutorials on the NI site and pretty much drawn a blank, so I am hoping that someone out there can share some examples of how they've done this.

 

Here's a description of what I need to do:

 

Grab image.

Unwrap annular region.

Teach characters - overlaying a box around each found character so I can see what the OCR Train VI is finding.

 

Then...

Grab image

Unwrap

Perform OCR and display the found/read characters.

 

It's actually the Teach part that I'm finding most difficult, so if anyone can share any tips or examples that would be much appreciated.

 

0 Kudos
Message 1 of 9
(6,853 Views)

I would advise to try it out in Vision Assistant. Vision Assistant is an interactive environment that allows to try out all the algorithms provided with the Vision Development Module.

Launch Vision Assistant, open your images. Select the last tab (Identification) and click on the OCR/OCV function (first one in the palette).

The OCR provided with the Vision Development Module is trainable. The first thing you want to do is to create a New Character Set File. Click on that button.

Select the Annulus tool in the toolbar, and draw an ROI around the text you want to read. You don't need to unwrap the image. When you choose the annulus tool, the algorithm does that internally for you. The software draws a bounding box around each letter found. You might need to adjust the parameters at the bottom of the interface.

Enter the corresponding string in the Correct String control, then click the Train button.

Repeat until you have trained all your letters, and until you get perfect recognition when you try it on multiple images.

Click File>>Exit to close the Training interface, or just close the window. Save the Character Set File.

When you go back to Vision Assistant, select the Annulus tool from the toolbar, and draw a region around your characters.

The results appear in the table below.

You can then click OK to insert the step and create the corresponding LabVIEW code (or C or .NET) to see how to implement it in LabVIEW.

The OCR Training Interface that you can call from Vision Assistant is provided as an executable. Start Menu>>Programs>>National Instruments>>Vision>>OCR Training. The help file for the training interface contains a tutorial that guides you through the steps to create your character set file.

 

Hope this helps.

 

-Christophe

0 Kudos
Message 2 of 9
(6,848 Views)

Christophe,

 

That's very helpful, thank you.

 

How about if I want togive my customer an executable - how do I incorporate the OCR Training then?

0 Kudos
Message 3 of 9
(6,840 Views)

Hi,

 

Does the training have to be dynamic for the customer? I mean, do you know the fonts ahead of time? If you use Vision Assistant and can pre-train, you then can generate LabVIEW code and ultimately make an executable.

Jeff | LabVIEW Software Engineer
0 Kudos
Message 4 of 9
(6,815 Views)

Hi,

 

You can redistribute the OCR Training interface with your application.

The files are located in the following folder:

C:\Program Files\National Instruments\Vision\Utility\OCR Training Interface

The NI OCR Training Interface is a LabVIEW application. If you choose to redistribute those files with your application, you will also need to install the LabVIEW runtime engine (version 8.6 if you have VDM 8.6 or 2009).

Your application can use for example the System Exec VI to launch the executable.


Christophe

NI Vision R&D

 

0 Kudos
Message 5 of 9
(6,812 Views)

Jeff,

 

Thanks for the tip. I'll have to give some thought to pretraining - I suppose worst case is that I have to train 26 characters and 10 numbers!

0 Kudos
Message 6 of 9
(6,810 Views)

The number of letters/digits you have to train depend on how different your lighting conditions will be, and how much resolution you have. The OCR algorithm first performs a threshold of the character and it's the binary letter that is fed to the classifier. If your acquisition condition changes, the result of the thresholding will be different and you might need to train the resulting character.

0 Kudos
Message 7 of 9
(6,808 Views)

im looing for a similar application .. your reply was helpful in programming my project ..but i couldn't get the string output from the vision assistant ..could you please help me with it.. i have attached my program files with it..

0 Kudos
Message 8 of 9
(4,821 Views)

Hello vahnini,

 

Due to the fact that this thread is 6+ years old, I would highly recommend that you create a new thread to receive assistance with your particular question. Feel free to refer to this post in your new thread if necessary.

 

Regards,

j_bou

0 Kudos
Message 9 of 9
(4,805 Views)