Re: Grow binary mask by pixel (to find localized background in image)
- From: Peter Boettcher <boettcher@xxxxxxxxxx>
- Date: Tue, 11 Apr 2006 11:30:36 -0400
mael.iosa@xxxxxxxxx writes:
Hello,
I have some images with amorphous blobs in images that I call
"targets". These targets can be non-contiguous collections of smaller
concave blobs. Each of these images have an associated binary mask,
with the background in black and the target in white. I need to
calculate the contrast between the target and the local background, so
what I'd like to do is grow the white pixels in the mask outward pixel
by pixel. What I'm looking to achieve is very similar to what the
"Grow" command in GIMP or Photoshop does.
So my first thought was to loop over each row and column of the mask,
and each time a transition occurs (i.e. 1->0 or 0->1), change the value
of the appropriate matrix element to 1. Something like:
If you have the image processing toolbox, see imdilate and related
morphological processing functions.
If you do not, you can rig something up using filter2, and
rethresholding. Something like:
expanded = filter2(ones(3), im);
expanded_binary = (expanded > 0);
--
Peter Boettcher <boettcher@xxxxxxxxxx>
MIT Lincoln Laboratory
MATLAB FAQ: http://www.mit.edu/~pwb/cssm/
.
- Follow-Ups:
- References:
- Grow binary mask by pixel (to find localized background in image)
- From: mael . iosa
- Grow binary mask by pixel (to find localized background in image)
- Prev by Date: Re: Report Generator tables, cell alignment broken?
- Next by Date: Re: Java and classpath.txt
- Previous by thread: Grow binary mask by pixel (to find localized background in image)
- Next by thread: Re: Grow binary mask by pixel (to find localized background in image)
- Index(es):
Relevant Pages
|