



全文預覽已結束
下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
-哈哈哈MATLAB顯示正炫余炫圖:plot(x,y1,* r,x,y2,o b)定義【0,2】;t=0:pi/10:2*pi;定義函數(shù)文件:function 返回變量列表=函數(shù)名(輸入變量列表)順序結構:選擇結構1)if-else-end語句其格式為:if 邏輯表達式程序模塊1;else程序模塊2;End圖片讀?。?選擇圖片路徑filename, pathname = . uigetfile(*.jpg;*.bmp;*.gif,選擇圖片); %合成路徑+文件名 str=pathname,filename;%為什么pathname和filename要前面出現(xiàn)的位置相反才能運行呢?%讀取圖片 im=imread(str); %使用圖片 axes(handles.axes1); %顯示圖片 imshow(im);邊緣檢測:global im str=get(hObject,string);axes (handles.axes1);switch str case 原圖 imshow(im); case sobel BW = edge(rgb2gray(im),sobel); imshow(BW); case prewitt BW = edge(rgb2gray(im),prewitt); imshow(BW); case canny BW = edge(rgb2gray(im),canny); imshow(BW); Canny算子邊緣定位精確性和抗噪聲能力效果較好,是一個折中方案end; 開閉運算:se=1,1,1;1,1,1;1,1,1;1,1,1; %Structuring ElementI=rgb2gray(im);imshow(I,);title(Original Image);I=double(I);im_height,im_width=size(I);se_height,se_width=size(se);halfheight=floor(se_height/2);halfwidth=floor(se_width/2);se_origin=floor(size(se)+1)/2);image_dilation=padarray(I,se_origin,0,both); %Image to be used for dilationimage_erosion=padarray(I,se_origin,256,both); %Image to be used for erosion% Dilation %for k=se_origin(1)+1:im_height+se_origin(1) for kk=se_origin(2)+1:im_width+se_origin(2) dilated_image(k-se_origin(1),kk-se_origin(2)=max(max(se+image_dilation(k-se_origin(1):k+halfheight-1,kk-se_origin(2):kk+halfwidth-1); endendfigure;imshow(dilated_image,);title(Image after Dilation);% Erosion %se=se;for k=se_origin(2)+1:im_height+se_origin(2) for kk=se_origin(1)+1:im_width+se_origin(1) eroded_image(k-se_origin(2),kk-se_origin(1)=min(min(image_erosion(k-se_origin(2):k+halfwidth-1,kk-se_origin(1):kk+halfheight-1)-se); endendfigure;imshow(eroded_image,);title(Image after Erosion);% Opening(Erosion first, then Dilation) %se=se;image_dilation2=eroded_image; %Image to be used for dilationfor k=se_origin(1)+1:im_height-se_origin(1) for kk=se_origin(2)+1:im_width-se_origin(2) opening_image(k-se_origin(1),kk-se_origin(2)=max(max(se+image_dilation2(k-se_origin(1):k+halfheight-1,kk-se_origin(2):kk+halfwidth-1); endendfigure;imshow(opening_image,);title(Opening Image);% Closing(Dilation first, then Erosion) %se=se;image_erosion2=dilated_image; %Image to be used for erosionfor k=se_origin(2)+1:im_height-se_origin(2) for kk=se_origin(1)+1:im_width-se_origin(1) closing_image(k-se_origin(2),kk-se_origin(1)=min(min(image_erosion2(k-se_origin(2):k+halfwidth-1,kk-se_origin(1):kk+halfheight-1)-se); endendfigure;imshow(closing_image,);title(Closing Image);Warning: Image is too big to fit on screen; displaying at 31% scale. In truesizeResize1 at 308 In truesize at 44 In imshow at 161圖像的直方圖歸一化:I=imread(red.bmp);%讀入圖像figure;%打開新窗口 M,N=size(I);%計算圖像大小 counts,x=imhist(I,32);%計算有32個小區(qū)間的灰度直方圖 counts=counts/M/N;%計算歸一化灰度直方圖各區(qū)間的值 stem(x,counts);%繪制歸一化直方圖圖像平移:I=imread(shuichi.jpg);se=translate(strel(1),180 190);B=imdilate(I,se);figure;subplot(1,2,1),subimage(I);title(原圖像);subplot(1,2,2),subimage(B);title(平移后圖像);圖像的轉(zhuǎn)置;A=imread(nir.bmp);tform=maketform(affine,0 1 0;1 0 0;0 0 1);B=imtransform(A,tform,nearest);figure;imshow(A);figure;imshow(B);imwrite(B,nir轉(zhuǎn)置后圖像.bmp); 圖像濾波:B = imfilter(A,H,option1,option2,.)或?qū)懽鱣 = imfilter(f, w, filtering_mode, boundary_options, size_options)其中,f為輸入圖像,w為濾波掩模,g為濾波后圖像。filtering_mode用于指定在濾波過程中是使用“相關”還是“卷積”。boundary_options用于處理邊界充零問題,邊界的大小由濾波器的大小確定。具體參數(shù)選項見下表:選項描述filtering_modecorr通過使用相關來完成,該值為默認。conv通過使用卷積來完成boundary_optionsX輸入圖像的邊界通過用值X(無引號)來填充擴展其默認值為0replicate圖像大小通過復制外邊界的值來擴展symmet
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 微生物檢驗技術人才的培養(yǎng)體系試題及答案
- 2025年注冊會計師虛擬考試試題及答案
- 2025年證券從業(yè)資格的綜合評測試題及答案
- 2025年證券從業(yè)資格證考試分項復習試題及答案
- 理論與實踐2025年銀行從業(yè)資格證試題與答案
- 2025年銀行從業(yè)資格證考試價值分析及試題答案
- 云南省玉溪市通海一中2025年高三第一次調(diào)研測試語文試卷含解析
- 理解項目可行性測評的考核要點試題及答案
- 項目管理采購管理試題及答案
- 各科目2025年注冊會計師考試試題及答案解析
- 氬弧焊培訓課件-氬弧焊焊接技術培訓
- 中建總工程師的職業(yè)基本素養(yǎng)
- 【房地產(chǎn)項目成本控制問題研究文獻綜述2300字】
- 《一般將來時》教學設計
- 小學數(shù)學-青島版五四制五年級數(shù)學上冊第七單元《比的意義》教學設計學情分析教材分析課后反思
- 幼兒園故事課件:《胸有成竹》
- GB/T 43200-2023機器人一體化關節(jié)性能及試驗方法
- 單面彩鋼酚醛復合風管施工工法
- 浙江省溫州環(huán)大羅山聯(lián)盟2022-2023學年高一下學期4月期中聯(lián)考物理試題
- 功率因素校正(PFC)電路-PFC的工作原理課件
- GB/T 10000-2023中國成年人人體尺寸
評論
0/150
提交評論