How to exclude points when calculating the normalized cross correlation coefficients with normxcorr2?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am using the normalized cross correlation coefficients function; normxcorr2(template, A)
to to compute the normalized cross correlation coefficients. My two images have been gathered with microscope and bright white pixels(FillValue 1) represent no data. Is there a way I could utilize the normxcorr2 to get the normalized cross correlation coefficients for all pixels but excluding the bright white ones?
Thanks, Shayan
0 commentaires
Réponses (3)
Image Analyst
le 15 Juil 2011
Perhaps you can set the bad pixels to NaN - MATLAB often seems to harmlessly ignore such values when it does computations.
2 commentaires
Sean de Wolski
le 15 Juil 2011
That won't work because it expects the template to be finite:
A = magic(3);
B = padarray(magic(3),[10 10])
A(5) = nan
normxcorr2(A,B)
??? Error using ==> iptcheckinput
Function NORMXCORR2 expected its first input, T, to be finite.
Error in ==> normxcorr2>ParseInputs at 231
iptcheckinput(T,{'logical','numeric'},{'real','nonsparse','2d','finite'},mfilename,'T',1)
Error in ==> normxcorr2 at 55
[T, A] = ParseInputs(varargin{:});
Sean de Wolski
le 15 Juil 2011
I think I would start by creating a second image with the bright white pixels interpolated over.
MORE
nxcorr formula
It should be easy enough to implement this formula using nanmean, nanstd, and nansum (either with stats toolbox or available here: fex:nan_suite. Slide the template over every possible combination using double- for-loops; calculate the nxcorr and then find the highest value.
bart
le 29 Mai 2013
Hellò, I have a similar problem. I cannot use an interpolation solution for precision reason too. Anyone could post a nannormxcorr2 function? I'm neophyte with matlab and i've some difficult to modify normxcorr2.. I tried modifying with nanmean, nanstd, nansum, nancumsum, conv2nan etc.. but it doesn't work. I suppose that is not so simple.
Thanks, Berto.
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!