📄 max2d.m
字号:
%MAX2d Maximum of image%% [r,c] = max2d(image)%% Return the interpolated coordinates (r,c) of the greatest peak in image.%% SEE ALSO: ihough xyhough%% Copyright (c) Peter Corke, 1999 Machine Vision Toolbox for Matlab% 1996 Peter Corkefunction [r,c] = max2d(im) ncols = numcols(im); nrows = numrows(im); [mx,where] = max(im); [mx2,where2] = max(mx); c = where2; r = where(where2); % now try to interpolate the peak over a 3x3 window dx = [ c-1 c c+1 c-1 c c+1 c-1 c c+1]; dy = [ r-1 r-1 r-1 r r r r+1 r+1 r+1]; % can't interpolate if against an edge if (c>1) & (c<ncols) & (r>1) & (r<nrows), p = im(r-1:r+1,c-1:c+1); c = sum(sum(dx.*p)) / sum(sum(p)); r = sum(sum(dy.*p)) / sum(sum(p)); end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -