Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

When comparing 2 binary images that both contain particles, I want to remove the particles that don't match.

How do I remove the particle(s) that do not match the reference image exactly?

  

-Branson 

 

Reference image  Reference Image

 

Modified Image  Modified Image

Message Edited by Branson on 05-18-2009 12:04 PM
Download All
0 Kudos
Message 1 of 9
(4,603 Views)

This sounds like a good application for a golden template.  Train your first image as the template, then use it to compare to the second image.  It will highlight all the pixels that don't match exactly.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 9
(4,589 Views)

Hey Branson,

 

I agree with Bruce. This does sound like a good application for the golden template. Check out the Vision Concepts Manual (Chapter 17) for more information on golden templates.

 

Hope this helps.

 

-Ben

Hope this helps.
-Ben

WaterlooLabs
0 Kudos
Message 3 of 9
(4,563 Views)

If the golden template is overkill, try using the AND function on the two images.  It will remove all pixels that are not common to both images.  Of course, both images need to be binary with values of only 0 and 1.  Is that what you want?

 

With a very brief question, it is sometimes difficult to guess what you are looking for.  When there is more detail, we can make better suggestions that are more helpful.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 9
(4,550 Views)

Yes, you can assume that these images are Binary Images.  I want to be able to compare the Reference Image with the Modified Image to separate the particles that have changed or have not changed....I did an example in the all powerful Paint!  But it's too slow for my app Smiley Happy

 

-Branson

 

Message Edited by Branson on 05-20-2009 09:00 AM
0 Kudos
Message 5 of 9
(4,535 Views)

Now I am not sure if golden templates will do what you want.  I would still look at them carefully, though.

 

Here is a possible solution:

 

For the template image, use particle analysis to get a list of basic measurements (centroid XY, area, etc.)

 

Do the same for the new image.  For each particle in the new image, compare the measurements to all the particles in the original image.  If any of the particles match to your tolerances, it stays.  If it does not match any particles, reject it.

 

If you want to actually remove the particles from your image, you could use Classify?? to number the particles, then create a lookup table with 1 for keep and 0 for reject.  Apply the lookup table to the numbered particles.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 6 of 9
(4,505 Views)

I've never used Classify before, I'll have to read up on that and try some samples.  I was also thinking about IMAQ Add the two images and removing any particles that had a pixel value of 1 and 2 in the particle, and keeping the ones that only had pixel values of 2... but I don't know of any functions in the IMAQ package that sort by pixel value.

0 Kudos
Message 7 of 9
(4,503 Views)

Sorry, I meant IMAQ Label.  I was just too lazy to look it up the first time.

 

In real life, you can't expect the particles to be 100% identical.  If you are taking a picture and thresholding it, there will always be a few pixels that change value even when the subject has not changed.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 8 of 9
(4,500 Views)

Hey Branson,

 

In your last post where you mentioned you could add the two images and then just filter out all the pixels with a value of 0 or 1, you could do another threshold. You  can threshold the two images you with to compare so that your two images so you have two images with pixel values of 0 and 1. Then add them so you have a single image with pixel values of 0, 1 or 2. Finally, you could do another threshold of your final image and simply look for the 'light' values and simply set your cut off at a pixel value of 2 to filter out all the pixels with a value of 0 or 1. This is kind of a crude method, but it should work out for you.

 

Hope this helps.

 

-Ben

Hope this helps.
-Ben

WaterlooLabs
0 Kudos
Message 9 of 9
(4,477 Views)