Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

OCR in NI Vision

How can i simultaneously read 2 lines of text, whil using NI Vision? I have already created a character set file, sufficient for my use. My basic aim is to recognise characters from a licence plate(Indian). Another doubt i have is that the image taken from CCD camera is RGB, how to convert it to binary?
0 Kudos
Message 1 of 10
(4,457 Views)

Hello ds.raikkonen,

If you are trying to read two different lines of text, you should be able to create two distinct ROIs and perform an OCR on each.  You can also look at the OCR examples that come shipped with Vision in the LabVIEW Example Finder by searching for "OCR".  In regards to the RGB images, there are a couple of Vision functions in LabVIEW that you should be able to use.  I would suggest looking into either the "IMAQ Color Treshold" VI which applies a threshold to the three planes of an RGB or HSL image and places the result into an 8-bit image or the "IMAQ ExtractColorPlanes" VI which extracts the three planes (RGB, HSL, HSV, or HSI) from an image.  You can then set the image type of the planes to be 8-bit which should suffice.  There is more detailed information regarding these functions available in LabVIEW VI Reference Help.  Please let us know if you would like further clarification or assistance regarding this issue.

Vu

Message Edited by Vudoo on 05-15-2007 11:06 AM

0 Kudos
Message 2 of 10
(4,435 Views)
Hi! thanks for the reply. I sorted out the RGB to binary problem, but still have doubts about the 2 ROIs. By creating 2 distinct ROIs , do you mean to say that one ROI after the other or club them both? From what ive seen is that whenever I try to enclose two lines in the same ROI, it takes 2 characters at once, one from the upper line and one from the lower line. How can I club two ROIs? Is there some bundle function for them too?
0 Kudos
Message 3 of 10
(4,417 Views)
I'm glad to hear the RGB issue has been resolved. I would suggest creating two seperate inspections (one ROI/OCR for each line).  Once you have the two resulting strings, you could use the "Concatenate Strings" VI which concatenates input strings into a single output string.  Again, you can find more detailed information regarding this particular function in the LabVIEW Help. 

Message Edited by Vudoo on 05-16-2007 06:03 PM

0 Kudos
Message 4 of 10
(4,398 Views)
Thanks Vudoo, I ll do that. Another thing is that is it possible to recognise the characters without making the ROI manually? Can the program make it automatically in the image taken?
0 Kudos
Message 5 of 10
(4,390 Views)
...and, how can I append the recognised characters to a text file using the write to spreadsheet function?..Till now, Iam able to write only one recognised string on a text file, unable to append any more.
0 Kudos
Message 6 of 10
(4,387 Views)
Hello ds.raikkonen,

To answer your first question, if you go to http://www.ni.com and search for "ROI programatically", the resulting link 

Changing Camera Configuration Programatically   has an example that sets the ROI window programatically. 

To answer your second question, if you look at the context help for the "Write to Spreadsheet" function in LabVIEW (open the help with Ctrl+H), you should see an input for "append to file?".  By default, as it shows, this value is set to false which creates a new file each time this function is called.  If you wire a true boolean constant to that input instead, you can append to the file that you declare.  This is explained in the detailed help for this VI.  Again, I would suggest utilitizing the LabVIEW Reference Help and our online documents for questions as these are both very useful resources. 

Message Edited by Vudoo on 05-18-2007 08:01 AM

0 Kudos
Message 7 of 10
(4,371 Views)
1.Is it possible to scale the image after snapping it, so that the programmatically made ROI can read anything.
2.The problem im now facing is that when i try to save it as a .txt file, only the numerical part of the recogized till the first alphabet are stored, as soon as the first alphabet is encountered, the rest of the recognized characters(including that alphabet) arent stored. Please help.Thanks.

Message Edited by ds.raikkonen on 05-23-2007 04:48 AM

0 Kudos
Message 8 of 10
(4,321 Views)
First off, since we are veering further away from the original post, I would like to suggest creating a new thread for your issues.  For future reference, we like to keep a limit of one issue per thread.  To answer your questions.

1.) There is an "IMAQ Resample" VI which resamples an image to a user-defined size. You can use this VI to display a reduced or enlarged image.
2.) If you are using the "Write to TextFile" VI, make sure that you are sending just a string.  You can test this by just creating a string constant and verifying that it correctly creates a txt file as I have done in the attached screenshot. 

If you would like further assistance, as I mentioned, please create a new thread for this and future issues which are not directly related to the initial post.  Thank you.

Regards,

Vu
0 Kudos
Message 9 of 10
(4,297 Views)
Thanks again Vudoo, ill try that & yes, ill make another thread for the new topic.
0 Kudos
Message 10 of 10
(4,287 Views)