image processing - Trying to understand implementation of gaussian blurring in matlab -


i trying blur scanned text document point text lines blurred black.. mean text blends each other , see black lines.

i'm new matlab , though know basics cannot image blur properly. have read this: gaussian blurr , according blur managed/decided sigma function. not how works in code wrote.

while trying learn gaussian blurring in matlab came find out achieved using function: fspecial('gaussian',hsize,sigma);

so apparently there 2 variables hsize specifies number of rows or columns in function while sigma standard deviation.

can 1 please explain significance of hsize here , why has deeper effect on result more sigma?

why if increase sigma high value blurr not effected image distorted lot increasing hsize

here code:

img = imread('c:\new.jpg');  h = fspecial('gaussian',hsize,sigma);  out = imfilter(img,h);  imshow(out); 

and results attached:

why not controlled sigma? role hsize play? why cant blur text rather distort entire image?

thank you

enter image description here enter image description here enter image description here

hsize refers size of filter. specifically, filter nx x ny pixels uses pixel region nx x ny in size centered around each pixel when computing response of filter. response how pixels in region combined together. in case of gaussian filter, intensity @ each pixel around central 1 weighted according gaussian function prior performing box average on region. sigma refers standard deviation of gaussian (see documentation fspecial) units in pixels. increase sigma (keeping size of filter same) approach simple box average uniform weighting on filter area around central pixel, stop seeing effect increasing sigma.

the similarity between results obtained gaussian blur (with large value of sigma) , box average shown in left , middle images below. right image shows results of eroding image, want.

enter image description here

the code:

% gaussian filter: hsize = 5; sigma = 10; h = fspecial('gaussian',hsize,sigma); out = imfilter(img,h);  % box filter: h = fspecial('average',hsize); out = imfilter(img,h);  % erode: se=strel('ball',4,4);  out = imerode(img,se); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -