Image filtering with zero padding
Show older comments
Hello, I need to implement imge filtering on a grayscale image with some mask, but the size of the output image is not equal to the input's. I tried to use zero-padding by using padarray, but it just puts both images in a 'frame' and do not resize the output.
x=imread('123.png'); % grayscale image
x_padded = padarray(x, [2 2]); % my 'zero-padding'
mask = [1 2 3; 4 5 6; 7 8 9]; % chosen mask
x1=x_padded(1:256,1:256);
y1=conv2(x1,mask);
M1=max(max(y1));
y1=255.*(y1./M1);
subplot(2,2,1);imshow(x_padded);title('Image')
subplot(2,2,2);imshow(uint8((y1)));title('Filtered Image')
Input and ouput images:

pls send help
Accepted Answer
More Answers (0)
Categories
Find more on Region and Image Properties in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!