You should try OpenCV, which has bindings for python. It has functions to perform many tasks related to this, including thresholding an image, and finding and labeling blobs. I think it can even returns lists of blob centroids... I don't know if you have lots of points in each image, but you may also take a look at the kd-tree classes in scipy for finding the matching points in the images. I started using it the other day for something similar, and it's a breeze! ++nic On Mon, Apr 18, 2011 at 03:37:51PM -0700, Chris Weisiger wrote:
(As you may recall from previous threads, my current project involves aligning two arrays of pixel data that were taken from slightly different perspectives)
In an attempt to quantify the accuracy of the alignment I've obtained, I want to do some centroid analysis. The images I'm working with are of "beads" (very small fluorescent blobs), thus each 512x512 image is of a number of more-or-less circular islands each on the order of 50 pixels or so. I figure that I can threshold each image, identify distinct islands, get their centroids, map those to centroids in the other wavelength, and thus get the distance between centroids, which should be a good absolute measure of alignment quality.
I can hack something together to do this easily enough, where I find a pixel in one of the islands, flood-fill out to get all connected pixels, calculate the centroid, flip the pixels to 0, and repeat until all islands are gone. This isn't exactly very speedy though. What's the efficient way to do this? Is there one? Is there a better approach I should be taking? The image processing class I dimly remember taking years ago didn't cover this kind of thing, so I'm lacking even the basic vocabulary needed to search for algorithms.
-Chris
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
-- Nicolau Werneck <nwerneck@gmail.com> C3CF E29F 5350 5DAA 3705 http://www.lti.pcs.usp.br/~nwerneck 7B9E D6C4 37BB DA64 6F15 Linux user #460716 "There is only one corner of the universe you can be certain of improving and that is your own self." -- Aldous Huxley