MATLAB(GUI)數(shù)字圖像處理試驗報告_第1頁
MATLAB(GUI)數(shù)字圖像處理試驗報告_第2頁
MATLAB(GUI)數(shù)字圖像處理試驗報告_第3頁
MATLAB(GUI)數(shù)字圖像處理試驗報告_第4頁
MATLAB(GUI)數(shù)字圖像處理試驗報告_第5頁
已閱讀5頁,還剩25頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

本文格式為Word版,下載可任意編輯——MATLAB(GUI)數(shù)字圖像處理試驗報告

2023—2023學(xué)年其次學(xué)期

課程名稱:教學(xué)實踐Ⅱ:軟硬件提高訓(xùn)練任課教師:

題目:MATLAB數(shù)字圖像處理

學(xué)號:ROB12023姓名:年級:2023級專業(yè):自動化

提交日期:年月日

評語:成績:評卷人:

1.設(shè)計目的

利用MATLAB的GUI程序設(shè)計一個簡單實用的圖像處理程序。該程序應(yīng)具備圖像處理的常用功能,以滿足要求。

2.設(shè)計要求

設(shè)計程序有以下基本功能:1)圖像的讀取、保存和程序退出2)圖像轉(zhuǎn)化為灰度圖像3)底片處理(反色)4)截圖

5)亮度和對比度度調(diào)理6)圖像的翻轉(zhuǎn)與旋轉(zhuǎn)7)添加噪聲8)平滑和銳化9)直方圖均衡化處理10)圖像的腐蝕和膨脹11)邊緣檢測12)還原和撤銷3.總體設(shè)計

4.程序與運行結(jié)果

4.1圖像的讀取、保存和程序退出1.圖像讀取1)主要程序

A=imread(str)%讀取圖片imshow(A)%顯示圖片2)運行結(jié)果

2.圖像保存1)主要程序

imwrite(handles.img,sfilefullname);%圖像的保存

2)運行結(jié)果

3.退出1)主要程序

closeall;%關(guān)閉所有2)運行結(jié)果(略)

4.2圖像轉(zhuǎn)化為灰度圖像1)主要程序

C=rgb2gray(img);%將rgb彩色圖像轉(zhuǎn)換為灰度圖2)運行結(jié)果

4.3底片處理(反色)1)主要程序

I=imcomplement(handles.img);%底片處理(反色)2)運行結(jié)果

4.4截圖1)主要程序

a=imcrop(handles.img);%圖像的截取2)運行結(jié)果

4.5亮度和對比度度調(diào)理1.亮度調(diào)理1)主要程序

y=imadjust(handles.img,[],[],p1);%亮度調(diào)理2)運行結(jié)果

2.對比度調(diào)理1)主要程序

f=immultiply(handles.img,p1);%對比度加強f=imdivide(handles.img,p1);%對比度減弱2)運行結(jié)果

4.6圖像的翻轉(zhuǎn)與旋轉(zhuǎn)1.圖像的翻轉(zhuǎn)1)主要程序

fliplr(b)%圖像的翻轉(zhuǎn)2)運行結(jié)果

2.圖像的旋轉(zhuǎn)1)主要程序

f=imrotate(handles.img,p1,'bilinear','crop');%圖像的旋轉(zhuǎn)2)運行結(jié)果

4.7添加噪聲1.椒鹽噪聲1)主要程序

f=imnoise(handles.img,'salt%添加椒鹽噪聲2)運行結(jié)果

2.高斯噪聲1)主要程序

f=imnoise(handles.img,'gaussian',p1,p2);%添加高斯噪聲2)運行結(jié)果

3.乘法噪聲1)主要程序

f=imnoise(handles.img,'speckle',p1);%添加乘法噪聲2)運行結(jié)果

4.8平滑和銳化1.平滑1)主要程序

Imfilter%均值濾波medfilt2%中值濾波2)運行結(jié)果

2.銳化1)主要程序

fspecial()%創(chuàng)立預(yù)定義的濾波算子

imfilter();imadd();%在實現(xiàn)卷積運算的基礎(chǔ)上進(jìn)行濾波2)運行結(jié)果

4.9直方圖均衡化處理1.灰度圖像1)主要程序

B=histeq(C);%直方圖均衡化函數(shù)2)運行結(jié)果

2.RGB圖像1)主要程序

B=histeq(C);%直方圖均衡化函數(shù)2)運行結(jié)果

4.10圖像的腐蝕和膨脹1.圖像的腐蝕1)主要程序

I1=imerode(handles.img,se);%圖像的腐蝕2)運行結(jié)果

2.圖像的膨脹1)主要程序

I1=imdilate(handles.img,se);%圖像的膨脹

2)運行結(jié)果

