Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Pattern match in vision with a masked region

I want to be able to do a pattern match with a non-rectangular template, or to put another way, I want to be able to mask out some of the template, i.e. ignore parts of it.  By way of an example, I want to find a circle with a white edge, but the color in the circle I don't care about, so I want to mask the inside of the circle out of the pattern matching.  Any ideas anyone?
0 Kudos
Message 1 of 26
(6,338 Views)

Hi,

I try to do something like that. I just have mask the region with the mask function (My pattern is an annular in an image).
The pattern matching is based on the correlation. The correlation mathematical formula uses the intensity level. So, if the intensity level is to 0, the current score will be 0. (<-Never mask anything with a white circle)

So if you just want to perform a pattern matching with a non rectangular template, just mask it...

Simply you could try it with the Vision Assistant.

Message 2 of 26
(6,323 Views)
Hey ADL,
 
To expand on what Fanfoue had said, it will be possible to detect what you are wanting to detect.  By any chance are the images you are working with grayscale or color?  The image processing can be a little more complex if they are color images.  I would suggest starting out in Vision Assistant if you have that at your disposal.  Vision Assistant is very user friendly and easy to learn and prototype with. 
 
As long as the background is of a contrasting color from the white circle edge, you shouldn't have any problems detecting the white of the circle.  You can also use a mask to ignore the parts of the image that you do not care about.  It may be possible to binarize the image so that any color above a certain threshold is written to a 1 and below the threshold is 0. (white = 0 and anything not white = 1)  This would help you in detecting the circle's edge.  If it's possible, could you post a sample image of what you are wanting to process?  This would help in determing the best way for you to write your image processing loop.
 
I hope some of this helps but let me know if I can be of service to you further!
 
Thanks,
 
 
Evan D.
Installer R&D
National Instruments
0 Kudos
Message 3 of 26
(6,301 Views)

Hi there,

I'm interested by this problematic!

The idea of black masking regions on a template is appealing.  

However I don't think it's working:

The algorythm used by the pattern matching are based on "normalized cross correlation"

The mathematic formula can be found in a NI manual.

What I understand is that the intensity value of a pixel in the template is "normalized" by the average pixel value of the template;

Therefore black pixels do have an influence in the cross correlation procedure (no such thing as a zero multiplication!)

 

Can someone comment on this?

Is there any thing new on the subject of non rectangular templates?

 

Best regards

0 Kudos
Message 4 of 26
(5,978 Views)

One more thaught on the subject:

Reading the IMAQ VIsion Concepts manual chapter 12 pattern matching

The pattern matching algorythm resample the template image in order to increase the speed of the process.

For this it use a "non uniform" sampling or "inteligent" sampling, The idea is to extract salient pattern of pixels.

 

Going back to the idea of black masking areas in a template image:

I'believe the border of the mask will be regonized as "a salient pattern of pixels".

Once again, I don't think masking portions of a template is a valid strategy!

 

anyone?

 

have a nice day

 

0 Kudos
Message 5 of 26
(5,956 Views)
When you say that you don't think that it's working is that because you have tried it in the Vision Assistant and your pattern is not being recognized? Is it finding patterns in the black masked areas? Please expound on the proceedure that you are taking to determine if this is working or not.
Vince M
Applications Engineer
0 Kudos
Message 6 of 26
(5,932 Views)
Support for masks when learning a template is one of the new features of Vision Development Module 8.6.

Ben Parrott
Vision R
0 Kudos
Message 7 of 26
(5,927 Views)

Dear Vince

I'm using Ni vision development module 8.5.

I was trying to reduce the influence of a inconstant shadow in a pattern matching application.

Having read the beginning of this thread, I have tried to black mask the problematic portion of the image template.

This operation resulted in worst results.

I had the impression that in some case of ill placement of the found pattern the border of the masked regions influenced the result as it is a well contrasted zone.

Reading the manual I figure out it is probably normal due to this "inteligent sampling" of the template image.

 

This is my experiment on the subject. 

 

have a nice day

0 Kudos
Message 8 of 26
(5,906 Views)

To Ben:

Smiley Happy

cool!

 I will upgrade to 8.6  the next time I break my leg

Thank you and have a nice day

Message Edité par PiF le 11-05-2008 01:32 AM
0 Kudos
Message 9 of 26
(5,906 Views)

I don't think I explained the problem clearly enough.

 

I have a item that I want to look for that is round in shape (e.g. a ball), but on the ball is a large logo, but it differs for different companies.  There is a conistent check type pattern that I want to be able to match on the ball, and the ball outline itself, but I want to mask out the logo area.  If I try and undertake a pattern match with the logo area included, then I will have to lower the score to too low a level which will make the system useless.

 

The logo area will always be in the same spot, so is it possible to have a pattern match with the logo area masked out. I need the logo area to not be part of the score of the pattern match.

 

Hopefully that defines the problem more clearly.

 

Just FYI, I can't change other things, I don't know where the ball is, but I do know the orientation.

0 Kudos
Message 10 of 26
(5,786 Views)