Machine Vision

Showing results for 
Search instead for 
Did you mean: 

Ignoring regions in Color Pattern Match

Hi I am using Color Pattern Match in Vision Assistant blocks to detect small features in an image. I often find myself wishing that you could exclude regions in the same way that you can with the greyscale version Pattern Match.


As an example I need to find small solder fillet features in images of electronic parts. The area of interest is circled below, it is the blue area at the junction of the pin and the pad it is soldered to. Due to colored light sources at varying angles we can determine that a good joint is one where there is a blue band at the junction, since the slope of the solder at that point is angled properly. 




The part is small (3mm-5mm) and because of that It becomes difficult to LOCATE this region among the other features in the area for various reasons:

1) The part packages vary in size between manufacturers, and within a batch as well, so finding and locating the part under the ROI rectangles is not 100% consistent, ie the body might shift say 30% of a pin width in any direction.

2) The geometry of the solder fillet varies because the pads the pins attach to vary in width and shape

3) Part position is not guaranteed due to movement during soldering, placement inaccuracy etc.


So my problem is that within the green detection rectangle, due to variations as described, it can be hard to optically pick up where the edge of the pin is.





What would solve my problem I think, would be if Color Pattern Match had the same ability to ignore areas as greyscale Pattern Match, so that I could make a template that includes the body of the pin (which is much more consistent in position, and contrasty too so the edges can be accurately detected) and then ignore the pin itself, when it comes to the pattern match. 




So as an example I could include the region shown above in the template, and mark it as Ignore, so the pin is located properly, but then the detection region is only the section of the pin shown in the first image.... whew.


I have tried extracting a color plane and using greyscale Pattern Match with region exclusions, but it's too blunt a tool because the colors in the region of interest are gradients and not clearly delineated, and I lose the benefit of factoring in the color range detection that is part of the Color Pattern Match.


In Color Pattern Match template creation there is an Ignore Black and White option, which I could use but I tried to open the template image in Paint and draw in black areas but it didnt seem to make any difference to the detection score at all. I guess that the black has to be there during the learn stage and adding it afterwards makes no difference.


Is there some reason why Color Pattern Match does not allow you to exclude regions of the template like greyscale Pattern Match?

Is there a better way I could be doing this?


Thanks for any advice!




0 Kudos
Message 1 of 5

I would suggest separating your pattern matching and your pass/fail determination.  I would consider one of two options.


The first is to use color pattern matching to find the base of the pins, which is quite easy and doesn't appear to change between good/bad parts.  You then look at a section of pixels offset from the pin base to determine your pass/fail results.


The second option is to make a grayscale copy of the image, perhaps using the saturation or intensity values.  Do your grayscale pattern matching on this image, where you have more options (and it is faster).  Once you locate your pins, use an offset to locate the area of interest and evaluate pass/fail.



Bruce Ammons
Ammons Engineering
Message 2 of 5

if you know how to use labview code there is  way to do it see bellow image 


you can read spectrum of the part that you want to ignore and use for this terminal 
if you have constant electronic parts ( the chip) it is better to use some algorithm to find your pin location you can use of example pattern matching and also OCR for your chip the location of pins toward the chip latter always are constant
so if you find for example P location on chip you have location of all pins
now you can use your algorithm more accurate 
also i think you do not need color matching and you can analyse your system with histogram for line profiles 

Message 3 of 5

Thanks Bruce, I am interested in giving your suggestion a go, specifically "You then look at a section of pixels offset from the pin base to determine your pass/fail results.", but I am not clear how to go about this.

So far I have done all optical manipulations inside Vision Assistant blocks using the various processing steps available there. Could you describe at a high level, the process that I might follow to get a section of pixels offset from the base pin? How would I get the base pin information out of the VA block?

Thanks for any advice.

0 Kudos
Message 4 of 5

I don't know if this is possible with Vision Assistant.  I normally do all my programming directly in LV.  Here is what I would do in LV:


Do the pattern matching search.  You get the coordinates of the center of the pattern.  Add XY offsets to this coordinate to get the corners of the rectangle you are interested in.  Use Rectangle to ROI to create an ROI, then use it to do the analysis you want to do.



Bruce Ammons
Ammons Engineering
Message 5 of 5