Jump to content

Zhang-Suen thinning algorithm: Difference between revisions

m
→‎{{header|Perl}}: in-lined source 'image'
m (→‎{{header|Perl 6}}: removed DEBUG, in-lined source data)
m (→‎{{header|Perl}}: in-lined source 'image')
Line 2,994:
=={{header|Perl}}==
{{trans|Perl 6}}
<lang perl>use List::Util qw(sum max min);
 
$source = <<'END';
open $fh, '<', "zhang-suen.txt";
............................................................
while ($line = <$fh>) {
..#################...................#############.........
chomp $line;
..##################...............################.........
push @lines, [map { 1 & ord $_ } split '', $line];
..###################............##################.........
..########.....#######..........###################.........
....######.....#######.........#######.......######.........
....######.....#######........#######.......................
....#################.........#######.......................
....################..........#######.......................
....#################.........#######.......................
....######.....#######........#######.......................
....######.....#######........#######.......................
....######.....#######.........#######.......######.........
..########.....#######..........###################.........
..########.....#######.######....##################.######..
..########.....#######.######......################.######..
..########.....#######.######.........#############.######..
............................................................
END
 
for $line (split "\n", $source) {
push @lines, [map { 1 & ord $_ } split '', $line];
}
 
2,392

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.