Image convolution: Difference between revisions
Content added Content deleted
m (→{{header|MATLAB}}: Fixed typo (kernal → kernel)) |
SqrtNegInf (talk | contribs) (Added Perl example) |
||
Line 1,562: | Line 1,562: | ||
[r, g, b] = rgbconv2(im, sharpen); |
[r, g, b] = rgbconv2(im, sharpen); |
||
jpgwrite("LennaSharpen.jpg", r, g, b, 100);</lang> |
jpgwrite("LennaSharpen.jpg", r, g, b, 100);</lang> |
||
=={{header|Perl}}== |
|||
<lang perl>use strict; |
|||
use warnings; |
|||
use PDL; |
|||
use PDL::Image2D; |
|||
my $kernel = pdl [[-2, -1, 0],[-1, 1, 1], [0, 1, 2]]; # emboss |
|||
my $image = rpic 'pythagoras_tree.png'; |
|||
my $smoothed = conv2d $image, $kernel, {Boundary => 'Truncate'}; |
|||
wpic $smoothed, 'pythagoras_convolution.png';</lang> |
|||
Compare offsite images: [https://github.com/SqrtNegInf/Rosettacode-Perl5-Smoke/blob/master/ref/pythagoras_tree.png pythagoras_tree.png] vs. |
|||
[https://github.com/SqrtNegInf/Rosettacode-Perl5-Smoke/blob/master/ref/pythagoras_convolution.png pythagoras_convolution.png] |
|||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |