找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 6561|回復(fù): 0
收起左側(cè)

MATLAB程序 Harris角點(diǎn)檢測(cè)算法

[復(fù)制鏈接]
ID:169021 發(fā)表于 2017-6-3 01:45 | 顯示全部樓層 |閱讀模式
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %特征點(diǎn)的匹配,主要應(yīng)用 harris 角點(diǎn)的檢測(cè),match單向匹配  函數(shù)
  3. %適合于有白邊的圖像,因?yàn),在加窗濾波的時(shí)候,沒有限定范圍的哈,盡量保證角點(diǎn)不在邊上
  4. clc,clear all;
  5. filename1 = '..\.\photo9\cal1-L.txt';
  6. filename2 = '..\.\photo9\cal1-R.txt';
  7. b1 = imread('..\.\photo9\cal1-L.bmp');
  8. b2 = imread('..\.\photo9\cal1-R.bmp'); %double的作用很大的啊
  9. a1 = imadjust(b1);
  10. a2 = imadjust(b2);
  11. %subplot(1,2,1);
  12. %imshow(a1);
  13. %subplot(1,2,2);
  14. %imshow(a2);   
  15. %title('原來(lái)的圖像');

  16. [result1,cnt1,c1,r1]=harris(a1);%角點(diǎn)檢測(cè),得到原始的焦點(diǎn)位置圖result
  17. [result2,cnt2,c2,r2]=harris(a2);

  18. figure;
  19. subplot(1,2,1);
  20. imshow(a1);
  21. hold on;
  22. plot(r1,c1,'g.');
  23. subplot(1,2,2);
  24. imshow(a2);
  25. hold on;
  26. plot(r2,c2,'g.');
  27. title('圖1,2的角點(diǎn)圖');

  28. l=[r1 c1];
  29. r=[r2 c2];
  30. fid1=fopen(filename1,'wt');
  31. for i=1:cnt1
  32.     for j=1:2
  33.        if j==2
  34.          fprintf(fid1,'%g\n',l(i,j));
  35.       else
  36.         fprintf(fid1,'%g\t',l(i,j));
  37.        end
  38.     end
  39. end
  40. fclose(fid1);

  41. fid2=fopen(filename2,'wt');
  42. for i=1:cnt2
  43.     for j=1:2
  44.       if j==2
  45.          fprintf(fid2,'%g\n',r(i,j));
  46.       else
  47.         fprintf(fid2,'%g\t',r(i,j));
  48.        end
  49.     end
  50. end
  51. fclose(fid2);

  52. %res2=match(a1,cnt1,r1,c1,a2,cnt2,r2,c2);%從result1中開始搜索在result2中可能達(dá)到的
  53. %[r22,c22]=find(res2==1);
  54. %[m22,n22]=size(r22);
  55. %cnt22=m22;

  56. %res1=match(a2,cnt22,r22,c22,a1,cnt1,r1,c1);%反向搜索res2--result1
  57. %res1=and(res1,result1);   %保證反向匹配不會(huì)出現(xiàn)不可能的點(diǎn)
  58. %[r11,c11]=find(res1==1);
  59. %[m11,n11]=size(r11);
  60. %cnt11=m11;

  61. %res22=match(a1,cnt11,r11,c11,a2,cnt22,r22,c22);%從res1中開始搜索在res2中可能達(dá)到的
  62. ……………………

  63. …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼


完整版本下載:
http://www.torrancerestoration.com/bbs/dpj-86571-1.html

相關(guān)帖子

回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表