24 lines
648 B
Plaintext
24 lines
648 B
Plaintext
function [r, g, b] = rgbconv2(a, c)
|
|
r = im2uint8(mat2gray(conv2(a(:,:,1), c)));
|
|
g = im2uint8(mat2gray(conv2(a(:,:,2), c)));
|
|
b = im2uint8(mat2gray(conv2(a(:,:,3), c)));
|
|
endfunction
|
|
|
|
im = jpgread("Lenna100.jpg");
|
|
emboss = [-2, -1, 0;
|
|
-1, 1, 1;
|
|
0, 1, 2 ];
|
|
sobel = [-1., -2., -1.;
|
|
0., 0., 0.;
|
|
1., 2., 1. ];
|
|
sharpen = [ -1.0, -1.0, -1.0;
|
|
-1.0, 9.0, -1.0;
|
|
-1.0, -1.0, -1.0 ];
|
|
|
|
[r, g, b] = rgbconv2(im, emboss);
|
|
jpgwrite("LennaEmboss.jpg", r, g, b, 100);
|
|
[r, g, b] = rgbconv2(im, sobel);
|
|
jpgwrite("LennaSobel.jpg", r, g, b, 100);
|
|
[r, g, b] = rgbconv2(im, sharpen);
|
|
jpgwrite("LennaSharpen.jpg", r, g, b, 100);
|