4.11邊緣檢測1)主要程序

rslt=ycbcr2rgb(uint8(img2));%邊緣檢測2)運行結(jié)果

4.12還原和撤銷1.還原

1)主要程序

globalS%設(shè)計一個全局變量S,保存初始圖像路徑,以便之后的還原操作2)運行結(jié)果

2.撤銷(只能撤銷一次)1)主要程序

globalT%設(shè)計一個全局變量S,保存每次操作原圖像,以便撤銷操作2)運行結(jié)果

5.心得體會

通過用MATLAB(GUI)設(shè)計數(shù)字圖像處理界面,我把握了有關(guān)數(shù)字圖像處

理的相關(guān)知識和GUI的操作知識,讓理論知識與實際相結(jié)合,做出了數(shù)字圖像處理的圖形用戶界面。

在實踐前,通過一天的數(shù)字圖像處理的相關(guān)知識與一天GUI的知識的學(xué)習(xí),把握了其基本入門知識;然后在實踐中,結(jié)合要設(shè)計要求補充自學(xué)相關(guān)知識,在實踐中驗證

prompt={'輸入高斯噪聲1:','輸入高斯噪聲2'};defans={'0','0.02'};p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});p2=str2num(p{2});f=imnoise(handles.img,'gaussian',p1,p2);imshow(f);handles.img=f;guidata(hObject,handles);case3T=handles.img;prompt={'輸入乘性噪聲1:'};defans={'0.02'};p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});f=imnoise(handles.img,'speckle',p1);imshow(f);handles.img=f;guidata(hObject,handles);end

%Executesonselectionchangeinpopupmenu7.

functionpopupmenu7_Callback(hObject,eventdata,handles)%hObjecthandletopopupmenu7(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Hints:contents=cellstr(get(hObject,'String'))returnspopupmenu7contentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompopupmenu7

%Executesduringobjectcreation,aftersettingallproperties.functionpopupmenu7_CreateFcn(hObject,eventdata,handles)%hObjecthandletopopupmenu7(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.

ifispcend

%Executesonbuttonpressinpushbutton17.

functionpushbutton17_Callback(hObject,eventdata,handles)%平滑

%hObjecthandletopushbutton17(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

str=get(handles.popupmenu5,'value');axes(handles.axes2);switchstrcase1

T=handles.img;

prompt={'請輸入模版維度:'};defans={'3'};

p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});

h1=fspecial('average',[p1p1]);I=imfilter(handles.img,h1);imshow(I);handles.img=I;

guidata(hObject,handles);case2

T=handles.img;

prompt={'請輸入模版維度:'};defans={'3'};

p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});

ifnumel(size(handles.img))>2A=handles.img;R=A(:,:,1);G=A(:,:,2);B=A(:,:,3);

GP(:,:,1)=medfilt2(R,[p1p1]);GP(:,:,2)=medfilt2(G,[p1p1]);GP(:,:,3)=medfilt2(B,[p1p1]);imshow(GP);handles.img=GP;else

A=handles.img;

I=medfilt2(A,[p1p1]);imshow(I);handles.img=I;end

guidata(hObject,handles);end

%Executesonbuttonpressinpushbutton20.

functionpushbutton20_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton20(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)clc;

closeall;close(gcf);clear;

%Executesonbuttonpressinpushbutton16.

functionpushbutton16_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton16(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

str=get(handles.popupmenu5,'value');axes(handles.axes2);switchstrcase1

T=handles.img;

prompt={'請輸入模版維度:'};defans={'3'};

p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});

h1=fspecial('average',[p1p1]);I=imfilter(handles.img,h1);imshow(I);handles.img=I;

guidata(hObject,handles);case2

T=handles.img;

prompt={'請輸入模版維度:'};defans={'3'};

p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});

ifnumel(size(handles.img))>2A=handles.img;R=A(:,:,1);G=A(:,:,2);B=A(:,:,3);

GP(:,:,1)=medfilt2(R,[p1p1]);GP(:,:,2)=medfilt2(G,[p1p1]);GP(:,:,3)=medfilt2(B,[p1p1]);imshow(GP);handles.img=GP;else

A=handles.img;

I=medfilt2(A,[p1p1]);imshow(I);handles.img=I;end

guidata(hObject,handles);end

%Executesonbuttonpressinpushbutton18.

functionpushbutton18_Callback(hObject,eventdata,handles)%銳化

