iharris.m
来自「来自澳大利亚Qeensland大学的计算机视觉Matlab工具箱。 This 」· M 代码 · 共 48 行
M
48 行
%IHARRIS Harris corner detector%% C = IHARRIS(I)%% Return an image of 'cornerness', C, from the original grey level image%% REF: "A combined corner and edge detector", C.G. Harris and M.J. Stephens% Proc. Fourth Alvey Vision Conf., Manchester, pp 147-151, 1988.%% SEE ALSO: showcorners%% Copyright (c) Peter Corke, 1999 Machine Vision Toolbox for Matlab% pic 10/96function cp = iharris(im) mask = [-1 0 1; -1 0 1; -1 0 1] / 3; % compute horizontal and vertical gradients Ix = conv2(im, mask, 'valid'); Iy = conv2(im, mask', 'valid'); % compute squares amd product Ixy = Ix .* Iy; Ix = Ix.^2; Iy = Iy.^2; % smooth them gmask = igauss(1, 1); Ix = conv2(Ix, gmask, 'valid'); Iy = conv2(Iy, gmask, 'valid'); Ixy = conv2(Ixy, gmask, 'valid'); % computer cornerness c = (Ix + Iy) ./ (Ix .* Iy - Ixy.^2); % compute minimum value around each pixel cmin = imorph(c, ones(3,3), 'min'); % if pixel equals minimum, its a local minima, find index l = find(c == cmin); cp = ones(size(c)) * max(max(c)); cp(l) = c(l);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?