05-18-2009 11:02 AM - edited 05-18-2009 11:04 AM
How do I remove the particle(s) that do not match the reference image exactly?
-Branson
Reference Image
Modified Image
05-18-2009 01:32 PM
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
05-19-2009 01:21 PM
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
05-19-2009 08:34 PM
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
05-20-2009 07:59 AM - edited 05-20-2009 08:00 AM
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 ![]()
-Branson
05-21-2009 12:30 PM
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
05-21-2009 12:39 PM
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.
05-21-2009 01:05 PM
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
05-22-2009 09:54 AM
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