%hObjecthandletopushbutton18(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

str=get(handles.popupmenu6,'value');axes(handles.axes2);T=handles.img;g=handles.img;switchstr

case1

h=fspecial('sobel');case2

h=fspecial('prewitt');case3

h=fspecial('laplacian');end

ifnumel(size(g))>2R=g(:,:,1);G=g(:,:,2);B=g(:,:,3);

R1=imfilter(R,h);

GP(:,:,1)=imadd(R,R1);G1=imfilter(G,h);

GP(:,:,2)=imadd(G,G1);B1=imfilter(B,h);

GP(:,:,3)=imadd(B,B1);

imshow(GP);handles.img=GP;else

g1=g;

g2=imfilter(g1,h);g3=imadd(g2,g1);imshow(g3);handles.img=g3;end

guidata(hObject,handles);

%Executesonselectionchangeinpopupmenu5.

functionpopupmenu5_Callback(hObject,eventdata,handles)%hObjecthandletopopupmenu5(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Hints:contents=cellstr(get(hObject,'String'))returnspopupmenu5contentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompopupmenu5

%Executesduringobjectcreation,aftersettingallproperties.functionpopupmenu5_CreateFcn(hObject,eventdata,handles)%hObjecthandletopopupmenu5(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.

ifispcend

%Executesonselectionchangeinpopupmenu6.

functionpopupmenu6_Callback(hObject,eventdata,handles)%hObjecthandletopopupmenu6(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Hints:contents=cellstr(get(hObject,'String'))returnspopupmenu6contentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompopupmenu6

%Executesduringobjectcreation,aftersettingallproperties.functionpopupmenu6_CreateFcn(hObject,eventdata,handles)%hObjecthandletopopupmenu6(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.

ifispcend

%Executesonbuttonpressinpushbutton10.

functionpushbutton10_Callback(hObject,eventdata,handles)%檢測

%hObjecthandletopushbutton10(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

str=get(handles.popupmenu4,'value');axes(handles.axes2);

ifnumel(size(handles.img))>2I=handles.img;switchstrcase1

T=handles.img;img=I;

[xyz]=size(img);ifz==1

rslt=edge(img,'Roberts');elseifz==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'Roberts');dx1=(dx1*255);img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2);img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2));end

imshow(rslt);handles.img=rslt;

guidata(hObject,handles);case2

T=handles.img;img=I;

[xyz]=size(img);ifz==1

rslt=edge(img,'sobel');elseifz==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'sobel');dx1=(dx1*255);img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2);img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2));end

imshow(rslt);handles.img=rslt;

guidata(hObject,handles);case3

T=handles.img;img=I;

[xyz]=size(img);ifz==1

rslt=edge(img,'Prewitt');elseifz==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'Prewitt');dx1=(dx1*255);img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2);img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2));end

imshow(rslt);handles.img=rslt;

guidata(hObject,handles);case4

T=handles.img;img=I;

[xyz]=size(img);ifz==1

rslt=edge(img,'log');elseifz==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'log');

dx1=(dx1*255);img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2);img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2));end

imshow(rslt);handles.img=rslt;

guidata(hObject,handles);case5

T=handles.img;img=I;

[xyz]=size(img);ifz==1

rslt=edge(img,'canny');elseifz==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'canny');dx1=(dx1*255);img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2);img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2));end

imshow(rslt);handles.img=rslt;

guidata(hObject,handles);endelse

g1=handles.img;switchstrcase1

T=handles.img;

g2=edge(g1,'Roberts');imshow(g2);handles.img=g2;

guidata(hObject,handles);case2

T=handles.img;g2=edge(g1,'sobel');imshow(g2);handles.img=g2;

guidata(hObject,handles);case3

T=handles.img;

g2=edge(g1,'Prewitt');imshow(g2);handles.img=g2;

guidata(hObject,handles);case4

T=handles.img;g2=edge(g1,'log');imshow(g2);handles.img=g2;

guidata(hObject,handles);case5

T=handles.img;

g2=edge(g1,'canny');imshow(g2);handles.img=g2;

guidata(hObject,handles);endend

%Executesonselectionchangeinpopupmenu4.

