【正文】
方圖統(tǒng)計、頻譜分析、灰度圖像處理和彩色圖像的顏色轉(zhuǎn)換模型等基本功能。然后按照自己擬定的功能要求進(jìn)行程序設(shè)計和調(diào)試。(4)、分析一個圖像的頻譜特征,利用傅里葉變換,將圖像從空間域變換到頻域,然后進(jìn)行各種處理,經(jīng)過高通濾波器或是低通濾波器。程序為:y=rgb2gray()。,39。執(zhí)行該操作,調(diào)節(jié)滑動條到上圖所示位置,結(jié)果如下圖截圖在MATLAB中,用函數(shù)imcrop實現(xiàn)對圖像的剪切操作。salt amp。if isrgb(x) msgbox(39。for i=1:M for j=1:N d=sqrt((im)^2+(jn)^2)。salt amp。y3=uint8(real(y2))。 BW=edge(y,39。而且許多函數(shù)的編寫都要用到C 語言,對C語言也有一定得要求。case 39。在打開可執(zhí)行文件時雖然不比安裝MATLAB,但是需要安裝相應(yīng)的補(bǔ)丁來支持底層文件才能執(zhí)行。 =y。imwrite(i,file)。,39。 gamma=p3。}。 defans={39。 y=flipud(x)。 imshow(y)。input parameter1:39。,p1,p2)。y=imnoise(x,39。,1,defans)。horz=1:10:256。xtick39。bar(horz,x1)。 y=fftshift(m)。f=double(y1)。x=()。 n=fix(N/2)。elsej=im2bw(x)。x=()。error39。this is a gray level image,can not convert39。 imshow(BW)。 imshow(BW)。sobel39。x=()。imshow(ntsc)。erode39。this is a color image,can not convert it to a binary image39。 [M,N]=size(g)。y2=ifft2(result)。elsey1=imnoise(x,39。)。axes()。 x1=x(1:10:256)。)。39。,1,defans)。 p1=str2num(p{1})。y=imrotate(,p1)。 imshow(y)。x=()。% function suoxiao_Callback(hObject, eventdata, handles)% hObject handle to suoxiao (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes()。imshow(y)。,1,defans)。end %function Untitled_2_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2 (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)%function liangdu_Callback(hObject, eventdata, handles)% hObject handle to liangdu (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) prompt={39。 return。) return。end。BW=edge(y,39。MATLAB不僅具有強(qiáng)大的數(shù)值運算功能,也同樣具有非常強(qiáng)大的二維和三維繪圖功能,尤其擅長于各種科學(xué)運算結(jié)果的可視化。end轉(zhuǎn)換后的結(jié)果為:在BUTTON GROUP中添加了四個RADIO BUTTON來實現(xiàn)灰度圖像邊沿檢測的功能。 h=1/(1+*(d/d0)^(2*nn))。,39。nn=2。 R直方圖顯示如下圖所示:均衡后的圖像如下圖所示::頻譜圖為了得到圖像的頻譜圖,先要對數(shù)據(jù)進(jìn)行傅里葉變換,用fft2函數(shù)對二維數(shù)據(jù)進(jìn)行快速傅里葉變換,同時為了更好的觀察頻譜圖,需要把fft2變換后的數(shù)據(jù)進(jìn)行平移,利用fftshift函數(shù),把快速傅里葉變換的DC 組件移到光譜中心。左右旋轉(zhuǎn)對圖像的左右翻轉(zhuǎn)也可以用fliplr函數(shù)來處理,同樣的,也要對灰度和彩色圖像分開處理,處理結(jié)果如圖:任意角度的旋轉(zhuǎn)經(jīng)常用到的噪聲有三種,高斯噪聲,椒鹽噪聲,乘性噪聲,可以通過以下三個函數(shù)來實現(xiàn):y=imnoise(,39。)。defans={39。由于RGB圖像是三維圖像,所以圖像數(shù)據(jù)是一個三維數(shù)組,為了顯示灰度圖像,把三維圖像降為二維,可以只取其中的二維數(shù)據(jù),實現(xiàn)方法程序為:y=((:,:,1))。由于作者的水平有限,實現(xiàn)的功能不是很多,而且都是一般的功能;(1)、將一個RGB圖像轉(zhuǎn)換為灰度圖像。 《基于MATLAB的圖像處理》課程設(shè)計學(xué)生姓名: 徐清福 學(xué) 號: 110700136 專業(yè)班級: 信通一班 指導(dǎo)教師: 鄭曉明 二○一零 年 4 月 8 日目 錄(二號字體)…………………………………………………2…………………………………………………2……………………………………………2…………………………………………2…………………………………………………3……………………………………………………16………………………………………………………17……………………………………………………………18………………………………………………………34課程設(shè)計的內(nèi)容如下:綜合運用MATLAB工具箱實現(xiàn)圖像處理的GUI程序設(shè)計。(2)、可以對圖像做各種變換,如旋轉(zhuǎn)等。 imshow(y)。[0 ]39。=get(,39。gaussian39。這樣圖像能量的低頻成分將集中到頻譜中心,圖像上的邊緣、線條細(xì)節(jié)信息等高頻成分將分散在圖像頻譜的邊緣。d0=3。失敗39。% 計算低通濾波器傳遞函數(shù) result(i,j)=h*g(i,j)。其中提供了三種邊沿檢測:sobel、prewitt、canny邊沿檢測功能。計算的可視化可以將雜亂的數(shù)據(jù)通過圖形表示從中觀察出其內(nèi)在的關(guān)系。sobel39。由于不同版本的MATLAB可能不兼容,特別是高版本的在低版本的MATLAB中幾乎打不開,而只是一堆亂碼。else y=imread([path,name])。elsefile=strcat(pathname,filename)。input parameter139。 p1=str2num(p{1})。 %function fangda_Callback(hObject, eventdata, handles)% hObject handle to fangda (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes()。 prompt={39。if isrgb() for k=1:3 y(:,:,k)=flipud(x(:,:,k))。function right90_Callback(hObject, eventdata, handles)% hObject handle to right90 (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes()。 imshow(y)。 p2=str2num(p{2})。 p1=str2num(p{1})。}。axes()。horz=1:10:256。if isrgb() x=imhist((:,:,3))。end頻譜分析單欄:%function pinpufenxi_Callback(hObject, eventdata, handles)% hObject handle to pinpufenxi (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)%function pinputu_Callback(hObject, eventdata, handles)% hObject handle to pinputu (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes()。salt amp。y3=uint8(real(y2))。nn=2。,39。)。else msgbox(39。if isrgb(x)ycbcr=rgb2ycbcr(x)。 BW=edge(y,39。end。)。else m