Why i got different standard deviation values when i apply these command for matrix called as M?
3 views (last 30 days)
I am trying to find the local standard deviation of each pixel in an image using a neighborhood window size 3*3 centered at each pixel.However, i got different result when I run the bellow code can you tell me why please?. The MATLAB code as follow
inputimage=imread('cameraman.tif');% read the input image
input_image=double(inputimage); % convert the class
%%%the first method to compute the standard deviation
%%%the second method to compute the standard deviation
MHN on 7 Apr 2016
Edited: MHN on 7 Apr 2016
The differences are just on the border of the image. The reason is that colfilt and stdfilt handle the border pixels differently. "For pixels on the borders of I, stdfilt uses symmetric padding. In symmetric padding, the values of padding pixels are a mirror reflection of the border pixels in I."
Also note that they are using different numerical method, so they might be not EXACTLY the same (if you compare them logically).