Zhang-Suen thinning algorithm: Difference between revisions

Content added Content deleted
Line 995: Line 995:
Partition[check[#[[1]], #[[2]], tmp, 2] & /@ i,
Partition[check[#[[1]], #[[2]], tmp, 2] & /@ i,
Dimensions[tmp][[2]]]];
Dimensions[tmp][[2]]]];


FixedPoint[iter, dat]</lang>

Which results in:
(printMat is only defined to print an text output - the natural Mathemaica way would be to use ArrayPlot function, which create a graphic object which we can't paste into this wiki)
<pre>


printMat[mat_] :=
printMat[mat_] :=
Line 1,001: Line 1,008:
StringJoin, {"1" -> "#", "0" -> "."}];
StringJoin, {"1" -> "#", "0" -> "."}];


FixedPoint[iter, dat]</lang>

Which returns

<pre>
dat1 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
dat1 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 1, 1, 1,