![matlab經(jīng)典代碼大全參考模板_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/4/e338b2b6-3ebf-47f4-84ce-75dad7971b5a/e338b2b6-3ebf-47f4-84ce-75dad7971b5a1.gif)
![matlab經(jīng)典代碼大全參考模板_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/4/e338b2b6-3ebf-47f4-84ce-75dad7971b5a/e338b2b6-3ebf-47f4-84ce-75dad7971b5a2.gif)
![matlab經(jīng)典代碼大全參考模板_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/4/e338b2b6-3ebf-47f4-84ce-75dad7971b5a/e338b2b6-3ebf-47f4-84ce-75dad7971b5a3.gif)
![matlab經(jīng)典代碼大全參考模板_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/4/e338b2b6-3ebf-47f4-84ce-75dad7971b5a/e338b2b6-3ebf-47f4-84ce-75dad7971b5a4.gif)
下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、哈哈哈MATLAB顯示正炫余炫圖:plot(x,y1,'* r',x,y2,'o b')定義【0,2】;t=0:pi/10:2*pi;定義函數(shù)文件:function 返回變量列表=函數(shù)名(輸入變量列表)順序結(jié)構(gòu):選擇結(jié)構(gòu)1)if-else-end語句其格式為:if 邏輯表達式程序模塊1;else程序模塊2;End圖片讀取:%選擇圖片路徑filename, pathname = . uigetfile('*.jpg''*.bmp''*.gif','選擇圖片'); %合成路徑+文件名 str=pathn
2、ame,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
3、); case 'prewitt' BW = edge(rgb2gray(im),'prewitt');1 / 4 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 Imag
4、e');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
5、9;); %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_imag
6、e,);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;ims
7、how(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)=
8、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
9、_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;
10、 displaying at 31% scale.> In truesize>Resize1 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=t
11、ranslate(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;
12、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用于指定在濾波過程中是使用“相關(guān)”還是“卷積”。boundary_options用于處理邊界充零問題,邊界的大小由濾波器的大小確定。具體參數(shù)選項見下表:選項描述filtering_modecorr通過使用相關(guān)來完成,該值為默認(rèn)。conv通過使用卷積來完成boundary_optionsX輸入圖像的邊界通過用值X(無引號)來填充擴展其默認(rèn)值為0replicate圖像
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 食品代加工協(xié)議書范本
- 面包車租賃合同范本
- 2025年黑龍江貨運從業(yè)資格證考題500道及答案
- 二零二五年度包裝設(shè)計專業(yè)畢業(yè)生就業(yè)實習(xí)與就業(yè)服務(wù)合同
- 技術(shù)出口合同范本
- 專業(yè)商務(wù)車租賃合同
- 2025年陜西貨運從業(yè)資格考試題目大全答案及解析
- 國際學(xué)校股權(quán)收購居間協(xié)議
- 公司承包合同
- 供貨簡易合同
- 最新如何進行隔代教育專業(yè)知識講座課件
- 當(dāng)前警察職務(wù)犯罪的特征、原因及防范,司法制度論文
- 計算機文化基礎(chǔ)單元設(shè)計-windows
- 創(chuàng)建動物保護家園-完整精講版課件
- 廣東省保安服務(wù)監(jiān)管信息系統(tǒng)用戶手冊(操作手冊)
- DNA 親子鑒定手冊 模板
- DB33T 1233-2021 基坑工程地下連續(xù)墻技術(shù)規(guī)程
- 天津 建設(shè)工程委托監(jiān)理合同(示范文本)
- 部編一年級語文下冊教材分析
- 火炬及火炬氣回收系統(tǒng)操作手冊
- 北師大七年級數(shù)學(xué)下冊教學(xué)工作計劃及教學(xué)進表
評論
0/150
提交評論