How to I apply Gaussian filter on images in MATLAB?

E
Eliezer · Oct 3, 2020 · 2.1K views
Question
How to I apply a 7 x 7 Gaussian blurr operator with standard deviation of 1.6 and downscaled by a factor of 3 ? I tried to write this code but got error. K = imread('baboon.png'); h = fspecial(K, 'gaussian',[7 7],1.6); downSample = imresize(h, 0.33); % downSample by factor of 3 imshow(downSample); How do i achieve this ?
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 29, 2026

You need to look at the documentation when the error say "too many arguments". Several of your arguments were wrong. Here is the fixed code:

 

rgbImage = imread('peppers.webp');
kernel = fspecial('gaussian', [7 7], 1.6);
blurredImage = imfilter(rgbImage, kernel);
downSample = imresize(blurredImage, 1/3); % downSample by factor of 3 
imshow(downSample);
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!