"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "help/en_US/bwdist.xml" between
sip-0.5.6.tar.gz and sip-0.12.1.tar.gz

About: SIP (Scilab Image Processing) toolbox to do imaging tasks such as filtering, blurring, edge detection, thresholding, histogram manipulation, segmentation, mathematical morphology, color image processing, etc.

bwdist.xml  (sip-0.5.6):bwdist.xml  (sip-0.12.1)
<?xml version="1.0" encoding="ISO-8859-1"?><refentry xmlns="http://docbook.org/n s/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.o rg/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://doc book.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="bwdist">< info><pubdate>February 2004</pubdate></info><refnamediv><refname>bwdist</refname ><refpurpose>distance transforms</refpurpose></refnamediv> <?xml version="1.0" encoding="ISO-8859-1"?><refentry xmlns="http://docbook.org/n s/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.o rg/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://doc book.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="bwdist">< info><pubdate>February 2004</pubdate></info><refnamediv><refname>bwdist</refname ><refpurpose>distance transforms</refpurpose></refnamediv>
<refsynopsisdiv><title>Calling Sequence</title><synopsis>[dt [, label]] = bwd
<refsynopsisdiv><title>Calling Sequence</title><synopsis>dt = bwdist(img [,al ist(img [,algorithm, max_dist])</synopsis></refsynopsisdiv>
gorithm])</synopsis></refsynopsisdiv>
<refsection><title>Parameters</title> <refsection><title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>img</term> <term>img</term>
<listitem> <listitem>
Binary image. If every pixel is different than 0, the output is Binary image. If every pixel is different than 0, the output is
undefined and may contain arbitrary values. undefined and may contain arbitrary values.
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>algorithm</term> <term>algorithm</term>
<listitem> <listitem>
Listed below are various algorithms that are available in SIP, Listed below are various algorithms that are available in SIP,
together with the shortest string form accepted (for speed together with the shortest string form accepted (for speed
of use). This argument is CASE-INSENSITIVE, for convenience. Some of the of use). This argument is CASE-INSENSITIVE, for convenience. Some of the
algorithms are faster than others, but this depends heavily algorithms are faster than others, but this depends heavily
on the size and content of the input. on the size and content of the input.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>'euclidean' or 'euclid'</term> <term>'euclidean' or 'euclid'</term>
<listitem>the default fast exact euclidean <listitem>the default fast exact euclidean
algorithm. Currently, it is the same as the algorithm. Currently, it is the same as the
'maurer' bellow. (DEFAULT) 'maurer' bellow. (DEFAULT)
</listitem> </listitem>
<varlistentry> <varlistentry>
<term>'maurer' or 'mau'</term> <term>'maurer' or 'mau'</term>
<listitem>very fast (and <listitem>very fast (and
recent) exact euclidean algorithm, based on certain dimensionality recent) exact euclidean algorithm, based on certain dimensionality
properties of Voronoi diagrams. It is the best method together with properties of Voronoi diagrams. It is the best method together with
Meijster, in general. Meijster, in general. The implementation of this algorithm is able
</listitem> to output the <literal>label</literal> array of nearest pixels
(col-major) id's to each 0-pixel </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>'meijster' or 'mei'</term>
<term>'meijster' or 'mau'</term>
<listitem>very fast (and <listitem>very fast (and
recent) exact euclidean algorithm, based on certain dimensionality recent) exact euclidean algorithm, based on certain dimensionality
properties of Voronoi diagrams. It is the best method together with properties of Voronoi diagrams. It is the best method together with
Maurer, in general. For most cases it is slightly faster than Maurer, in general. For most cases it is slightly faster than
Maurer, but uses a little more memory. Maurer, but uses a little more memory.
</listitem> </listitem>
</varlistentry> </varlistentry>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>'cuisenaire pmn'</term> <term>'cuisenaire pmn'</term>
<listitem>very fast exact euclidean <listitem>very fast exact euclidean
algorithm. It is based on propagation of multiple algorithm. It is based on propagation of multiple
neighborhoods to build up an exact EDT. neighborhoods to build up an exact EDT.
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>'cuisenaire pmon'</term> <term>'cuisenaire pmon'</term>
<listitem>a variation of the latter that uses <listitem>a variation of the latter that uses
multiple oriented neighborhoods It seems to be slightly multiple oriented neighborhoods It seems to be slightly
slower, in general, but can be faster for some cases (we slower, in general, but can be faster for some cases (we
don't know exactly which) don't know exactly which)
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>'cuisenaire psn4'</term> <term>'cuisenaire psn4'</term>
<listitem>a variation <listitem>a variation
of the latter that uses only 4-neighborhood. This is of the latter that uses only 4-neighborhood. This is
faster but less precise</listitem> faster but less precise</listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>'cuisenaire psn8'</term> <term>'cuisenaire psn8'</term>
<listitem>a variation of the latter that uses <listitem>a variation of the latter that uses
diagonal neighborhood diagonal neighborhood
after 4-neighborhood to improve the precision. This is after 4-neighborhood to improve the precision. This is
faster than the full 'pmn' algorithm, but less faster than the full 'pmn' algorithm, but less
precise. It is a little slower than psn4 but considerably more precise. It is a little slower than psn4 but considerably more
precise. precise.
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>'lotufo-zampirolli' or 'lotufo-z'</term> <term>'lotufo-zampirolli' or 'lotufo-z'</term>
<listitem>very fast exact euclidean <listitem>very fast exact euclidean
algorithm. Seems to be slightly slower than maurer and algorithm. Seems to be slightly slower than maurer and
cuisenaire, in general, but can be faster for some cuisenaire, in general, but can be faster for some
cases. cases.
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>'IFT 8' or 'IFT'</term> <term>'IFT 8' or 'IFT'</term>
<listitem>a fast algorithm using the euclidean <listitem>a fast algorithm using the euclidean
metric. For large and thick shapes, there may be a few metric. For large and thick shapes, there may be a few
small errors, which are dispensable for most practical small errors, which are dispensable for most practical
applications.</listitem> applications.</listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>'IFT 4'</term> <term>'IFT 4'</term>
<listitem>the same algorithm but with <listitem>the same algorithm but with
4-neighborhood propagation. This means that this method 4-neighborhood propagation. This means that this method
is about 2x faster but less precise</listitem> is about 2x faster but less precise</listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>'exact dilations' or 'exact dil'</term> <term>'exact dilations' or 'exact dil'</term>
<listitem>will perform an exact euclidean <listitem>will perform an exact euclidean
algorithm that is slow for medium shapes, but algorithm that is slow for medium shapes, but
it is always exact and reasonably fast for thin it is always exact and reasonably fast for thin
shapes.</listitem> shapes.</listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>max_dist</term>
<listitem>
The maximum distance to be computed. Defaults to infinity (all distances
are computed). The resulting <literal>dt</literal> will be computed with a
specialized fast propagation algorithm (currently only
<literal>'cuisenaire pmn'</literal> is implemented with this option) that
will
visit only the required pixels within max_dist of the 0-pixels. This will
likely be faster than thresholding a full DT (computed with the default
best algorithm for this) only if the number of affected pixels is
sufficiently smaller than the entire image.
</listitem>
</varlistentry>
<varlistentry>
<term>dt</term> <term>dt</term>
<listitem> <listitem>
The distance transform of the image. It is undefined if the The distance transform of the image. It is undefined if the
input is an image without any pixels equal to 0. input is an image without any pixels equal to 0. If
</listitem> <literal>max_dist</literal> has been specified, then only the distances up
to and including <literal>max_dist</literal> will be present; 1-pixels tha
t are further than
<literal>max_dist</literal> are marked with a very large number,
guaranteed to be larger than <literal>max_dist^2</literal>
</listitem>
</varlistentry>
<varlistentry>
<term>label</term>
<listitem>
The label map of the image. Only certain algorithm options
will be able to output this (currently only 'maurer'). If you don't specif
y the algorithm,
then by having this in the left hand side in the function call will cause
<literal>'maurer'</literal> to run. Currently this doesn't work with
<literal>max_dist</literal>.
</listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</refsection> </refsection>
<refsection><title>Description</title> <refsection><title>Description</title>
<para> <para>
Function bwdist computes the distance transform. For each Function bwdist computes the distance transform. For each
foreground pixel (i.e. value '1') in the input image, the foreground pixel (i.e. value '1') in the input image, the
distance transform assigns a value that is the smallest distance distance transform assigns a value that is the smallest distance
between that pixel and the all the 0-pixels (you can also think of between that pixel and the all the 0-pixels (you can also think of
the distance to the outer boundary of the object). the distance to the outer boundary of the object).
</para> </para>
<para> <para>
Many different methods are provided for comparison purposes. If you Many different methods are provided for comparison purposes. If you
are going to use bwdist extensively, you may test all the algorithms are going to use bwdist extensively, you may test all the algorithms
to find the best one for your particular type of image. to find the best one for your particular type of image.
</para> </para>
</refsection> </refsection>
<refsection><title>Examples</title><programlisting role="example"><![CDATA[ <refsection><title>Examples</title><programlisting role="example"><![CDATA[
xset('auto clear', 'on'); xset('auto clear', 'on');
// First, a simple example to illustrate the concept // First, a simple example to illustrate the concept
A = zeros(15,10); A = zeros(15,10);
A(4:12,3:7)=1; A(4:12,3:7)=1;
A(4:5,3:4)=0 A(4:5,3:4)=0
D = bwdist(A) D = bwdist(A)
D = sqrt(D) D = sqrt(D)
// Note how the values in D were calculated. // Note how the values in D were calculated.
// For each pixel p such that A(p)=1, D(p) is the minimum euclidean // For each pixel p such that A(p)=1, D(p) is the minimum euclidean
// distance of p and the 0-pixels (background). // distance of p and the 0-pixels (background).
// To get the column-major index of the nearest 0-pixels, use the label outpu
t
[D,L] = bwdist(A);
L
// ----------------------------------- // -----------------------------------
// Now to a more interesting example // Now to a more interesting example
// ----------------------------------- // -----------------------------------
A = gray_imread(SIPDIR + 'images/escher.png'); A = gray_imread(SIPDIR + 'images/escher.png');
imshow(A,2); imshow(A,2);
D = bwdist(A); D = bwdist(A);
imshow(log(1+D),[]); // normalizes image to enhance visualization imshow(log(1+D),[]); // normalizes image to enhance visualization
D = bwdist(A,'exact dilations'); D = bwdist(A,'exact dilations');
imshow(log(1+D),[]); imshow(log(1+D),[]);
// nearest 0-pixels to any pixel (label map)
[D,L] = bwdist(A);
// each 0-pixel's zone of influence has a different id: the col-major
// index of the nearest 0-pixel.
//
// Each Voronoi region is now mapped to a different color
imshow(L+1, rand(max(L)+1, 3));
// To obtain an external EDT, simply invert the shape: // To obtain an external EDT, simply invert the shape:
B = 1-A; B = 1-A;
D = bwdist(B,'maurer'); D = bwdist(B,'maurer');
imshow(log(1+D),[]); imshow(log(1+D),[]);
// To obtain an external+internal EDT, simply compute // To obtain an external+internal EDT, simply compute
// the binary border of the shape and pass its negative // the binary border of the shape and pass its negative
// to bwdist: // to bwdist:
A = bwborder(A); A = bwborder(A);
A = 1-A; A = 1-A;
D = bwdist(A,'lotufo-zampirolli'); D = bwdist(A,'lotufo-zampirolli');
imshow(log(1+D),[]); imshow(log(1+D),[]);
// computation only up to a given distance
D = bwdist(A,'cuisenaire pmn', 12);
// correct way to display a partial DT is to clamp high values to max_dist
imshow(sqrt(D),[0 12]);
// --------------------------------- // ---------------------------------
// Other forms to visualize the DT // Other forms to visualize the DT
// --------------------------------- // ---------------------------------
// Wrapping (note the wavefronts of iso-distance) // Wrapping (note the wavefronts of iso-distance)
imshow(modulo(sqrt(D),10),[]) imshow(modulo(sqrt(D),10),[])
// Usual: // Usual:
D = bwdist(A); D = bwdist(A);
D = normal(sqrt(D),1000,1); D = normal(sqrt(D),1000,1);
imshow(D,hotcolormap(1000)); imshow(D,hotcolormap(1000));
// There is also of DT application in the example for the "watershed" // There is also of DT application in the example for the "watershed"
// function. // function.
xset('auto clear', 'off'); xset('auto clear', 'off');
]]></programlisting></refsection> ]]></programlisting></refsection>
<refsection><title>Bibliography</title> <para><emphasis role="bold">The original image, distance map and its closest
feature label map:</emphasis></para>
<para><imagedata fileref="../../images/escher.png" /> <imagedata fileref="..
/images/skeleton-escher-dt.png" /> <imagedata fileref="../images/escher-dt-label
_interior.png" /></para>
<variablelist> <para><emphasis role="bold">The distance map of the border (yielding
non-zero distances inside and outside), the associated closest feature label
map, and
the propagating wavefronts:</emphasis></para>
<para><imagedata fileref="../images/escher-dt-in_out.png" /> <imagedata file
ref="../images/escher-dt-label-inout.png" /> <imagedata fileref="../images/esche
r-dt-modulo.png" /></para>
<refsection><title>Bibliography</title>
<variablelist>
<varlistentry><term>Maurer</term><listitem> <varlistentry><term>Maurer</term><listitem>
<para> <para>
Maurer, C.R. and R. Qi and V. Raghavan, Maurer, C.R. and R. Qi and V. Raghavan,
"A Linear Time Algorithm for Computing the Euclidean Distance Transform in Ar bitrary Dimensions", "A Linear Time Algorithm for Computing the Euclidean Distance Transform in Ar bitrary Dimensions",
IEEE Transactions on Pattern Analysis and Machine Intelligence, IEEE Transactions on Pattern Analysis and Machine Intelligence,
vol. 25, no. 2, pp. 265-270, february 2003. vol. 25, no. 2, pp. 265-270, february 2003.
</para> </para>
</listitem></varlistentry> </listitem></varlistentry>
<varlistentry><term>Meijster</term><listitem> <varlistentry><term>Meijster</term><listitem>
<para> <para>
A. Meijster, J.B.T.M. Roerdink, and W.H. Hesselink "A General Algorithm A. Meijster, J.B.T.M. Roerdink, and W.H. Hesselink "A General Algorithm
for Computing Distance Transforms in Linear Time", for Computing Distance Transforms in Linear Time",
proc. of 5th Int. Conf. Mathematical Morphology and its Applications to proc. of 5th Int. Conf. Mathematical Morphology and its Applications to
Image and Signal Processing, 2000 Image and Signal Processing, 2000
</para> </para>
</listitem></varlistentry> </listitem></varlistentry>
<varlistentry><term>Cuisenaire</term><listitem> <varlistentry><term>Cuisenaire</term><listitem>
<para> <para>
Cuisenaire, O and Macq, B, Cuisenaire, O and Macq, B,
"Fast Euclidean Distance Transformation by Propagation Using "Fast Euclidean Distance Transformation by Propagation Using
Multiple Neighborhoods", Computer Vision and Image Understanding, no. 2, Multiple Neighborhoods", Computer Vision and Image Understanding, no. 2,
vol 76, 163--172, 76, 1999. vol 76, 163--172, 76, 1999.
</para> </para>
<para> <para>
Chapter 3 of "Distance transformations: fast algorithms and applications Chapter 3 of "Distance transformations: fast algorithms and applications
to medical image processing", Olivier Cuisenaire's Ph.D. Thesis, October to medical image processing", Olivier Cuisenaire's Ph.D. Thesis, October
1999, Universit catholique de Louvain, Belgium. 1999, Universit catholique de Louvain, Belgium.
</para> </para>
</listitem></varlistentry> </listitem></varlistentry>
<varlistentry><term>IFT</term><listitem> <varlistentry><term>IFT</term><listitem>
<para> <para>
"Multiscale Skeletons by Image Foresting Transform "Multiscale Skeletons by Image Foresting Transform
and its Application to Neuromorphometry", and its Application to Neuromorphometry",
A.X. Falcao, L. da F. Costa, B.S. da Cunha, A.X. Falcao, L. da F. Costa, B.S. da Cunha,
Pattern Recognition, 2002. Pattern Recognition, 2002.
</para> </para>
</listitem></varlistentry> </listitem></varlistentry>
<varlistentry><term>Lotufo-Zampirolli</term><listitem> <varlistentry><term>Lotufo-Zampirolli</term><listitem>
<para> <para>
R. Lotufo and F. Zampirolli, Fastmultidimensional parallel R. Lotufo and F. Zampirolli, Fastmultidimensional parallel
euclidean distance euclidean distance
transform based on mathematical morphology, in T. Wu and D. Borges, editors, transform based on mathematical morphology, in T. Wu and D. Borges, editors,
Proccedings of SIBGRAPI 2001, XIV Brazilian Symposium on Computer Graphics Proccedings of SIBGRAPI 2001, XIV Brazilian Symposium on Computer Graphics
and Image Processing, pages 100-105. IEEE Computer Society, 2001. and Image Processing, pages 100-105. IEEE Computer Society, 2001.
</para> </para>
</listitem></varlistentry> </listitem></varlistentry>
<varlistentry><term>Exact Dilations</term><listitem> <varlistentry><term>Exact Dilations</term><listitem>
<para> <para>
"Multiresolution shape representation without border shifting", "Multiresolution shape representation without border shifting",
L. da F. Costa, and L. F. Estrozi, Electronics Letters, no. 21, vol. 35, L. da F. Costa, and L. F. Estrozi, Electronics Letters, no. 21, vol. 35,
pp. 1829-1830, 1999. pp. 1829-1830, 1999.
</para> </para>
<para> <para>
"Shape Analysis and Classification", "Shape Analysis and Classification",
L. da F. Costa and R.M. Cesar Jr., CRC Press. L. da F. Costa and R.M. Cesar Jr., CRC Press.
</para> </para>
</listitem></varlistentry> </listitem></varlistentry>
</variablelist> </variablelist>
</refsection> </refsection>
<refsection><title>Authors</title><simplelist type="vert"> <refsection><title>Authors</title><simplelist type="vert">
<member> Ricardo Fabbri &lt;ricardofabbri <member> Ricardo Fabbri &lt;ricardofabbri
(AT) users DOT sf DOT net&gt; </member> (AT) users DOT sf DOT net&gt; </member>
</simplelist></refsection> </simplelist></refsection>
<refsection><title>Availability</title> The latest version <refsection><title>Availability</title> The latest version
of the Scilab Image Processing toolbox can be found at <para> of the Scilab Image Processing toolbox can be found at <para>
http://siptoolbox.sourceforge.net http://siptoolbox.sourceforge.net
</para> </para>
</refsection> </refsection>
<refsection><title>See Also</title><simplelist type="inline"> <refsection><title>See Also</title><simplelist type="inline">
<member> <member>
<link linkend="skel">skel</link> <link linkend="skel">skel</link>
</member> </member>
<member> <member>
<link linkend="thin">thin</link> <link linkend="thin">thin</link>
</member> </member>
<member>
<link linkend="edilate">edilate</link>
</member>
<member>
<link linkend="bwlabel">bwlabel</link> (connected component labeling)
</member>
</simplelist></refsection> </simplelist></refsection>
</refentry> </refentry>
 End of changes. 106 change blocks. 
110 lines changed or deleted 75 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS