Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Display image particles using specific colors

I would like to color specific objects in my image the same color and other specific objects another color, etc. The objects are very similar but there is enough info in ComplexMeasure to tell them apart.

I can find all the particles (objects) with IMAQ ComplexParticle and IMAQ Label will label all the individual particles but with all different arbitrary colors.

I can't use the Overlay functions as my particles are not rectangular or circular so the Global Rectangle info that ComplexParticle gives doesn't help.
Right now, I'm taking the center of mass (x,y) from ComplexMeasure and feeding it to MagicWand, creating a mask with which I call IMAQ Fill with the desired color. This doesn't always work, though. Sometimes
MagicWand selects the whole image or nothing resulting in a bad mask even though the Label & ComplexParticles vis have found all the individual particles.

Is there an easier way to do this? IMAQ Particle Filter would be exactly what I need if I could specify a color in place of Keep/Remove Particles.

Thanks.
0 Kudos
Message 1 of 3
(3,175 Views)
From IMAQ ComplexParticle, you should be able to create a list that has each particle number and what type of object it is. For example, if you have two object types (1,2) and 5 particles, they might be as follows:

1 -> 2
2 -> 1
3 -> 1
4 -> 2
5 -> 1

If you add a zero at the beginning of the second column and pad it with zeroes to get a 256 element array, you can use it as a custom lookup table. Apply it to your labeled image, and it will color code your particles by object.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 3
(3,175 Views)
TS9 -

Another idea to try would be to use IMAQ Particle Filter to keep only the particles you want in a separate image, and use that image as the mask image for IMAQ Fill - that would be more accurate than using IMAQ MagicWand.

Greg Stoll
IMAQ R & D
National Instruments
Greg Stoll
LabVIEW R&D
0 Kudos
Message 3 of 3
(3,175 Views)