【正文】
小。左右旋轉(zhuǎn)對(duì)圖像的左右翻轉(zhuǎn)也可以用fliplr函數(shù)來處理,同樣的,也要對(duì)灰度和彩色圖像分開處理,處理結(jié)果如圖:任意角度的旋轉(zhuǎn)經(jīng)常用到的噪聲有三種,高斯噪聲,椒鹽噪聲,乘性噪聲,可以通過以下三個(gè)函數(shù)來實(shí)現(xiàn):y=imnoise(,39。speckle39。 R直方圖顯示如下圖所示:均衡后的圖像如下圖所示::頻譜圖為了得到圖像的頻譜圖,先要對(duì)數(shù)據(jù)進(jìn)行傅里葉變換,用fft2函數(shù)對(duì)二維數(shù)據(jù)進(jìn)行快速傅里葉變換,同時(shí)為了更好的觀察頻譜圖,需要把fft2變換后的數(shù)據(jù)進(jìn)行平移,利用fftshift函數(shù),把快速傅里葉變換的DC 組件移到光譜中心。)。nn=2。 endendresult=ifftshift(result)。,39。 % 數(shù)據(jù)類型轉(zhuǎn)換,不支持圖像的無符號(hào)整型的計(jì)算g=fft2(f)。 h=1/(1+*(d/d0)^(2*nn))。x=()。end轉(zhuǎn)換后的結(jié)果為:在BUTTON GROUP中添加了四個(gè)RADIO BUTTON來實(shí)現(xiàn)灰度圖像邊沿檢測(cè)的功能。執(zhí)行后效果圖:。MATLAB不僅具有強(qiáng)大的數(shù)值運(yùn)算功能,也同樣具有非常強(qiáng)大的二維和三維繪圖功能,尤其擅長(zhǎng)于各種科學(xué)運(yùn)算結(jié)果的可視化。string39。BW=edge(y,39。)。end。*.*39。) return。,39。 return。編輯菜單欄:%function huidu_Callback(hObject, eventdata, handles)% hObject handle to huidu (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes()。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。[0 ]39。,1,defans)。 imshow(y)。imshow(y)。p=inputdlg(prompt,39。% 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()。input the magnification times39。x=()。for k=1:3 y(:,:,k)=fliplr(x(:,:,k))。 imshow(y)。}。y=imrotate(,p1)。 defans={39。 p1=str2num(p{1})。%function jiaoyan_Callback(hObject, eventdata, handles)% hObject handle to jiaoyan (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)prompt={39。,1,defans)。 imshow(y)。39。,p1)。)。,0:50:255)。 x1=x(1:10:256)。,39。axes()。,0:50:255)。)。 imshow(log(abs(y)),[])。elsey1=imnoise(x,39。nn=2。y2=ifft2(result)。error39。 [M,N]=size(g)。 end result(i,j)=h*g(i,j)。this is a color image,can not convert it to a binary image39。if isrgb(x) msgbox(39。erode39。error39。imshow(ntsc)。if isrgb(x) HSV=rgb2hsv(x)。x=()。end邊沿檢測(cè):%function uipanel4_SelectionChangeF(hObject, eventdata, handles)% hObject handle to uipanel4 (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global ystr=get(hObject,39。sobel39。prewitt39。 imshow(BW)。canny39。 imshow(BW)。switch str case 39。this is a gray level image,can not convert39。,39。error39。imshow(y,jet(16))。x=()。)。elsej=im2bw(x)。imshow(y3)。 n=fix(N/2)。)。x=()。for i=1:M for j=1:N d=sqrt((im)^2+(jn)^2)。f=double(y1)。this is a color image ,Not a lowpass filter39。 y=fftshift(m)。else msgbox(39。bar(horz,x1)。HandleVisibility39。xtick39。ON39。horz=1:10:256。直方圖統(tǒng)計(jì)菜單欄:%function zhifangtutongji_Callback(hObject, eventdata, handles)% hObject handle to zhifangtutongji (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% function red_Callback(hObject, eventdata, handles)% hObject handle to red (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(,39。,1,defans)。prompt={39。y=imnoise(x,39。39。,p1,p2)。}。input parameter1:39。p=inputdlg(prompt,39。 imshow(y)。 imshow(y)。 y=flipud(x)。nearest39。 defans={39。y=imresize(,p1,39。}。ON39。 gamma=p3。139。,39。This is already a gray level image39。imwrite(i,file)。no file saved39。 =y。if isequal(name,0)|isequal(path,0) errordlg(39。在打開可執(zhí)行文件時(shí)雖然不比安裝MATLAB,但是需要安裝相應(yīng)的補(bǔ)丁來支持底層文件才能執(zhí)行。BW=edge(y,39。case 39。原圖39。而且許多函數(shù)的編寫都要用到C 語言,對(duì)C語言也有一定得要求。比如,彩色圖像的濾波處理,直方圖均衡等。 BW=edge(y,39。this is a gray image,can not convert39。y3=uint8(real(y2))。 % 二階巴特沃斯(Butterworth)低通濾波器d0=10。salt amp。 end低通濾波器axes()。for i=1:M for j=1:N d=sqrt((im)^2+(jn)^2)。 %加高斯噪聲f=double(y1)。if isrgb(x) msgbox(39。 其中,x矩陣的數(shù)據(jù)是0~255灰度值的統(tǒng)計(jì)個(gè)數(shù),如果直接對(duì)x矩陣數(shù)據(jù)進(jìn)行圖形圖顯示,由于有256個(gè)數(shù)據(jù),在坐標(biāo)系中就會(huì)很密集,為了更清楚的顯示條形圖,所以在程序設(shè)計(jì)