Set up an array and a mask. This assumes that you have the Sussex vision library in your Matlab path.
The mask is 3x3, but the methods below will work whatever the size and shape of the mask.
Input = teachimage('image path');
imshow(Input);
Mask = [2 1 0; 1 0 -1; 0 -1 -2] % a diagonal edge detection mask
is equivalent to
Mask =
2 1 0
1 0 -1
0 -1 -2
% apply the mask is easier than the last post
Output = conv2(Input, Mask, 'valid');
imshow(Output);
(Adopt from http://www.cogs.susx.ac.uk/users/davidy/compvis/matlab_demos/convolution_demo.html)
No comments:
Post a Comment