average local variance
Mostra commenti meno recenti
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 Commento
Oleg Komarov
il 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
Risposta accettata
Più risposte (1)
Image Analyst
il 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 Commenti
ismaiel
il 3 Mar 2012
Image Analyst
il 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.
Categorie
Scopri di più su Image Processing Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!