版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、%a%A=imread();r c d=size(A);r2g=zeros(r,c);red=zeros(r,c);green=zeros(r,c);blue=zeros(r,c);rg=zeros(r,c);for i=1:r;for j=1:c;red(i,j)=A(i,j,1);煙取圖像的紅色分量green(i,j)=A(i,j,2);%S取圖像的綠色分量blue(i,j)=A(i,j,3);%g取圖像的藍色分量endendfor i=1:r;for j=1:c;rg(i,j)=*red(i,j)+*green(i,j);endendrg=uint8(rg);for i=1:r;for
2、j=1:c;if rg(i,j)178;rg(i,j)=255;endendendfigure;subplot(2,2,1);imshow(A);title( 原圖)% 顯示原圖像subplot(222);imshow(rg);title( 彩色通道提取法-灰度圖);% figurer2g=rg;i=r2g; %俞入灰度變換后的圖像subplot(221);imshow(i);title( 原圖)subplot(223);imhist(i);%1 示直方圖h1=histeq(i);subplot(222);imshow(h1);title( 直方圖均衡化后的圖)subplot(224);imh
3、ist(h1);%i=h1;%:方圖均衡化后的圖像 j=imnoise(i, salt & pepper , k1=medfilt2(j);figure;subplot(121);imshow(j);title( 添加椒鹽噪聲圖像)subplot(122);imshow(k1);title( 3*3 模板中值濾波)% clcr2g;figure;subplot(221);imshow(r2g);title(原圖像);W_H1=2 3 0; %選用自定義差分模板增強左車道標記線3 0 -3;0 -3 -2;W_V1= 0 3 2; %選用自定義差分模板增強右車道標記線-3 0 3;-2 -3 0
4、;T = ;% the threshold in the 2-valueI = r2g; % read the image height,width = size(I);I1 = double(I);13 = double(I);14 = double(I);I2 = zeros(height+2,width+2);% put the images data into a biggerarray to void the edgeI2(2:height+1,2:width+1) = I1;for i=2:height+1% move the window and calculate thegra
5、dsfor j=2:width+1sum3 = 0;%不同方向的模板算子sum4 = 0;for m=-1:1for n=-1:1sum3= sum3 + W_H1(m + 2,n + 2) * I2(i + m,j + n); end end for m=-1:1for n=-1:1sum4 = sum4 + W_V1(m + 2,n + 2) * I2(i + m,j + n); end endgrey1 = abs(sum3) + abs(sum4);I3(i-1,j-1) = grey1; end endbig = max(max(I3);% 歸一化small = min(min(I3
6、);for i=1:heightfor j=1:widthI3(i,j) = (I3(i,j)-small)/(big - small);% 歸一化if (I3(i,j) T)I3(i,j) = 1;% 二值化elseI3(i,j) = 0; end end end subplot(222); imshow(I3);title( sl、sr算子處理的圖像)%figure;subplot(221);imshow(A);title( gg=bwmorph(I3, thin ,inf);subplot(222);imshow(gg);title(I = rg;x,y=size(I);height,w
7、idth = size(I);seedx=round(x);seedy=round(y/2);gr=I(seedx,seedy)W_H = 1 1 1;1 1 1;1 1 1;11 = double(I);12 = zeros(height+2,width+2);array to void the edgeI2(2:height+1,2:width+1) = I1;for i=2:height+1gradsfor j=2:width+1原圖)細化的圖像)% the model in the horizon direction% put the images data into a bigger
8、% move the window and calculate thesum1 = 0;% the cumulusfor m=-1:1for n=-1:1sum1 = sum1 + W_H(m + 2,n + 2) * I2(i + m,j + n);endendgrey=sum1/9;I1(i-1,j-1) = grey;endendI1=uint8(I1);%鄰域平均化灰度圖像%subplot(222);imshow(I1);title(區(qū)域生長-路面區(qū)域圖像)x,y=size(I1);I2=zeros(x,y);I=double(I);I1=double(I1);for i=1:x;fo
9、r j=1:y;if abs(I1(i,j)-I(i,j)=70&abs(I(seedx,seedy)-I1(i,j)=90)I2(i,j)=1;endendendsubplot(223)imshow(I2);title( 區(qū)域生長-路面區(qū)域圖像)I4=zeros(x,y);for i=round(5):x-4;for j=5:y-4;if gg(i,j)=1for m=i-4:i+4;for n=j-4:j+4;if I2(m,n)=0&sqrt(i-m)A2+(j-nA2)=2I4(i,j)=1;endendendendendendsubplot(224)imshow(I4);title(
10、 檢測圖像)%clc;t0=clockff=I4; %俞入檢測的圖像x,y=size(ff);a1=zeros(x,1);b1=zeros(y,1);k=1;for i=1:xfor j=1:round(y/2);if ff(i,j)=1;a1(k)=i;b1(k)=j;k=k+1;endendendm=length(a1);a2=max(a1)h=1;for i=1:m;if a1(i)=a2;jiaobiao(h)=i;h=h+1;endendb1=b1(jiaobiao);b11=max(b1);%ff(a1,b1)為選中的車道線第一個像素點 k=1;for i=round(1):rou
11、nd(x);for j=1:round(y/2 );if ff(i,j)=1&i=a2&j=b11;kkb(k)=(b11-j)/(a2-i);bbc(k)=b11-kkb(k)*a2;k=k+1;endend endtheta=atan(-1./kkb); theta1= theta+pi, roi=bbc.*sin(theta); roi1= roi+abs(roi); maxtheta=max( thetal); maxroi=max(roi1);accum=zeros(round(maxtheta)+1,round( maxroi)+1); for i=1:length(theta);
12、thetaint=round( maxtheta/2+theta1(i)/2);roiint=round( maxroi/2+roi1(i)/2)+1;accum(thetaint,roiint)=accum( thetaint,roiint)+1; endp=max(max(accum) %出現(xiàn)峰值處的累加器的值 for i=1:length(theta);thetaint=round( maxtheta/2+theta1(i)/2);roiint=round( maxroi/2+roi1(i)/2)+1;if accum(thetaint,roiint)=p;ji=i;endendk=1;m=1;for i=round(x/2):x;for j=1:round(y/2);if ff(i,j)=1&i=a2&j=b11;kk(k)=(b11-j)/(a2-i);bb(k)=b11-kk(k)*a2;theta(k)=atan(-1./kk(k); if theta(k) =theta
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 運動器材前臺工作總結(jié)
- 美術(shù)課教學創(chuàng)新策略計劃
- 網(wǎng)絡行業(yè)安全管理工作總結(jié)
- 2025年全球及中國全向條碼掃描儀行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025-2030全球快速部署式負壓帳篷行業(yè)調(diào)研及趨勢分析報告
- 2025年全球及中國液壓驅(qū)動氣舉閥系統(tǒng)行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025-2030全球風機葉片運輸車行業(yè)調(diào)研及趨勢分析報告
- 2025年全球及中國汽車振動臺行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025年全球及中國無塑食品軟包涂層紙行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025-2030全球紫外波段高光譜成像(HSI)設(shè)備行業(yè)調(diào)研及趨勢分析報告
- 湖北省十堰市城區(qū)2024-2025學年九年級上學期期末質(zhì)量檢測綜合物理試題(含答案)
- 導播理論知識培訓班課件
- 電廠檢修安全培訓課件
- 四大名繡課件-高一上學期中華傳統(tǒng)文化主題班會
- 起重機械生產(chǎn)單位題庫質(zhì)量安全員
- 高中生物選擇性必修1試題
- 2023年高考英語考前必練-非謂語動詞(含近三年真題及解析)
- 高??萍汲晒D(zhuǎn)化政策與案例分享
- 全國職工拔河比賽執(zhí)行方案
- 冶金廠、軋鋼廠工藝流程圖
- 《民航服務溝通技巧》教案第15課民航服務人員下行溝通的技巧
評論
0/150
提交評論