September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
31
Task/Image-convolution/Perl-6/image-convolution.pl6
Normal file
31
Task/Image-convolution/Perl-6/image-convolution.pl6
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env perl6
|
||||
|
||||
# Reference:
|
||||
# https://github.com/azawawi/perl6-magickwand
|
||||
# http://www.imagemagick.org/Usage/convolve/
|
||||
|
||||
use v6;
|
||||
|
||||
use MagickWand;
|
||||
|
||||
# A new magic wand
|
||||
my $original = MagickWand.new;
|
||||
|
||||
# Read an image
|
||||
$original.read("./Lenna100.jpg") or die;
|
||||
|
||||
my $o = $original.clone;
|
||||
|
||||
# using coefficients from kernel "Sobel"
|
||||
# http://www.imagemagick.org/Usage/convolve/#sobel
|
||||
$o.convolve( [ 1, 0, -1,
|
||||
2, 0, -2,
|
||||
1, 0, -1] );
|
||||
|
||||
$o.write("Lenna100-convoluted.jpg") or die;
|
||||
|
||||
# And cleanup on exit
|
||||
LEAVE {
|
||||
$original.cleanup if $original.defined;
|
||||
$o.cleanup if $o.defined;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue