




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
harris角点检测与ncc匹配(Harris point detection and NCC match)harris角点检测与ncc匹配(Harris point detection and NCC match) Harris corner detection and NCC matching File1:- Function, y1, Y2, R, c=harris (X) % corner detection using the Harris algorithm % output is an image % result, CNT, R, c=harris (X) % CLC, clear all; % filename=qiao1.bmp; % X= imread (filename.bmp);% reads the image % Info=imfinfo (filename);%; this is customary % f=rgb2gray (X); F=X; % Ori_im=double (f) /255;%unit8 is converted to 64 double precision double64 FX = -2, -1 01, 2,% X direction gradient operator (for Harris corner extraction algorithm) Ix = Filter2 (FX, ori_im);% x directional filtering is good at using filter % FY = 5 85; 000; -5, -8, -5;% Gauss function, first order differential, Y direction (for improved Harris corner extraction algorithm) FY = -2; -1; 0; 1; 2;% Y direction gradient operator (used in Harris corner extraction algorithm) Iy = Filter2 (FY, ori_im);% y directional filtering Ix2 = Ix.2; Iy2 = Iy.2; Ixy = Ix.*Iy; Clear Ix; Clear Iy =% elimination variable ha H=, fspecial (gaussian, 10, 10, 2);% produces Gauss window functions of 7*7, sigma=2 Ix2 = Filter2 (h, Ix2); Iy2 = Filter2 (h, Iy2); Ixy = Filter2 (h, Ixy);% Gauss filtering, respectively Height = size (ori_im, 1); Width = size (ori_im, 2); Result = zeros (height, width);% record corner position, corner value is 1, background is black ha R = zeros (height, width); Rmax = 0;% the maximum R value in the image in order to set the threshold For I = 1:height For J = 1:width M = Ix2 (I, J), Ixy (I, J); Ixy (I, J), Iy2 (I, J);%2*2 matrix R (I, J) = det (M) -0.06* (trace (M) 2;% calculates R and obtains RMAX, which appears to be the whole, and the corner response function If R (I, J) Rmax Rmax = R (I, J); End; End; End; CNT = 0;% record count For I = 2:height-1 For J = 2:width-1% carry on non maximum suppression, window 3*3 If R (I, J) 0.01*Rmax & & R (I, J) R (i-1, J-1) and R (I, J) R (i-1, J) and R (I, J) R (i-1, j+1) and R (I, J) (I, J-1 R) and R (I, J) R (I, j+1) and R (I, J) R (i+1, J-1) and R (I, J) R (I +1 J) and R (I, J) R (i+1, j+1) Result (I, J) = 1; CNT = cnt+1; End; End; End; % % i=1; % for j=1:height % for k=1:width % if result (J, K) =1; % corners1 (I, 1) =j; % corners1 (I, 2) =k; % i=i+1; % end; % end; % end; posr, posc = find (result = 1); % corner number % imshow (ori_im)% and X have the same effect % hold on; % plot (posr, POSC,r.); Y1=result; Y2=cnt; R=posr; c=posc; Return; File2- Function, res=match (A1, cnt1, R1, C1, A2, CNT2, R2, C2) % res=match (A1, A2) % will find the best match point in A2 from A1 and get the res extracted from A2, that is, one-way search % result1, cnt1, R11, c11=harris (A1); CNT2, R22, result2%, c22=harris (A2);% can ensure to match what is, what % figure; % imshow (result1); title (result1 corner position); % figure; title (result2 corner position); % imshow (result2); Win=1/9 1/9 1/9; 1/9 1/9 1/9; 1/9 1/9 1/9; U1=filter2 (win, A1); U2=filter2 (win, A2);% for mean Research on image registration algorithm based on point feature A1=double (A1); A2=double (A2); A=filter2 (win, (a1-u1).2)% for variance B=filter2 (win, (a2-u2).2); m1, n1=size (A1); m2, n2=size (A2); Res1=zeros (M1, N1); Res2=zeros (m2, N2);% searched for matching points For s=1:cnt1 Max=0; p=0; q=0; i=r1 (s, 1); j=c1 (s, 1);%p.q stores coordinates For v=1:cnt2 M=r2 (V, 1); n=c2 (V, 1); K1= (A1 (i-1, J-1) -u1 (I, J) * (A2) (m-1, n-1) -u2 (m, n);% with result is to find what information, 3*3 for such a sparse point of no use K2= (A1 (i-1, J), -u1 (I, J) * (A2 (m-1, n) -u2 (m, n); K3= (A1 (i-1, j+1), -u1 (I, J) * (A2 (m-1, n+1) -u2 (m, n)% is better with loop K4= (A1 (I, J-1), -u1 (I, J) * (A2 (m, n-1) -u2 (m, n); K5= (A1 (I, J), -u1 (I, J) * (A2 (m, n) -u2 (m, n); K6= (A1 (I, j+1), -u1 (I, J) * (A2 (m, n+1) -u2 (m, n); K7= (A1 (i+1, J-1), -u1 (I, J) * (A2 (m+1, n-1) -u2 (m, n); K8= (A1 (i+1, J), -u1 (I, J) * (A2 (m+1, n) -u2 (m, n); K9= (A1 (i+1, j+1), -u1 (I, J) * (A2 (m+1, n+1) -u2 (m, n); Num=k1+k2+k3+k4+k5+k6+k7+k8+k9; Den=sqrt (A (I, J) *B (m, n); Ncc=num/den; If nccmax Max=ncc; p=m; q=n; End End Res2 (P, q) =1; End % can not do it, you can search for a point first Res=res2; Return File3- % The matching of% characteristic points is mainly based on the detection of Harris corner points and match one-way matching function % is suitable for images with white edges, because, when windowed filtering, there is no limit to the extent of Kazakhstan, as far as possible to ensure that the corner is not on the edge CLC, clear, all; A1=imread (qiao1.bmp); A2=imread (qiao2.bmp); The role of%double is great Subplot (1,2,1); imshow (A1); subplot (1,2,2); imshow (A2); title (original image); result1, cnt1, R1, c1=harris (A1);% corner detection, the raw focus position map result is obtained result2, CNT2, R2, c2=harris (A2); Figure; subplot (1,2,1); imshow (A1); hold, on; plot (C1, R1,g.); Subplot (1,2,2); imshow (A2); hold, on; plot (C2, R2,g.); title ( graph 1, 2 corner graph); Res2=match (A1, cnt1, R1, C1, A2, CNT2, R2, C2);% starts from result1 and searches possible in result2 r22, c22=find (res2=1); m22, n22=size (R22); Cnt22=m22; Res1=match (A2, cnt22, R22, C22, A1, cnt1, R1, C1);% reverse search res2-result1 Res1=and (res1, result1);% guarantees that the reverse matching does not appear to be impossible r11, c11=find (res1=1); m11, n11=size (R11); Cnt11=m11; Res22=match (A1, cnt11, R11, C11, A2, cnt22, R22, C22);% starts from res1 and searches poss
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 方位考试题及答案
- 富贵考试题及答案
- 2025职场风险加剧:合同问题成求职者易陷陷阱,业界疾呼加强劳动法教育
- 2025年远程英语教学兼职合同范本
- 2025年公司运营承包合同典范
- 2025二手办公楼租赁买卖合同模板
- 2025年居民出入权限操作合同样本
- 2025年新版郊区住宅购买策划协议
- 2025【国际商业合同】合同纠纷解决途径与顺序
- 2025年兼职教师职位申请合同
- 酒店客户服务质量提升培训课件
- GB/T 9258.2-2025涂附磨具用磨料粒度组成的检测和标记第2部分:粗磨粒P12~P220
- 2025 年小升初吕梁市初一新生分班考试语文试卷(带答案解析)-(部编版)
- (2025)公务员考试时事政治题库及完整答案详解(历年真题)
- 2025年政工师考试试题及参考答案
- 2025年检验检测人员理论考试试题及答案
- 2025-2030奢侈品礼品包装消费行为与品牌战略分析报告
- (2025年标准)个人转款协议书
- 2025年电力交易员(高级工)考试复习题库(含答案)
- 区域检验信息管理系统规划书
- 冷库安全基本知识培训课件
评论
0/150
提交评论