average local variance
Afficher commentaires plus anciens
Hi, I need to compute the diagonal error weight matrix (W), where W(i,i) measure the average local variance of pixels with gray level i. Can u please help me regarding this. i will be grateful.
1 commentaire
Oleg Komarov
le 3 Mar 2012
Not enough info: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 3 Mar 2012
I'm not sure what W is. But you can use stdfilt() to get the st.dev. in a local window of an image. Square it to get the variance. If you want the average of the 9 variances of the 9 pixels in a 3x3 neighborhood, then you can use imfilter() or conv2() with a kernel of ones(3)/9. Then you need to go through each gray level, extracting that mean variance, something like (maybe??? untested)
for gl = 0:255
% Find pixels in the original image with this gray level.
matchingIndexes = (imageArray == gl);
% Get the mean of only those pixels from the mean variance image.
W(gl+1) = mean(meanVarianceImage(matchingIndexes ));
end
2 commentaires
ismaiel
le 3 Mar 2012
Image Analyst
le 3 Mar 2012
No, it's not all zero - you're just not using [] to display in with imshow. See my other answer for a more complete demo.
Catégories
En savoir plus sur Image Processing Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!