LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

filter for OCR

Hi everybody

I am reading letters and numbers by using OCR. I attached sample picture (Figure1). because my pictures are  an edge detection output, they have noise in their background. 

Because my ocr recognition is unsuccessful(Figure 3), I want to clear their background ( become Figure 1 to Figure 2 ).

I guess my solution is use filter.

please help me.

Thank you 

Download All
0 Kudos
Message 1 of 10
(4,116 Views)

Are you using Vision Builder for Automated Inspection, or just the Vision Module VIs alone? If you can get access to VBAI, it's a great way to try out different filters to see what works. Using the native VIs takes a while to make adjustments, but VBAI lays it all out and makes it easy to manipulate.

 

You probably don't need a filter since your image is already cropped to the size of your numbers. Having only the number in the image makes it way easier. I used to have to deal with a whole bunch of other shapes in the image that it would be try to recognize as numbers and that was a headache.

Try toying with the inputs to your OCR VIs for character size limitations. That helps the algorithm split off the blobs in to their separate numbers and would definitely split up your "69" blob Smiley LOL and get rid of that little mini-character blob.

You can mess with these properties using the OCR Property VI if you need to do it with the native VIs.

 

Set the valid characters so it's not looking for letters when all you care about is numbers.

The filter it runs is a threshold filter and has some smarts behind it. Set the type of filter using the Threshold Data VI. You probably want Uniform (1) mode.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 10
(4,040 Views)

Dear james

Thank you very much for your reply.

 

Best regards

Tandis

0 Kudos
Message 3 of 10
(3,986 Views)

Did my advice help you get the OCR to work?

 

If it worked, please mark as solution so that others who need help with a similar OCR problem will be able to find this thread and see the solution.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 10
(3,967 Views)

Can u tell me which type of filter u have used?

0 Kudos
Message 5 of 10
(3,930 Views)

I've used four of IMAQ Morphology VI (POpen - PClose - POpen - PClose) and I got the result shown in Figure 1. I guess if I tried to get a better result. but I have a problem. IMAQ OCR Read Text 4 VI is in its input images (Grayscale (U8) - RGB (U32) - HSL (U32)). my output before IMAQ OCR is Grayscale (U16) and I get  an error (Invalid image type). when I change the type of image of the Grayscale (U16)  to Grayscale (U8), I'd lost image data! 

I guess as James said, the OCR Property VI and  the Threshold Data VI can help me a lot to do. but before that I have to solve this error.Untitled00.png

0 Kudos
Message 6 of 10
(3,881 Views)

The IMAQ Read Text VI only takes in an U8 image. This is because it can only decipher a black and white image, so it doesn't need any more depth past that. Your characters are trained with black and white characters so you're using U8 already whether you like it or not.

 

You say you are losing image data, which is true in a way, but you actually want to control that data "loss" to filter out the data that you don't want to get more accurate read rates. Toy around with all of the filters to get what you want without losing any of the important parts of the numbers. Your image is pretty dang clear so it shouldn't be too hard to use OCR.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 7 of 10
(3,834 Views)

Dear James

My filter output is 8-bit binary image. OCR work with 8-bit grayscale image. I don't know how to convert 8-bit binary image to 8-bit grayscale image?!!

 

Best regard

0 Kudos
Message 8 of 10
(3,801 Views)

To convert binary to grayscale image, I think you could use the IMAQ Equalize VI.

0 Kudos
Message 9 of 10
(3,759 Views)

I multiplied a white image(255 value) on the original image. I get result. my image is grayscale now.

 

Thank you very much

 

0 Kudos
Message 10 of 10
(3,723 Views)