functionpopupmenu4_Callback(hObject,eventdata,handles)%hObjecthandletopopupmenu4(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Hints:contents=cellstr(get(hObject,'String'))returnspopupmenu4contentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompopupmenu4

%Executesduringobjectcreation,aftersettingallproperties.functionpopupmenu4_CreateFcn(hObject,eventdata,handles)%hObjecthandletopopupmenu4(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.

ifispcend

%Executesonbuttonpressinpushbutton8.

functionpushbutton8_Callback(hObject,eventdata,handles)%翻轉(zhuǎn)

%hObjecthandletopushbutton8(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

str=get(handles.popupmenu2,'value');axes(handles.axes2);I=handles.img;ifnumel(size(I))>2switchstrcase1

T=handles.img;b=I(:,:,1);c=I(:,:,2);d=I(:,:,3);

I1(:,:,1)=fliplr(b);I1(:,:,2)=fliplr(c);I1(:,:,3)=fliplr(d);case2

T=handles.img;b=I(:,:,1);c=I(:,:,2);d=I(:,:,3);

I1(:,:,1)=flipud(b);I1(:,:,2)=flipud(c);I1(:,:,3)=flipud(d);end

imshow(I1);handles.img=I1;

guidata(hObject,handles);else

switchstrcase1

T=handles.img;f=fliplr(I);case2

T=handles.img;f=flipud(I);end

imshow(f);handles.img=f;

guidata(hObject,handles);end

%Executesonbuttonpressinpushbutton9.

functionpushbutton9_Callback(hObject,eventdata,handles)%旋轉(zhuǎn)

%hObjecthandletopushbutton9(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

T=handles.img;

str=get(handles.popupmenu3,'value');axes(handles.axes2);

prompt={'請輸入旋轉(zhuǎn)角度:'};defans={'0'};

p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});switchstrcase1

p1=-p1;case2

p1=p1;end

f=imrotate(handles.img,p1,'bilinear','crop');imshow(f);handles.img=f;

guidata(hObject,handles);

%Executesonselectionchangeinpopupmenu1.

functionpopupmenu2_Callback(hObject,eventdata,handles)%hObjecthandletopopupmenu1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Hints:contents=cellstr(get(hObject,'String'))returnspopupmenu1contentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompopupmenu1

%Executesduringobjectcreation,aftersettingallproperties.functionpopupmenu2_CreateFcn(hObject,eventdata,handles)%hObjecthandletopopupmenu1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.

%SeeISPCandCOMPUTER.

ifispcend

%Executesonselectionchangeinpopupmenu3.

functionpopupmenu3_Callback(hObject,eventdata,handles)%hObjecthandletopopupmenu3(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Hints:contents=cellstr(get(hObject,'String'))returnspopupmenu3contentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompopupmenu3

%Executesduringobjectcreation,aftersettingallproperties.functionpopupmenu3_CreateFcn(hObject,eventdata,handles)%hObjecthandletopopupmenu3(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.

ifispcend

%Executesonbuttonpressinpushbutton6.

functionpushbutton6_Callback(hObject,eventdata,handles)%亮度調(diào)理

%hObjecthandletopushbutton6(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

axes(handles.axes2);T=handles.img;

prompt={'調(diào)整倍數(shù)([0,1]:明[1,~):暗)'};defans={'1'};

p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});

y=imadjust(handles.img,[],[],p1);%亮度調(diào)理imshow(y);

handles.img=y;

guidata(hObject,handles);

%Executesonbuttonpressinpushbutton7.

functionpushbutton7_Callback(hObject,eventdata,handles)%對比度調(diào)理按鈕

%hObjecthandletopushbutton7(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

str=get(handles.popupmenu1,'value');axes(handles.axes2);T=handles.img;

prompt={'請輸入?yún)?shù):'};defans={'1'};

p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});switchstrcase1

f=immultiply(handles.img,p1);imshow(f);handles.img=f;

guidata(hObject,handles);case2

f=imdivide(handles.img,p1);imshow(f);handles.img=f;

guidata(hObject,handles);end

%Executesonselectionchangeinpopupmenu1.

functionpopupmenu1_Callback(hObject,eventdata,handles)%hObjecthandletopopupmenu1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Hints:contents=cellstr(get(hObject,'String'))returnspopupmenu1contentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompopupmenu1

%Executesduringobjectcreation,aftersettingallproperties.functionpopupmenu1_CreateFcn(hObject,eventdata,handles)%hObjecthandletopopupmenu1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.

ifispcend

%Executesonbuttonpressinpushbutton4.

functionpushbutton4_Callback(hObject,eventdata,handles)%撤消

%hObjecthandletopushbutton4(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

handles.img=T;

axes(handles.axes2);imshow(T);

guidata(hObject,handles);

%Executesonbuttonpressinpushbutton5.

functionpushbutton5_Callback(hObject,eventdata,handles)%還原

%hObjecthandletopushbutton5(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalSy=imread(S);

axes(handles.axes2);imshow(y);handles.img=y;

guidata(hObject,handles);

%Executesonbuttonpressinpushbutton1.

functionpushbutton1_Callback(hObject,eventdata,handles)%圖像轉(zhuǎn)化為灰度圖像

%hObjecthandletopushbutton1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)globalT

%設(shè)計一個全局變量T,保存初始圖像路徑,以便之后的撤銷操作axes(handles.axes2);T=handles.img;img=handles.img;ifnumel(size(img))>2C=rgb2gray(img);else

C=img;end

imshow(C);handles.img=C;

guidata(hObject,handles);

%Executesonbuttonpressinpushbutton

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論