日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【车型识别】基于小波和盒维数实现车型识别含Matlab源码

發布時間:2024/8/1 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【车型识别】基于小波和盒维数实现车型识别含Matlab源码 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1 簡介

自動車型識別系統是從人們對車輛分型的標準出發,對進出站點的各種車輛進行信息(即有關車輛類型的各種參數)采集,然后利用這些信息對車輛進行自動分型(即車型判別),為自動管理提供依據,為集中管理信息統計提供有關數據。該系統運用圖像處理、圖像分析和模式識別技術實現車輛類型的自動識別,具有投資少、適應性強、安裝維護方便等優點。?小波分析是二十世紀八十年代發展起來的一門新的數學分支,由于它具有良好的性質,在信號處理和圖像處理等許多領域得到了廣泛的應用。?本文主要探討了利用小波變換和分形維數在圖像處理中的應用實現自動車型識別系統的開發。將算法用Matlab進行仿真試驗,證明效果良好。

2 部分代碼

function B=boundaries(BW,conn,dir)%BOUNDARIES Trace object boundaries.%B=BOUNDARIES(BW) traces the exterior boundaries of objects in the binary%image BW.B is a p_by_1 cell array,where p is the number of objects in the%image.Each cell contains a Q_by_2 matrix,each row of which contains the%row and column coordinates of a boundary pixel.Q is the number of boundary%pixels for the corresponding object.Object boundaries are traced in the%clockwise direction.%%B=BOUNDARIES(BW,CONN) specifies the connectivity to use when tracing%boundaries.CONN may be either 8 or 4.The default value for CONN is 8.%%%B=BOUNDARIES(BW,CONN,DIR) specifies the direction used for tracing%boundaries.DIR should be either 'cw'(trace boundaries clockwise順時針) or%'ccw'(trace boundaries counterclockwise逆時針).If DIR is omitted BOUNDARIES%traces in the clockwise direction.if nargin<3 dir='cw';endif nargin<2 conn=8;endL=bwlabel(BW,conn);%The number of objects is the maximum value of L.Initialize the cell array%B so that each cell initially contains a 0_by_2 matrix.numObjects=max(L(:));if numObjects>0 B={zeros(0,2)}; B=repmat(B,numObjects,1);else B={};%只有背景end%Pad label matrix with zeros(用0擴展標簽矩陣).This lets us write the boundary_following loop%without worrying about going off the edge of the image.Lp=padarray(L,[1 1],0,'both');%Compute the linear indexing offsets to take us from a pixel to its%neighbors.M=size(Lp,1);if conn==8 %Order is N NE E SE S SW W NW. offsets=[-1,M-1,M,M+1,1,-M+1,-M,-M-1];else %Order is N E S W. offsets=[-1,M,1,-M];end%next_search_direction_lut is a lookup tabl.Given the direction from pixel%k to pixel k+1,what is the direction to start with when examining the%neighborhood of pixel k+1?if conn==8 next_search_direction_lut=[8 8 2 2 4 4 6 6];else next_search_direction_lut=[4 1 2 3];end%next_direction_lut is a lookup table查詢表.Given that we just looked at neighbor%in a given direction,which neighbor do we look at%next?if conn==8 next_direction_lut=[2 3 4 5 6 7 8 1];else next_direction_lut=[2 3 4 1];end%Values used for marking the starting and boundary pixels.START=-1;BOUNDARY=-2;%Initialize scratch space in which to record the boundary pixels as well as%follow the boundary.scratch=zeros(100,1);%Find candidate starting locations for boundaries.[rr,cc]=find((Lp(2:end-1,:)>0)&(Lp(1:end-2,:)==0));rr=rr+1;for k=1:length(rr) r=rr(k); c=cc(k);%得到邊界點的位置【r c】 if (Lp(r,c)>0)&(Lp(r-1,c)==0)&isempty(B{Lp(r,c)}) %We've found the start of the next boundary.Compute its linear %offset,record which boundary it is,mark it,and initialize the %counter for the number of boundary pixels. idx=(c-1)*size(Lp,1)+r; which=Lp(idx); scratch(1)=idx; Lp(idx)=START; numpixels=1; currentpixel=idx; initial_departure_direction=[]; done=0; next_search_direction=2; while ~done %Find the next boundary pixel. direction=next_search_direction; found_next_pixel=0; for k=1:length(offsets) neighbor=currentpixel+offsets(direction); if Lp(neighbor)~=0 %Found the next boundary pixel. if (Lp(currentpixel)==START)&... isempty(initial_departure_direction) %We are making the initial departure from the starting %pixel. initial_departure_direction=direction; elseif (Lp(currentpixel)==START)&... (initial_departure_direction==direction) % We are about to retrace our path. %That means we're done. done=1; found_next_pixel=1; break; end %Take the next step along the boundary. next_search_direction=... next_search_direction_lut(direction); found_next_pixel=1; numpixels=numpixels+1; if numpixels>size(scratch,1) %Double the scratch space. scratch(2*size(scratch,1))=0; end scratch(numpixels)=neighbor; if Lp(neighbor)~=START Lp(neighbor)=BOUNDARY; end currentpixel=neighbor; break; end direction=next_direction_lut(direction); end if ~found_next_pixel %If there is no next neighbor,the object must just have a %single pixel. numpixels=2; scratch(2)=scratch(1); done=1; end end %Convert linear indices to row_column coordinates and save in the %output cell array. [row,col]=ind2sub(size(Lp),scratch(1:numpixels)); B{which}=[row-1,col-1]; endendif strcmp(dir,'ccw') for k=1:length(B) B{k}=B{k}(end:-1:1,:); endend?

3 仿真結果

4 參考文獻

[1]押成. 基于小波分析的車型識別系統[D]. 西安電子科技大學.

博主簡介:擅長智能優化算法、神經網絡預測、信號處理、元胞自動機、圖像處理、路徑規劃、無人機等多種領域的Matlab仿真,相關matlab代碼問題可私信交流。

部分理論引用網絡文獻,若有侵權聯系博主刪除。

總結

以上是生活随笔為你收集整理的【车型识别】基于小波和盒维数实现车型识别含Matlab源码的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。