-
大小: 1KB文件類型: .m金幣: 1下載: 0 次發(fā)布日期: 2021-06-09
- 語言: Matlab
- 標(biāo)簽: 角點(diǎn)檢測(cè)??harris??matlab??
資源簡(jiǎn)介
利用matlab實(shí)現(xiàn)圖像的角點(diǎn)檢測(cè),采用的是harris, 這里給出的是我編寫的harris函數(shù)。
代碼片段和文件信息
function?[y1y2rc]=harris(image)
image=rgb2gray(image);
image=double(image)/255;
[heightwidth]=size(image);
X=[-1?0?1;?-1?0?1;?-1?0?1];?%X方向梯度算子
Y=X‘;?%Y方向梯度算子
fx=conv2(imageX‘same‘);?%X方向?yàn)V波
fy=conv2(imageY‘same‘);
fx2=fx.^2;
fy2=fy.^2;
fxy=fx.*fy;
clear?fx;
clear?fy;
g=fspecial(‘gaussian‘[55]2);
A=conv2(fx2g‘same‘);
B=conv2(fy2g‘same‘);
C=conv2(fxyg‘same‘);
R=zeros(heightwidth);
Result=zeros(heightwidth);
Rmax=0.0;
for?i=1:height
????for?j=1:width
????????M=[A(ij)?C(ij)
???????????C(ij)?B(ij)];
???????R(i
評(píng)論
共有 條評(píng)論