Correlation between 1 number and set of numbers
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I have a 500x500 matrix of numbers and NaN values. I want to determine the average correlation coefficient between a pixel and its nearest 8 neighbors (3x3 grid) while omitting NaN values from the calculation. My output will then be a 500x500 matrix of correlation coefficients and NaN values. When calculating values on the edge of the matrix, I will use however many neighbors surround the pixel of interest in the 3x3 grid.
Any ideas on how to do this? I am aware of the corrcoef command, but I don't know how to make it work for the comparison of multiple numbers.
Thanks in advance.
MATLAB Version: 9.5.0.944444 (R2018b)
0 Commenti
Risposte (1)
Image Analyst
il 13 Dic 2019
One way to do it is to use nlfilter(). I'm attaching a demo. Inside your custom function you'd take the local neighborhood and extract only the non-nan values with isnan(), then call corrcoeff() on those non-nan values only.
Attach your image in a .mat file, and your code if you can't figure out how to adapt it.
0 Commenti
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!