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

Re: perimeter of a blob

Dear Ben, if you just need the indices and not the indices in order around
the perimeter then you could use an imaging method like this:

    a = your image; assume it is one blob and has value 255 as object
otherwise 0
    bb = convol(a, replicate(1,3,3), 9, /center); change the kernel if you
want some other connectivity
    edges = where(bb gt 0 and bb lt 255); these are edges of your blob both
inside and out

    bb[*] = 0
    bb[edges] = 255 ; make this new image just edges
    bb = A AND BB ; now keep just those edges inside your object
    perimeter = where(bb eq 255); these are indices to final outline

I think this works - does at least on dumb test images. If you want them in
order then I guess you could trace around with a maze-search algorithm. Big
disadvantage is that you need to isolate a blob at a time, I think.
Interested to hear if it works around all your corners.


Richard J Adams            }<}}}}>              e: r.j.adams@bath.ac.uk
MRC Senior Research Fellow                    t: +44 1225 826436
Department of Biology and Biochemistry   f: +44 1225 826779
University of Bath, Bath, BA2 7AY, UK