[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: perimeter of a blob



Ben Tupper (tupper@seadas.bigelow.org) writes:

> I am looking for an efficient means of finding the perimeter of
> contiguous blobs of pixels within an image.   These blobs are the
> regions returned by the LABEL_REGION function.  I have been using the
> trusty brute-force-and-ignorance appraoch where I scan rows and columns
> within each blob,  recording the min and max coordinates of each
> row/column.   It is a cumbersome task and leaves gaps in certain areas
> (especially concavities in the blob.)

I don't know why I haven't written an article about this,
since this is about the 10th time I've needed to look this
up, but maybe I will. :-)

Anyway, the easiest way to get a perimeter, I think is to
use the Triangulate function. An optional fourth positional
parameter returns the perimeter points. You will probably
have to figure out how to get the 2D indices from the
1D array of indices returned by Label_Region, but *that*
is on my web page for sure:

   http://www.dfanning.com/tips/where_to_2d.html

 IDL> Triangulate, xpts, ypts, tri, boundaryPts

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155