Standard examples of Convolution Masks

Image filtering allows you to apply various effects on photos. The type of image filtering described here uses a 2D filter similar to the one included in Paint Shop Pro as User Defined Filter and in Photoshop as Custom Filter. Here are some standard convolution masks.

Example

im = imread('Image1.jpg'); % original image 

% Low Pass Filter
lowPassfilterMask = [1 1 1; 1 1 1; 1 1 1]/9;
lowPassfilterMaskImage = imfilter(im,lowPassfilterMask);

% High Pass Filter
HighPassfilterMask = [0 -1 0; -1 5 -1; 0 -1 0];
HighPassfilterMaskImage = imfilter(im,HighPassfilterMask);

% Horizontal Edge Detection
HorizontalEdgeDetectionMask = [1 1 1; 0 0 0; -1 -1 -1];
HorizontalEdgeDetectionMaskImage = imfilter(im,HorizontalEdgeDetectionMask);

%plotting images
subplot(2,2,1); imshow(im); title('original image');
subplot(2,2,2); imshow(lowPassfilterMaskImage); title('Low pass filter');
subplot(2,2,3); imshow(HighPassfilterMaskImage); title('High pass filter Image');
subplot(2,2,4); imshow(HorizontalEdgeDetectionMaskImage); title('Horizontal edge detection');

Output

Share

You may also like...