Anonymous user
Zhang-Suen thinning algorithm: Difference between revisions
→{{header|Elena}}
m (→{{header|Kotlin}}: Added attribution) |
|||
Line 418:
=={{header|Elena}}==
ELENA 3.2 :
{{trans|Java}}
<lang elena>
const image = (
Line 452 ⟶ 453:
(0, 4, 6))).
{
$proceed : r : c : toWhite : firstStep
[
if (self
[ ^ false ].
int nn := self numNeighbors
if ((nn < 2) || (nn > 6))
[ ^ false ].
if(self numTransitions
[ ^ false ].
ifnot (self atLeastOneIsWhite
[ ^ false ].
toWhite
^ true.
Line 479 ⟶ 480:
int count := 0.
0 till
[
if (self
[ count := count + 1. ].
].
Line 492 ⟶ 493:
int count := 0.
0 till
[
if (self
[
if (self
[
count := count + 1.
Line 509 ⟶ 510:
[
int count := 0.
var group := nbrGroups
0 till:2
[
0 till
[
var nbr := nbrs
if (self
[ count := count + 1. ^ true
^ false.
Line 537 ⟶ 538:
firstStep := firstStep not.
1 till
[
1 till
[
if
[ hasChanged := true ].
].
].
toWhite
toWhite clear.
].
Line 555 ⟶ 556:
var it := self enumerator.
it
while (it next)
[
console writeLine.
it
].
]
Line 567 ⟶ 568:
program =
[
charmatrix grid := MatrixSpace::
{
rows = image length.
columns = image
getAt
= image
}.
|