www.gusucode.com > images 案例代码 matlab源码程序 > images/FilterImageWithHorizontalAndVerticalMotionBlurExample.m
%% Filter Image with Horizontal and Vertical Motion Blur % %% % Read image into the workspace. % Copyright 2015 The MathWorks, Inc. A = imread('cameraman.tif'); %% % Pad the image by radius of the filter neighborhood, calculated % |(11-1)/2|. padSize = [5 5]; Apad = padarray(A, padSize, 'replicate', 'both'); %% % Calculate the integral image of the padded input. intA = integralImage(Apad); %% % Filter the integral image with a vertical [11 1] filter. Bvert = integralBoxFilter(intA, [11 1]); %% % Crop the output to retain input image size and display it. Bvert = Bvert(:,6:end-5); %% % Filter the integral image with a horizontal [1 11] filter. Bhorz = integralBoxFilter(intA, [1 11]); %% % Crop the output to retain input image size. Bhorz = Bhorz(6:end-5,:); %% % Display the original image and the filtered images. figure, imshow(A) title('Original Image') figure, imshow(Bvert,[]) title('Filtered with Vertical Filter') figure, imshow(Bhorz,[]) title('Filtered with Horizontal Filter')