[SciPy-User] Finding islands and centroids
Luis Pedro Coelho
luis at luispedro.org
Wed Apr 20 08:52:43 EDT 2011
On Monday, April 18, 2011 06:37:51 pm Chris Weisiger wrote:
> 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.
You can probably do it in one go:
1) convolve with a Gaussian of roughly the size you expect the PFS of the
beads to be.
2) threshold to get the beads. You can probably use a method like
mahotas.threshold.otsu to do this automatically
3) scipy.ndimage.label to label the binary image
4, optional) remove noise by removing detections that are too small
5) find centroids of the remaining areas.
HTH
Luis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110420/79e75f8b/attachment.sig>
More information about the SciPy-User
mailing list