From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to obtain teh variance of an image
Date: Sat, 17 Apr 2010 20:44:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 27
Message-ID: <hqd6il$5r4$>
References: <hqco3h$snm$> <hqd2j5$5vn$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1271537045 5988 (17 Apr 2010 20:44:05 GMT)
NNTP-Posting-Date: Sat, 17 Apr 2010 20:44:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2120837
Xref: comp.soft-sys.matlab:627513

Hi Roger,

Indeed, I did use the blkproc function and square it to obtain the variance using the 'anonymous' form of the blkproc function.  The code I used to implement this is given by the following.  The only remaining objective I wish to accomplish is to implement a threshold variance value above which all other values are zero and I wish to assign a colour to the remaining pixels (it is a rgb to grayscale image).  I placed the 'if' loop within the following and it doesn't seem to work.

Any comments and/or suggestions I would very much appreciate!


% variance of image grids
SV = zeros(height, width);

for y = 1:1:width
    for x = 1:1:height
        SV(x,y) = I2(x,y).^2;

%       Apply Threshold
         if SV(x,y) > (0.1*(min(min(SV))+min(min(SV))))
             SV(x,y) = 0;

    hold on;
imshow(SV, []), title('Var of Image'), colormap(hot);