Machine Vision

Showing results for 
Search instead for 
Did you mean: 

NI Vision Builder AI program building - Inspecting colored solution on the card

Go to solution

Using the NI Vision Builder AI.


How do I create a program for this inspection as a fail.


The blue solution spillage can be anywhere on the card****


N1 - Front (dft 5) - Copy.jpg

Below is the image of an accepted card. The blue solution should be only inside of the black ring.



0 Kudos
Message 1 of 7
Accepted by topic author Meliosha

I do not have vision builder AI, and use the Vision Development Module.  Vision Builder AI does not have all the bells and whistles but you should be able to identify the precise location of the three circular targets, and mask those areas from being inspected.  From there you can count the number of pixels that match the blue color, and if that number is bigger than your set point, the card can be rejected.


Pixels of a specific color can be grouped into blobs, if location information is necessary.  


Good luck!



0 Kudos
Message 2 of 7

Kind of good idea, only problem right now is since the captured image is not consistent. The color can be light and dark blue so it is hard to set the color for the pixel image.


Also think the vision builder is more limited than I think when it comes to color inspection compared to inspection in monochrome since I couldn't find the blobs features that you mention

0 Kudos
Message 3 of 7
Accepted by topic author Meliosha

You need to look at colours differently. You are thinking in RGB, try using Hue, Saturation and Intensity. Your Hue should be consistent(which colour it is), saturation should be fairly stable(how deep the colour is) and Intensity should vary(how light/dark the colour is)

Working in a different colour space should allow you to see the blobs of blue.

0 Kudos
Message 4 of 7

AgiMikeB is correct. HSL space is much better for finding colors that might vary in "intensity". the card you are using is essentially black and white, so color isolation should be pretty robust.

0 Kudos
Message 5 of 7

Works great on the blue color


I do have another question, the solution can turn into pink when exposed to humidity. But the problem for this it is hard to set it to detect the light pink color due to the white color of the card background. Do you know any method to only able detect the pink color whether it be the software or the hardware such as lighting and camera.


Currently using ring light and a 20MP colored camera 


Second picture is the best setting I could get.


N1 - Front.jpg



I am planning to use a dark background behind the card so coudd tackle that but somehow it detect some parts on the card if you zoom to the picture 


Pink detection.PNG

0 Kudos
Message 6 of 7

Use the image buffer to store your colour image.

If you use the Intensity plane to find the dark black circles, then use the binary morphology to fill holes.

Erode the image to make the now white circles slightly smaller and then mask your colour image with our eroded one.
You should now only have the circles of interest.

Detect your pink or blue in there.

Sorry I don't have VBAI to try this out for you




0 Kudos
Message 7 of 7