Re: Grow binary mask by pixel (to find localized background in image)



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/
.



Relevant Pages

  • [3/5][POWERPC] boot: use more Kbuild rules
    ... Switch to if_changed_dep for bootcc, cmd for known rebuilds without deps, ... Move clean-files to targets for if_changed files. ... # as well as the ELF images. ... $/vmlinux.bin: vmlinux FORCE ...
    (Linux-Kernel)
  • Re: Fact -- a useless concept
    ... capture images of them? ... We are not observing the atoms, molecule, and viruses directly. ... the targets themselves. ... targets depends the images and on our understanding of the theories of ...
    (talk.origins)
  • Re: Fact -- a useless concept
    ... Atoms, viruses, etc. are elements of theories. ... capture images of them? ... the targets themselves. ... If we discovered that our understanding of ...
    (talk.origins)
  • Re: Walter Zorns wz_dragdrop
    ... rendering images. ... the *actual* positions of the drop targets ... setInterval with a function that includes all the code for calculating ...
    (comp.lang.javascript)