下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quá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)來完成,該值為默認。conv通過使用卷積來完成boundary_optionsX輸入圖像的邊界通過用值X(無引號)來填充擴展其默認值為0replicate圖像
溫馨提示
- 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度寵物醫(yī)院寵物醫(yī)院寵物健康數(shù)據(jù)管理合同4篇
- 二零二五年版鋁合金散熱器研發(fā)與生產(chǎn)合同樣本2篇
- 引進創(chuàng)新創(chuàng)業(yè)團隊2025年度協(xié)議3篇
- 2025年度個人商鋪租賃合同裝修工程監(jiān)督合同4篇
- 二零二五年度地質(zhì)災害風險評估與防治合同3篇
- 2025年度個人閑置土地承包權(quán)置換合同范本4篇
- 2025年度大型活動策劃與執(zhí)行服務合同模板4篇
- 二零二五年度建筑廢棄物處理項目擔保合同范本3篇
- 二婚家庭專用2024離婚協(xié)議范本樣本版B版
- 2025年度趕工環(huán)保設(shè)備趕工銷售合作協(xié)議書
- 高考語文復習【知識精研】《千里江山圖》高考真題說題課件
- 河北省承德市2023-2024學年高一上學期期末物理試卷(含答案)
- 高中物理斜面模型大全(80個)
- 012主要研究者(PI)職責藥物臨床試驗機構(gòu)GCP SOP
- 農(nóng)耕研學活動方案種小麥
- 2024年佛山市勞動合同條例
- 污水管網(wǎng)規(guī)劃建設(shè)方案
- 城鎮(zhèn)智慧排水系統(tǒng)技術(shù)標準
- 采購管理制度及流程采購管理制度及流程
- 五年級美術(shù)下冊第9課《寫意蔬果》-優(yōu)秀課件4人教版
- 節(jié)能降耗課件
評論
0/150
提交評論