Hello Rajesh,
Pattern matching is designed for use with greyscale images. Thus, a binary image will appear in the template window as a greyscale image with intensities of 0 and 1 when the total range is 0 to 255 (for an 8-bit image). This is why the template appeared to be all black.
In order to do what you have described, I would suggest converting your script into LabVIEW code, where you could store the number of ridge endings and bifurcations (obtained from the Particle Analysis step) and then compare those values to those obtained from future tests.
You could also try performing shape matching where you would pick several key particles that are left after performing the Remove Small Objects step and look for those specific items in subsequent images. If this script were ported over to LabVIEW, you could also keep track of relative coordinate positions and angles between each other.
Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments