How to get a region chain code?

Chintak Sheth chintaksheth at gmail.com
Tue Jul 16 01:03:26 EDT 2013


Hi Valeriy,

Wow a compression technique! That would surely be a great addition.

> I am studying a shape descriptors and would like to compute a chain code
description of a labeled shape. I was trying to look into docs but have not
find a direct way to get this region property with skimage. Is there any
way to do it in a few calls which I missed?
>

- Extract the boundary. `skimage.morphology.erosion` using
`skimage.morphology.disk` structuring element with radius 1. Then subtract
this from the original image.

- Label the boundaries. If you already have a labeled image, then that
saves you a function call else there is `label` function in
`skimage.morphology`.

- Use `np.transpose(np.where(label == 1))` to generate the indices of
pixels marked as label 1. This will return a `list` of indices. You can
simply use the first as the starting point.

This should help set up the stage for the traversal. Hope this helps a bit.

Chintak.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20130716/0c6abe3c/attachment.html>


More information about the scikit-image mailing list