normalized 2D cross correlation
9 次查看(过去 30 天)
显示 更早的评论
I am trying to utilize the c=normxcorr2(template,A) function for two surface plots and I am running into the following errors;
??? Error using ==> iptcheckinput Function NORMXCORR2 expected its second input, A, to be finite.
Error in ==> normxcorr2>ParseInputs at 232 iptcheckinput(A,{'logical','numeric'},{'real','nonsparse','2d','finite'},mfilename,'A',2)
Error in ==> normxcorr2 at 55 [T, A] = ParseInputs(varargin{:});
Both matrices are the Z coordinates for the plots and and I can find the template in A and yes A is bigger than template. Matrix A is 427x249 and template is 299x149. The elements in both matrices range from -50 to +75 and also have NaN as fill elements.
I was wondering if someone knows whether it is appropriate to use this function for such manipulation if not can you help me to perform the 2D cross correlation for two surface plots?
Thanks, Shayan
0 个评论
采纳的回答
Sean de Wolski
2011-9-6
No. normxcorr2 requires that the elements be finite, i.e. not nan and not inf. The normalized cross correlation algorithm is not a difficult one ( wikipedia:normalized X-correlation )
I would recommend coding it yourself using functions that ignore nans ( nansum, nanmean, nanstd ). If you don't have the stats toolbox that contains these there is a nan-suite on the FEX.
2 个评论
Sean de Wolski
2011-9-7
2d x-correlation is what you wanted above. So you're expecting there to be a rotation about the z-axis and to recover the x/y translations correct?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!