樹葉葉脈的提取及描述

來源:互聯網
上載者:User

要求:拍攝樹葉照片,正反兩張,提取葉脈,測量葉脈的分支,以及分支的傾斜角。

霍夫變換以及canny運算元理論百度。。。。


程式:

clc,close    BW=imread('leaf.jpg');      BW=rgb2gray(BW);    thresh=[0.13,0.3]; %閾值設定根據映像自訂範圍 sigma=1;%定義高斯參數,1-3   f = edge(double(BW),'canny',thresh,sigma);    figure(1),imshow(f,[]);    title('canny 邊緣檢測');%canny邊緣運算元    [H, theta, rho]= hough(f,'RhoResolution', 0.5,'ThetaResolution',0.75);    %imshow(theta,rho,H,[],'notruesize'),axis on,axis normal%霍夫變換空間圖%xlabel('\theta'),ylabel('rho');        peak=houghpeaks(H,8,'threshold', ceil(0.3*max(H(:))));  %求出顯示霍夫變換矩陣中的8個極值點hold on        lines=houghlines(f,theta,rho,peak);% 找原圖中的線    figure,imshow(f,[]),title('Hough Transform Detect Result'),hold onmax_len=0;for k=1:length(lines)        xy=[lines(k).point1;lines(k).point2];     xielv(k)=(lines(k).point2(1)-lines(k).point1(1))/(lines(k).point2(2)-lines(k).point1(2)+0.0001);%求直線斜率      plot(xy(:,1),xy(:,2),'LineWidth',4,'Color',[.6 .6 .6]); %繪製各條直線 end  ang = atan(xielv)*180/pi%求各條直線角度 

原始映像:   

         

canny運算元邊緣檢測結果

霍夫變換取直線結果:


霍夫變換直線結果還是不明顯,對圖片識別度不高。


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.