91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發布日期: 2024-01-30
  • 語言: Matlab
  • 標簽: Harris??

資源簡介

計算機視覺Harris角點檢測算法, 利用matlab實現,簡單易懂。

資源截圖

代碼片段和文件信息

img?=?imresize3(imread(‘pic.png‘)?[1000?1000?3]);
corn_thresh?=?0.18;
interactive?=?1;

%?function?[locscornerness]?=?detHarrisCorners(img?corn_thresh?interactive)
%%?parse?the?parameters
if(~exist(‘corn_thresh‘‘var‘))
????corn_thresh?=?0.01;
end

if(~exist(‘interactive‘‘var‘))
????interactive?=?0;
end

if(size(img3)>1)
????img?=?rgb2gray(img);
end


%%
[nrnc]?=?size(img);

%Filter?for?horizontal?and?vertical?direction
fx?=?[1?0?-1];
fy?=?[1;?0;?-1];

%?Convolution?of?image?with?dx?and?dy
Ix?=?conv2(img?fx?‘same‘);
Iy?=?conv2(img?fy?‘same‘);

if(interactive)
????figure(1);?%?imagesc?對圖像進行縮放后顯示
????subplot(121);?imagesc(Ix);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Ix‘);
????subplot(122);?imagesc(Iy);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Iy‘);
????cdata?=?print(‘-RGBImage‘);
????%imwrite(cdata?fullfile(‘corner‘?[name?‘-grad.png‘]));
????imwrite(cdata?‘/Users/liziniu/Downloads/計算機視覺與模式識別/角點檢測/affine_transform/corner/grad.png‘);
end

%%?Raw?Hessian?Matrix
%?Hessian?Matrix?Ixx?Iyy?Ixy
Ixx?=?Ix.*Ix;
Ixy?=?Ix.*Iy;
Iyy?=?Iy.*Iy;

if(interactive)
????figure(2);?title(‘Before?Smoothing‘);
????subplot(221);?imagesc(Ixx);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Ixx‘);
????subplot(222);?imagesc(Ixy);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Ixy‘);
????subplot(223);?imagesc(Ixy);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Ixy‘);
????subplot(224);?imagesc(Iyy);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Ixy‘);
????cdata?=?print(‘-RGBImage‘);
????%imwrite(cdata?fullfile(‘corner‘?[name?‘-rawHessian.png‘]));
????imwrite(cdata?‘/Users/liziniu/Downloads/計算機視覺與模式識別/角點檢測/affine_transform/corner/rawHessian.png‘);
end

%%?Gaussian?filter?definition?(https://en.wikipedia.org/wiki/Canny_edge_detector)
G?=?[2?4?5?4?2;?4?9?12?9?4;5?12?15?12?5;4?9?12?9?4;2?4?5?4?2];
G?=?1/159.*?G;

%?Convolution?with?Gaussian?filter
Ixx?=?conv2(Ixx?G?‘same‘);
Ixy?=?conv2(Ixy?G?‘same‘);
Iyy?=?conv2(Iyy?G?‘same‘);

if(interactive)
????figure(3);?title(‘After?Smoothing‘);
????subplot(221);?imagesc(Ixx);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Ixx‘);
????subplot(222);?imagesc(Ixy);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Ixy‘);
????subplot(223);?imagesc(Ixy);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Ixy‘);
????subplot(224);?imagesc(Iyy);?axis?equal?image?off;?colormap(‘gray‘);?title(‘Iyy‘);
????cdata?=?print(‘-RGBImage‘);
????%imwrite(cdata?fullfile(‘corner‘?[name?‘-smoothHessi

評論

共有 條評論