Comments on: Nonlinear operations using imfilter https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/?s_tid=feedtopost Steve Eddins is an enthusiastic amateur French horn player. Also, he has developed image processing and MATLAB software for MathWorks since 1993. Steve coauthored the book <i>Digital Image Processing Using MATLAB</i>. Mon, 28 Oct 2019 13:35:33 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Steve https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23762 Fri, 03 Dec 2010 15:32:32 +0000 https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23762 Sean—A lot of the mathematical details are omitted in this post. See the places, for example, where I include a note that says “scale factors omitted.” There is a significant difference between stdfilt and the code in this post because, well, they don’t compute the same thing.

]]>
By: Sean de Wolski https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23760 Thu, 02 Dec 2010 22:20:56 +0000 https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23760 Okay, I guess by opening stdfilt you can see the difference between the two. So why the discrepancy?

]]>
By: Sean de Wolski https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23759 Thu, 02 Dec 2010 22:01:36 +0000 https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23759 Hi Steve,
I realize this is old but I have a question about it. Why is there such a significant difference between your imfilter method and stdfilt with numbers in the range 0-255. Is it just numerical round off? The thing that irks me is that the greatest difference between the two is in the middle where there is a significant standard deviation and that the standard deviation from your imfilter example doesn’t seem reasonable.

Thanks!
-Sean

%%%
I = double(imread(‘cameraman.tif’));

h = ones(11,11);
Istd1 = sqrt(imfilter(I.^2, h, ‘symmetric’) – imfilter(I, h, ‘symmetric’).^2 / numel(h));

Istd2 = stdfilt(I,h);

imshow(Istd1-Istd2,[])

norm(Istd1(:)-Istd2(:))
%{
ans = 75950
%}

max([Istd1(:), Istd2(:)])
%{
ans = 1092.4 99.719
%}

]]>
By: Steve https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23298 Tue, 20 Jul 2010 11:51:13 +0000 https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23298 Diego—It doesn’t matter; the procedure still gives the correct answer. Note that the geometric mean of a set of values containing a 0 is 0. Try this:

exp(-inf)
]]>
By: Diego https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23295 Tue, 20 Jul 2010 02:58:24 +0000 https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-23295 I am aware this post is old, but just to note:

At this line:
geo_mean = imfilter(log(I), h, ‘replicate’);

You are calculating the log() of an array of doubles where 0 <= x <= 1.

That will produce an array of negative values, and possibly -Inf.

also replicating to the image as black squares.

]]>
By: Steve https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-20860 Thu, 10 Jul 2008 16:58:19 +0000 https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-20860 Francisco—At last count, there were 13,273,474 journal and conference papers describing different methods of edge detection. :-)

Think about regions of differing texture. The local standard deviation operator would have a relatively higher response in regions of “busier” texture, and it would have a relatively lower response in “smoother” regions. This is different than what most people think an edge detector does.

]]>
By: francisco https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-20859 Wed, 09 Jul 2008 16:56:05 +0000 https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-20859 Hi Steve,

You mention that the local standard deviation technique measures the ‘business’ of an image. How is this different, if at all, from edge detection? It looks like your first example does a really amazing job at finding edges, albeit they are rather thick.

thanks
-francisco

]]>
By: Steve https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-20854 Mon, 07 Jul 2008 15:58:31 +0000 https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-20854 Luca—Thanks for submitting your code to the File Exchange!

]]>
By: Luca Balbi https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-20853 Mon, 07 Jul 2008 15:21:18 +0000 https://blogs.mathworks.com/steve/2008/07/07/nonlinear-operations-using-imfilter/#comment-20853 This very same “sum of squares minus sqaure of sum” consideration drove me to re-implement the Kuwahara nonlinear filter in a faster way, though I did not use imfilter but just straightforward convolution, as I did not want the Image Processing Toolbox to be needed:

https://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=15027&objectType=FILE

Nice example by the way Steve! And thanks for pointing to the stdfilt function.

]]>