[Insight-users] Transform the contour from image to chaincode
Jiang
jiang at TI.Uni-Trier.DE
Thu Jul 22 09:50:10 EDT 2004
Hi, all,
By some filters of itk, I get one closed contour as one image. This
image is one binary image that
the pixel value is 100 when is pixel is in the contour, otherwise it is
0.
Now I want to convert this contour to ChainCode. My pseudocode is as
follow:
Search the image from the first pixel to find the first point in the
contour;
Add this point to ChainCode list, and set its value to 0;
Search the immediate neighbors of of this point to check if it is on
contour;
If this point's value==100;
{ Add it to ChainCode, and set its value to 0;
Loop searching
}
else
Stop searching;
Finish the ChainCode;
// The order of checking neighbors. Assume the current points is at "0".
// ------------------------
// | 5 | 3 | 8 |
// |-------------------------|
// | 1 | 0 | 2 |
// |-------------------------|
// | 7 | 4 | 6 |
// -----------------------
This searching method works, but not always. Sometime, it stops at
somewhere, but the contour is
not completed. And the stopped point is not different as other found
points. I even enlarge the
neighbourhood to a bigger circle. But it is still not stable.
Maybe my question is beyond the range of this itk maillist. I'm really
upset with this problem.
Who can give me some suggestions?
Thanks a lot!
Jiang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20040722/db484785/attachment-0001.htm
More information about the Insight-users
mailing list