[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Contours driving me mad
- Subject: Contours driving me mad
- From: Alex Schuster <alex(at)pet.mpin-koeln.mpg.de>
- Date: Wed, 29 Nov 2000 15:12:09 +0100
- Newsgroups: comp.lang.idl-pvwave
- Organization: Max-Planck-Institut fuer neurologische Forschung
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:22355
Hi!
I am having trouble extracting contours from binary images. The images
contain the result of a search2d operation, the contour is extracted,
and the pixels inside the contour should be exactly those of the image.
That is: max( where( image ) - polyfillv( contx, conty, dim, dim ) ) eq
0 (assuming there are no holes inside).
My first approach was using an old routine I had written. I use the
roberts filter to get a contour image, march in one direction until I
find this contour line, and then follow it, creating the contour. This
works well for most cases, but sometimes my algorithm fails to get a
correct closed contour.
I also do not
I now switched to IDL's contour routine. It works better than mine in
finding closed contours, but has other problems. The results of where(
image ) and polyfillv differ, the image which I get from the contour is
one pixel smaller to the left and to the right than the original image,
but okay in the y direction.
Maybe a combination of erode and dilate would eliminate those pixels, I
will try this next. But maybe someone already did such a thing before?
The goal is that the user clicks at one location in an binary image, and
gets the contour of the area. Holes inside this area should also be
detected and contoured, that is what gives me trouble now, as the
difference image does not only contain the holes, as also many pixels at
the sides of the object.
Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de