MATLAB中GUI图像处理

来源:互联网 发布:mac软件宝箱10.7.5 编辑:程序博客网 时间:2024/04/29 12:42

1、设计目的:综合运用MATLAB工具箱实现图像处理的GUI程序设计, 利用MATLAB图像处理工具箱,设计和实现自己的Photoshop 。

 

2、题目分析 

利用matlab的GUI程序设计一个简单实用的图像处理程序。该程序应具备图像处理的常用功能,以满足用户的使用。现设计程序有以下基本功能:

1)图像的读取和保存。

2)设计图形用户界面,让用户能够对图像进行任意的亮度和对比度变化调整,显示和对比变换前后的图像。

3)设计图形用户界面,让用户能够用鼠标选取图像感兴趣区域,显示和保存该选择区域。

4)编写程序通过最近邻插值和双线性插值等算法将用户所选取的图像区域进行放大和缩小整数倍的操作,并保存,比较几种插值的效果。

5)图像直方图统计和直方图均衡,要求显示直方图统计,比较直方图均衡后的效果。

6)能对图像加入各种噪声,并通过几种滤波算法实现去噪并显示结果。

7)额外功能。

 

3、总体设计

 

                         图一

软件的总体设计界面布局如上图所示,主要分为2个部分:显示区域与操作区域。

显示区域:显示载入原图,以及通过处理后的图像。

操作区域:通过功能键实现对图像的各种处理。

在截图中可见,左部为一系列功能按键如“还原”、“撤销”、“截图”等等 ;界面正中部分为图片显示部分,界面中下方为系列功能切换选择组。

设计完成后运行的软件界面如下:

                        图二

 与图一先比,运行后的界面更为简洁。

利用“编辑”菜单可调出相应的功能键。例如:

 

4、具体设计

现介绍各个功能模块的功能与实现。

4.1菜单栏的设计

通过Menu Editor创建如下菜单,通过以下菜单来控制显示或隐藏功能按键

以“编辑”菜单中“图像变形”中的“图像翻转”为例说明实现用户界面功能键“图像翻转”的显示与隐藏。

实现该功能的程序段如下:

function tuxiangfanzhuan_Callback(hObject,eventdata, handles)

% hObject    handle to tuxiangfanzhuan (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

set(handles.uipanel7,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

   set(handles.uipanel7,'Visible','on');

    set(gcbo, 'Checked', 'off');

    set(handles.uipanel7,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

该段程序通过设置“图像翻转”功能键对应的句柄uipanel7中的“Visible”属性的开关来实现该功能键的显示隐藏。其他同理。

4.2图像的读取和保存。

     (1)利用“文件”菜单中的“打开”、“保存为…”分别实现图片的读取与保存。

      

 

利用matlab中 “ uigetfile”、“imread”“imshow”实现图像文件的读取与显示:

function openfile_Callback(hObject,eventdata, handles)

% hObject    handle to openfile (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

 

[filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.tif';'*.*'},'载入图像');

if isequal(filename,0)|isequal(pathname,0)

   errordlg('没有选中文件','出错');

   return;

else

  file=[pathname,filename];

  global S   %设置一个全局变量S,保存初始图像路径,以便之后的还原操作

  S=file;

  x=imread(file);

  set(handles.axes1,'HandleVisibility','ON');

  axes(handles.axes1);

  imshow(x);

  set(handles.axes1,'HandleVisibility','OFF');

  axes(handles.axes2);

  imshow(x);

  handles.img=x;

  guidata(hObject,handles);

end

 

程序关键部分:

通过[filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.tif';'*.*'},'载入图像')选择相应路径打开的图像;通过file=[pathname,filename]; x=imread(file); 读取选中的图像;最后,通过imshow(x)在显示区域上显示图像。

 

 

(2)图像保存。

利用“uiputfile”、“imwrite”函数实现图像文件的保存。

function save_Callback(hObject, eventdata,handles)

% hObject    handle to save (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

 [sfilename ,sfilepath]=uiputfile({'*.jpg';'*.bmp';'*.tif';'*.*'},'保存图像文件','untitled.jpg');

  if ~isequal([sfilename,sfilepath],[0,0])

      sfilefullname=[sfilepath ,sfilename];

     imwrite(handles.img,sfilefullname);

  else

      msgbox('你按了取消键','保存失败');

  end

 

程序关键部分:

通[sfilename ,sfilepath]=uiputfile({'*.jpg';'*.bmp';'*.tif';'*.*'},'保存图像文件','untitled.jpg')选择图像文件保存的路径与格式;然后,通过sfilefullname=[sfilepath,sfilename];

imwrite(handles.img,sfilefullname);实现对图像的保存。

 

(3)程序的退出。

     function exit_Callback(hObject, eventdata,handles)

% hObject    handle to exit (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

clc;

close all;

close(gcf);

clear;

 

4.3对图像进行任意的亮度和对比度变化调整,显示和对比变换前后的图像。

    运行程序后,通过“编辑”菜单中的“常用处理”选中“亮度调节”

在显示出相应的功能键后,通过载入读取图像,比并进行处理,效果如下:

亮度处理前:

  亮度处理后:

实现程序段如下:

% --- Executes on buttonpress in radiobutton12.

function radiobutton12_Callback(hObject,eventdata, handles)

% hObject    handle to radiobutton12 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

 

% Hint: get(hObject,'Value')returns toggle state of radiobutton12

global T

axes(handles.axes2);

T=getimage;

 prompt={'调整倍数'};

 defans={'1'};

 p=inputdlg(prompt,'input',1,defans);

 p1=str2num(p{1});

 y=imadjust(handles.img,[ ], [ ],p1);       %亮度调节

 imshow(y);

 handles.img=y;

 guidata(hObject,handles);

 

 

 

对比度处理前:

对比度处理后(增强3倍):

对比度减弱1.5倍后:

实现程序段如下:

function uipanel10_SelectionChangeFcn(hObject,eventdata, handles)

% hObject    handle to uipanel10 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

global T

str=get(hObject,'string');

axes(handles.axes2);

 

switch str

 case'增强'

        T=getimage;

         prompt={'输入参数:'};

         defans={'1'};

          p=inputdlg(prompt,'input',1,defans);

          p1=str2num(p{1});

          f=immultiply(handles.img,p1);          

          imshow(f);

          handles.img=f;

          guidata(hObject,handles);

  case'减弱'

       T=getimage;

         prompt={'输入参数:'};

         defans={'1'};

         p=inputdlg(prompt,'input',1,defans);

         p1=str2num(p{1});

         f=imdivide(handles.img,p1);            

         imshow(f);

         handles.img=f;

         guidata(hObject,handles);

end

 

  该程序段主要通过 f=immultiply(handles.img,p1);  p=inputdlg(prompt,'input',1,defans);

分别实现图像对比度的增强与减弱。

 

  4.4 用鼠标选取图像感兴趣区域,显示和保存该选择区域

  通过imcrop(x)函数来实现对图片某一区域的截取,截取的图片在右框中显示。结合“保存为…”,可把截图处理后的图片保存在指定路径。

实现程序段如下:

 

% --- Executes on buttonpress in pushbutton1.

function pushbutton1_Callback(hObject,eventdata, handles)

% hObject    handle to pushbutton1 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

global T

axes(handles.axes2);

T=getimage;

x=imcrop(handles.img);             %截图

imshow(x);

handles.img=x;

guidata(hObject,handles);

 

4.5 图像转化为灰度图像。

由于在matlab中较多的图像处理函数支持对灰度图像进行处理,故对图像进行灰度转化十分必要。可利用rgb2gray(X)函数对其他图像进行灰度图像的转化。

转化实例如下:

实现程序段如下:

% --- Executes on buttonpress in radiobutton16.

function radiobutton16_Callback(hObject,eventdata, handles)

% hObject    handle to radiobutton16 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

 

% Hint: get(hObject,'Value')returns toggle state of radiobutton16

 global T

axes(handles.axes2);

T=getimage;

x=rgb2gray(handles.img);            %RGBͼÏñת»»Îª»Ò¶ÈͼÏñ

imshow(x);

handles.img=x;

guidata(hObject,handles);

 

4.6对图像进行放大和缩小整数倍的操作。

通过imresize(X,n,mode)函数对图像X进行放大或者缩小。N放大缩小倍数,mode为采用的方式。      

通过处理后可发现保存的图片的比原图放大了(缩小了)。

实现的程序段如下:

functionuipanel9_SelectionChangeFcn(hObject, eventdata, handles)

% hObject    handle to uipanel9 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

global T

str=get(hObject,'string');

axes(handles.axes2);

switch str

 case'最近邻插值'

      T=getimage;

         prompt={'输入参数:'};

         defans={'2'};

        p=inputdlg(prompt,'input',1,defans);

         p1=str2num(p{1});

         f=imresize(handles.img,p1,'nearest');          

         imshow(f);

         handles.img=f;

        guidata(hObject,handles);

         

  case'双线性插值'

       T=getimage;

        prompt={'输入参数:'};

         defans={'1'};

         p=inputdlg(prompt,'input',1,defans);

         p1=str2num(p{1});

         f=imresize(handles.img,p1,'bilinear');            

         imshow(f);

         handles.img=f;

         guidata(hObject,handles);

end

 

4.7图像直方图统计和直方图均衡。

 (1)通过histeq(X)函数实现直方图均衡。

因为此函数只能对灰度图像进行直方图均衡。故应先将彩图转为灰度图像。

 

在上一步的基础上对第二幅图进行直方图均衡:

直方图均衡实现程序段如下:
% --- Executes on button press in pushbutton7.

function pushbutton7_Callback(hObject,eventdata, handles)

% hObject    handle to pushbutton7 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

global T

axes(handles.axes2);

T=getimage;

h=histeq(handles.img);                  

imshow(h);

handles.img=h;

guidata(hObject,handles);

关键部分:通过 h=histeq(handles.img)进行直方图均衡 

(2)直方图统计。通过利用imhist(X)函数来实现直方图统计。

% --- Executes on buttonpress in pushbutton8.

function pushbutton8_Callback(hObject,eventdata, handles)

% hObject    handle to pushbutton8 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

axes(handles.axes2);

x=imhist(handles.img);  %直方图统计

x1=x(1:10:256);

horz=1:10:256;

bar(horz,x1);

axis([0 255 0 15000]);

set(handles.axes2,'xtick',0:50:255);

set(handles.axes2,'ytick',0:2000:15000);

注意:横纵坐标的范围应选取适当,否则,统计图表有可能超出范围。

4.8加入各种噪声,并通过几种滤波算法实现去噪。

(1)加入噪声。通过imnoise(I,type,parameters)来加入各种噪声。

 

加入椒盐噪声

加入高斯噪声:

加入乘性噪声:

实现程序段如下:

functionuipanel4_SelectionChangeFcn(hObject, eventdata, handles)

% hObject    handle to uipanel4 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

global T

str=get(hObject,'string');

axes(handles.axes2);

switch str

   case '椒盐噪声'

      T=getimage;

      prompt={'数日椒盐噪声参数1:'};

      defans={'0.02'};

      p=inputdlg(prompt,'input',1,defans);

      p1=str2num(p{1});

      f=imnoise(handles.img,'salt & pepper',p1);

      imshow(f);

      handles.img=f;

      guidata(hObject,handles);

   case 高斯噪声'

        T=getimage;

      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);   

   case '乘性噪声'

        T=getimage;

      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

(2)滤除噪声(椒盐噪声)。

滤波前

中值滤波后

线性滤波后

自适应滤波后

实现程序段如下:

functionuipanel5_SelectionChangeFcn(hObject, eventdata, handles)   %图像滤波

% hObject    handle to uipanel5 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

global T

str=get(hObject,'string');

axes(handles.axes2);

switch str

   case '中值滤波'

        T=getimage;

        k=medfilt2(handles.img);

        imshow(k);

        handles.img=k;

        guidata(hObject,handles);

   case '线性滤波'

        T=getimage;

        h=[1 1 1;1 1 1;1 1 1];

        H=h/9;

        i=double(handles.img);

        k=convn(i,h);

        imshow(k,[]);

        handles.img=k;

        guidata(hObject,handles);

   case '自适应滤波'

        T=getimage;

        k=wiener2(handles.img,[5,5]);

        imshow(k);

        handles.img=k;

        guidata(hObject,handles);

end

低通滤波器滤波后

高通滤波器滤波后

实现程序如下:

% --- Executes on buttonpress in pushbutton14.

function pushbutton14_Callback(hObject,eventdata, handles)

% hObject    handle to pushbutton14 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

 

axes(handles.axes2);

y1=handles.img;  

f=double(y1);      % 数据类型转换,matlab不支持图像的无符号整型的计算

g=fft2(f);      % 傅里叶变换

g=fftshift(g);      % 转换数据矩阵

[M,N]=size(g);

nn=2;       %二阶巴特沃斯低通滤波器

d0=50;            %截止频率50

m=fix(M/2); n=fix(N/2);

for i=1:M

       for j=1:N

           d=sqrt((i-m)^2+(j-n)^2);

           h=1/(1+0.414*(d/d0)^(2*nn));     % 计算低通滤波器传递函数

           result(i,j)=h*g(i,j);

       end

end

result=ifftshift(result);

y2=ifft2(result);

y3=uint8(real(y2));

imshow(y3);                                 % 显示处理后的图像

 

 

 

 

% --- Executes on buttonpress in pushbutton15.

function pushbutton15_Callback(hObject,eventdata, handles)

% hObject    handle to pushbutton15 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

 

axes(handles.axes2);

x=(handles.img);

               

f=double(x);                            % 数据类型转换

k=fft2(f);                                % 傅里叶变换

g=fftshift(k);                             % 转换数据矩阵

[M,N]=size(g);

nn=2;

d0=25;                                  %截止频率25

m=fix(M/2); n=fix(N/2);

for i=1:M

        for j=1:N

            d=sqrt((i-m)^2+(j-n)^2);        % 计算高通滤波器传递函数

            if d<=d0

                h=0;

            else h=1;

            end

            result(i,j)=h*g(i,j);

        end

end

result=ifftshift(result);

y2=ifft2(result);

y3=uint8(real(y2));

imshow(y3);                               %显示滤波处理后的图像

 

4.9还原

  通过一个全局变量保存原始图像路径,在需要还原至原始图像时,重新读取该全局变量即可。

实现程序段如下:

% --- Executes on buttonpress in pushbutton9.

function pushbutton9_Callback(hObject,eventdata, handles)

% hObject    handle to pushbutton9 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

   global S                            %还原

   axes(handles.axes2);

   y=imread(S);

   f=imshow(y);

   handles.img=y;

guidata(hObject,handles);

 

4.10 撤销。

  撤销上一步的操作。通过另设一个全局变量T保存是上一次操作后的图像。

实现程序段如下:

--- Executes on button pressin pushbutton11.

function pushbutton11_Callback(hObject,eventdata, handles)

% hObject    handle to pushbutton11 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

axes(handles.axes2);    %撤销

global T

imshow(T);

handles.img=T;

guidata(hObject,handles);

  该程序段只是简单的显示图像的功能,其中全局变量T中储存的是上一步操作处理后的图像信息。在以上的各段功能程序段中可见均有 “T=getimage;”,此句把当前操作前的图像,即上一次操作后的图像信息赋予全局变量T。

 

4.11 图像变形。

(1)图像翻转。实现图像的镜像翻转。

左右翻转:

 

上下翻转

实现程序如下:

functionuipanel7_SelectionChangeFcn(hObject, eventdata, handles) %图像翻转

% hObject    handle to uipanel7 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

str=get(hObject,'string');

axes(handles.axes2);

global T

switch str

   case '左右翻转'

        T=handles.img;

       f=fliplr(handles.img);

       imshow(f);

       handles.img=f;

       guidata(hObject,handles); 

   case '上下翻转'

        T=handles.img;

         f=flipud(handles.img);

         imshow(f);

         handles.img=f;

         guidata(hObject,handles); 

end

程序关键部分:通过f=fliplr(handles.img);  f=flipud(handles.img);分别实现左右镜像翻转与上下镜像翻转。

(2)图像旋转。

实现图像的逆时针旋转任意角度。

 

 

实现程序段如下:

 

function pushbutton3_Callback(hObject,eventdata, handles)     %图像爱那个旋转

% hObject    handle to pushbutton3 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

global T

axes(handles.axes2);

T=getimage;

prompt={'旋转角度:'};

defans={'0'};

 p=inputdlg(prompt,'input',1,defans);

p1=str2num(p{1});

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

imshow(f);

handles.img=f;

guidata(hObject,handles);

 关键部分:通过p=inputdlg(prompt,'input',1,defans);p1=str2num(p{1});   来输入旋转参数。

通过函数f=imrotate(handles.img,p1,'bilinear','crop');实现翻转。

 

4.12特殊处理

(1)底片效果。将图像变为底片,并显示。

实现程序如下:

% --- Executes on buttonpress in pushbutton12.

function pushbutton12_Callback(hObject,eventdata, handles)

% hObject    handle to pushbutton12 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

global T

axes (handles.axes2);

T=getimage;

f=imcomplement(handles.img);  %图像取反´

imshow(f);

handles.img=f;

guidata(hObject,handles);

 

  程序段关键部分:通过f=imcomplement(handles.img);实现图像取反,形成底片效果。

(2)边缘信息。采取图像的边缘信息。

实现程序段如下:

% --- Executes on buttonpress in pushbutton16.

function pushbutton16_Callback(hObject,eventdata, handles)

% hObject    handle to pushbutton16 (see GCBO)

% eventdata  reserved - to be defined in a future versionof MATLAB

% handles    structure with handles and user data (seeGUIDATA)

global T

axes(handles.axes2);

 T=getimage;

f=edge(handles.img,'canny');

imshow(f);

handles.img=f;

guidata(hObject,handles);

  程序关键部分:通过f=edge(handles.img,'canny');是实现边缘信息的获取。

 

 

 

5、结果分析

软件测试基本成功,课题所要求的功能均能较好实现。但一些功能只支持灰度图像的处理。

其中值得一提的是在滤波处理中的低通滤波与高通滤波的效果。由于一般图像中含有较多的低频信息成分高频成分较少,通过低通滤波后,噪声以及高频成分被滤除,图像虽有少量失真,略显模糊,但尚可辨识。但若是通过高通滤波后,大量的有效低频信息被滤除,图像严重失真,不可辨识。

 

6、心得体会

通过为期两周的matlab课程设计实践,使我对matlab的使用有了进一步的了解和熟悉。

   当我第一次拿到此次的课题时,感到有些无所适从。虽然,曾经学习过matlab的课程,在课程的考核中也取得了较好的成绩,但由于对matlab的学习更多的只是停留在理论上的学习,在课时内的试验也只是简单的基础性试验,所以对matlab实际运用不是很熟练。

虽然对课题感到很懵懂,但在郑老师的简单提示与指导后,我开始找到了解决问题的路径。我选择的是“利用matlab的GUI程序设计一个简单实用的图像处理程序”这一课题。本课题的重点是句柄的使用、GUI的使用以及matlab中相关图像处理函数使用。

   为此,在实践正式开始前,我利用课余时间,重新复习了matlab教材,专门借阅了利用matlab进行图像处理的相关教程,通过索引网络上的相关资料,为课设做了较为充分的准备。在参考了相关材料及源程序,我对自己要做的课设内容有了进一步的了解,并对matlab的使用有了更深的体会。

   当然,在课设的进行过程中,我还是遇到了不少问题。例如,起初由于我对句柄使用以及一些函数使用的不恰当,使得在对图像文件的保存上就遇到了问题,不过最后还是在老师的提示下解决了。随着课设的进行,对matlab的的熟悉度逐步加深。在基本功不断扎实的基础上,我开始进行一些扩张功能的尝试,比如还原操作、对功能键实现显示和隐藏的功能、实现撤销多次前操作等。其中前两个较为成功的完成,但在第三个功能上出现了些问题,由于对matlab中数组结构体与循环套用使用的不当,到实践结束之际也未实现所犯的错误,只能退而求次,实现执行撤销功能(恢复到上次操作),不能不说不是一个遗憾……

   但是,总体来说,此次的课程设计,还是较为满意的。它不但鞭策着我去巩固matlab的基础理论知识,还提高了我对matlab的实际操作运用,使得理论与实践相结合,为进一步学习matlab打下坚实的基础;同时,在实践的工程中,也让我体会到一种努力付出并得到回报的满足感觉。  

 

参考书目:(五号,宋体加粗)

[1]       《MATLAB实用教程》      郑阿奇       电子工业出版社

[2]    《MATLAB仿真在信号处理中的应用》 徐明远 刘增力  西安电子科技大学出版社

 

 


附录:(五号,宋体加粗)

 

 

function varargout = tuxiangchuli(varargin)

% TUXIANGCHULI M-file for tuxiangchuli.fig

%     TUXIANGCHULI, by itself, creates a new TUXIANGCHULI or raises theexisting

%      singleton*.

%

%      H =TUXIANGCHULI returns the handle to a new TUXIANGCHULI or the handle to

%      the existingsingleton*.

%

%      TUXIANGCHULI('CALLBACK',hObject,eventData,handles,...)calls the local

%      functionnamed CALLBACK in TUXIANGCHULI.M with the given input arguments.

%

%     TUXIANGCHULI('Property','Value',...) creates a new TUXIANGCHULI orraises the

%      existingsingleton*.  Starting from the left,property value pairs are

%      applied tothe GUI before tuxiangchuli_OpeningFunction gets called.  An

%      unrecognizedproperty name or invalid value makes property application

%      stop.  All inputs are passed to tuxiangchuli_OpeningFcnvia varargin.

%

%      *See GUIOptions on GUIDE's Tools menu.  Choose"GUI allows only one

%      instance torun (singleton)".

%

% See also: GUIDE, GUIDATA, GUIHANDLES

 

% Edit the above text to modify the response to helptuxiangchuli

 

% Last Modified by GUIDE v2.5 14-Mar-2009 21:34:50

 

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name',       mfilename,...

                   'gui_Singleton',  gui_Singleton,...

                   'gui_OpeningFcn',@tuxiangchuli_OpeningFcn,...

                   'gui_OutputFcn',  @tuxiangchuli_OutputFcn,...

                   'gui_LayoutFcn',  [] ,...

                   'gui_Callback',   []);

if nargin && ischar(varargin{1})

   gui_State.gui_Callback = str2func(varargin{1});

end

 

if nargout

   [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

else

   gui_mainfcn(gui_State, varargin{:});

end

% End initialization code - DO NOT EDIT

 

 

% --- Executes just before tuxiangchuli is made visible.

function tuxiangchuli_OpeningFcn(hObject, eventdata,handles, varargin)

% This function has no output args, see OutputFcn.

% hObject    handleto figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

% varargin  command line arguments to tuxiangchuli (see VARARGIN)

 

% Choose default command line output for tuxiangchuli

handles.output = hObject;

 

% Update handles structure

guidata(hObject, handles);

 

% UIWAIT makes tuxiangchuli wait for user response (seeUIRESUME)

% uiwait(handles.figure1);

 

 

% --- Outputs from this function are returned to thecommand line.

function varargout = tuxiangchuli_OutputFcn(hObject,eventdata, handles)

% varargout  cellarray for returning output args (see VARARGOUT);

% hObject    handleto figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

% Get default command line output from handles structure

varargout{1} = handles.output;

 

 

%--------------------------------------------------------------------

function file_Callback(hObject, eventdata, handles)

% hObject    handleto file (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

 

%--------------------------------------------------------------------

function exit_Callback(hObject, eventdata, handles)

% hObject    handleto exit (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

clc;

close all;

close(gcf);

clear;

 

%--------------------------------------------------------------------

function openfile_Callback(hObject, eventdata,handles)

% hObject    handleto openfile (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

[filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.tif';'*.*'},'ÔØÈëͼÏñ');

if isequal(filename,0)|isequal(pathname,0)

    errordlg('ûÓÐÑ¡ÖÐÎļþ','³ö´í');

    return;

else

  file=[pathname,filename];

   global%ÉèÖÃÒ»¸öÈ«¾Ö±äÁ¿S£¬±£´æ³õʼͼÏñ·¾¶£¬ÒÔ±ãÖ®ºóµÄ»¹Ô­²Ù×÷

   S=file;

   x=imread(file);

  

   set(handles.axes1,'HandleVisibility','ON');

  axes(handles.axes1);

   imshow(x);

  

  set(handles.axes1,'HandleVisibility','OFF');

  axes(handles.axes2);

   imshow(x);

   handles.img=x;

  guidata(hObject,handles);

end

 

% --------------------------------------------------------------------

function about_Callback(hObject, eventdata, handles)

% hObject    handleto about (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

msgbox('ÕâÊÇÒ»¸öGUIµÄͼÏñ´¦Àí³ÌÐò','¹ØÓÚ');

 

%--------------------------------------------------------------------

function help_Callback(hObject, eventdata, handles)

% hObject    handleto help (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

 

%--------------------------------------------------------------------

function save_Callback(hObject, eventdata, handles)

% hObject    handleto save (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 [sfilename,sfilepath]=uiputfile({'*.jpg';'*.bmp';'*.tif';'*.*'},£´æͼÏñÎļþ','untitled.jpg');

   if~isequal([sfilename,sfilepath],[0,0])

     sfilefullname=[sfilepath ,sfilename];

    imwrite(handles.img,sfilefullname);

   else

      msgbox('Äã°´ÁËÈ¡Ïû¼ü£¡',£´æʧ°Ü');

   end

 

 

 

 

 

 

% --- Executes on button press in radiobutton12.

function radiobutton12_Callback(hObject, eventdata,handles)

% hObject    handleto radiobutton12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

% Hint: get(hObject,'Value') returns toggle state of radiobutton12

global T

axes(handles.axes2);

T=getimage;

 prompt={'µ÷Õû±¶Êý'};

 defans={'1'};

 p=inputdlg(prompt,'input',1,defans);

 p1=str2num(p{1});

 y=imadjust(handles.img,[ ], [ ],p1);       %ÔöÁÁͼÏñ

 imshow(y);

 handles.img=y;

 guidata(hObject,handles);

 

 

 

%--------------------------------------------------------------------

function uipanel4_SelectionChangeFcn(hObject,eventdata, handles)

% hObject    handleto uipanel4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

global T

str=get(hObject,'string');

axes(handles.axes2);

switch str

    case '½·ÑÎÔëÉù'

      T=getimage;

      prompt={'ÊäÈë½·ÑÎÔëÉù²ÎÊý1:'};

      defans={'0.02'};

     p=inputdlg(prompt,'input',1,defans);

     p1=str2num(p{1});

     f=imnoise(handles.img,'salt & pepper',p1);

      imshow(f);

     handles.img=f;

     guidata(hObject,handles);

    case '¸ß˹ÔëÉù'

        T=getimage;

      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);   

    case '³ËÐÔÔëÉù'

        T=getimage;

      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

 

 

 

 

 

% --- Executes on button press in radiobutton16.

function radiobutton16_Callback(hObject, eventdata,handles)

% hObject    handleto radiobutton16 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

% Hint: get(hObject,'Value') returns toggle state ofradiobutton16

 global T

axes(handles.axes2);

T=getimage;

x=rgb2gray(handles.img);            %RGBͼÏñת»»Îª»Ò¶ÈͼÏñ

imshow(x);

handles.img=x;

guidata(hObject,handles);

 

 

% --- Executes on button press in pushbutton1.

function pushbutton1_Callback(hObject, eventdata,handles)

% hObject    handleto pushbutton1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

global T

axes(handles.axes2);

T=getimage;

x=imcrop(handles.img);             %½Øͼ

imshow(x);

handles.img=x;

guidata(hObject,handles);

 

 

 

% --- Executes on button press in pushbutton3.

function pushbutton3_Callback(hObject, eventdata,handles)     %ͼƬÐýת

% hObject    handleto pushbutton3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

global T

axes(handles.axes2);

T=getimage;

prompt={'Ðýת½Ç¶È:'};

defans={'0'};

 p=inputdlg(prompt,'input',1,defans);

p1=str2num(p{1});

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

imshow(f);

handles.img=f;

guidata(hObject,handles);

 

 

 

 

% Hint: popupmenu controls usually have a whitebackground on Windows.

%       See ISPCand COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');

end

 

 

 

 

 

 

 

 

 

% --------------------------------------------------------------------

function uipanel5_SelectionChangeFcn(hObject,eventdata, handles)   %ͼÏñÂ˲¨

% hObject    handleto uipanel5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles    structurewith handles and user data (see GUIDATA)

global T

str=get(hObject,'string');

axes(handles.axes2);

switch str

    case 'ÖÐÖµÂ˲¨'

        T=getimage;

        k=medfilt2(handles.img);

        imshow(k);

        handles.img=k;

       guidata(hObject,handles);

    case 'ÏßÐÔÂ˲¨'

        T=getimage;

        h=[1 1 1;1 1 1;1 1 1];

        H=h/9;

        i=double(handles.img);

       k=convn(i,h);

       imshow(k,[]);

       handles.img=k;

       guidata(hObject,handles);

    case ÔÊÊÓ¦Â˲¨'

        T=getimage;

        k=wiener2(handles.img,[5,5]);

        imshow(k);

       handles.img=k;

       guidata(hObject,handles);

end

 

 

 

 

 

 

 

%--------------------------------------------------------------------

function uipanel7_SelectionChangeFcn(hObject,eventdata, handles) %¾µÏñ·­×ª

% hObject    handleto uipanel7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

str=get(hObject,'string');

axes(handles.axes2);

global T

switch str

    case '×óÓÒ·­×ª'

       T=handles.img;

      f=fliplr(handles.img);

       imshow(f);

      handles.img=f;

      guidata(hObject,handles); 

    case 'ÉÏÏ·­×ª'

       T=handles.img;

        f=flipud(handles.img);

         imshow(f);

        handles.img=f;

        guidata(hObject,handles); 

end

   

 

 

% --- Executes on button press in pushbutton7.

function pushbutton7_Callback(hObject, eventdata,handles)

% hObject    handleto pushbutton7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

global T

axes(handles.axes2);

T=getimage;

h=histeq(handles.img);                      %Ö±·½Í¼¾ùºâ

imshow(h);

handles.img=h;

guidata(hObject,handles);

 

 

% --- Executes on button press in pushbutton8.

function pushbutton8_Callback(hObject, eventdata,handles)

% hObject    handleto pushbutton8 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles    structurewith handles and user data (see GUIDATA)

axes(handles.axes2);

x=imhist(handles.img); %Ö±·½Í¼Í³¼Æ

x1=x(1:10:256);

horz=1:10:256;

bar(horz,x1);

axis([0 255 0 15000]);

set(handles.axes2,'xtick',0:50:255);

set(handles.axes2,'ytick',0:2000:15000);

 

 

 

 

%--------------------------------------------------------------------

function uipanel9_SelectionChangeFcn(hObject,eventdata, handles)

% hObject    handleto uipanel9 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

global T

str=get(hObject,'string');

axes(handles.axes2);

switch str

  caseî½üÁÚ²åÖµ'

      T=getimage;

         prompt={'ÊäÈë²ÎÊý:'};

         defans={'2'};

        p=inputdlg(prompt,'input',1,defans);

        p1=str2num(p{1});

        f=imresize(handles.img,p1,'nearest');          

         imshow(f);

        handles.img=f;

       guidata(hObject,handles);

         

   case'Ë«ÏßÐÔ²åÖµ'

       T=getimage;

         prompt={'ÊäÈë²ÎÊý:'};

         defans={'1'};

        p=inputdlg(prompt,'input',1,defans);

        p1=str2num(p{1});

        f=imresize(handles.img,p1,'bilinear');            

         imshow(f);

        handles.img=f;

        guidata(hObject,handles);

end

 

 

 

% --- Executes on button press in pushbutton9.

function pushbutton9_Callback(hObject, eventdata,handles)

% hObject    handleto pushbutton9 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

    global S                            %»¹Ô­¹¦ÄÜ

   axes(handles.axes2);

    y=imread(S);

   f=imshow(y);

   handles.img=y;

   guidata(hObject,handles);

 

 

 

 

 

% --- Executes on button press in pushbutton11.

function pushbutton11_Callback(hObject, eventdata,handles)

% hObject    handleto pushbutton11 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

axes(handles.axes2);   %³·Ïú¹¦ÄÜ

global T

imshow(T);

handles.img=T;

guidata(hObject,handles);

 

%--------------------------------------------------------------------

function uipanel10_SelectionChangeFcn(hObject,eventdata, handles)

% hObject    handleto uipanel10 (see GCBO)

% eventdata  reserved- to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

global T

str=get(hObject,'string');

axes(handles.axes2);

 

switch str

  case'ÔöÇ¿'

        T=getimage;

         prompt={'ÊäÈë²ÎÊý:'};

         defans={'1'};

         p=inputdlg(prompt,'input',1,defans);

         p1=str2num(p{1});

         f=immultiply(handles.img,p1);          

         imshow(f);

         handles.img=f;

         guidata(hObject,handles);

   case'¼õÈõ'

       T=getimage;

         prompt={'ÊäÈë²ÎÊý:'};

         defans={'1'};

        p=inputdlg(prompt,'input',1,defans);

         p1=str2num(p{1});

         f=imdivide(handles.img,p1);            

         imshow(f);

        handles.img=f;

        guidata(hObject,handles);

end

 

 

% --- Executes on button press in pushbutton12.

function pushbutton12_Callback(hObject, eventdata,handles)

% hObject    handleto pushbutton12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

global T

axes (handles.axes2);

T=getimage;

f=imcomplement(handles.img);  %tͼƬȡ·´

imshow(f);

handles.img=f;

guidata(hObject,handles);

 

 

 

 

 

% --- Executes on button press in pushbutton14.

function pushbutton14_Callback(hObject, eventdata,handles)

% hObject    handleto pushbutton14 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

axes(handles.axes2);

y1=handles.img;   

f=double(y1);                % Êý¾ÝÀàÐÍת»»£¬MATLAB²»Ö§³ÖͼÏñµÄÎÞ·ûºÅÕûÐ͵ļÆËã

g=fft2(f);                    % ¸µÁ¢Ò¶±ä»»

g=fftshift(g);                 % ת»»Êý¾Ý¾ØÕó

[M,N]=size(g);

nn=2;                       % ¶þ½×°ÍÌØÎÖ˹(Butterworth)µÍͨÂ˲¨Æ÷

d0=50;                      %½ØֹƵÂÊΪ50

m=fix(M/2); n=fix(N/2);

for i=1:M

       for j=1:N

           d=sqrt((i-m)^2+(j-n)^2);

           h=1/(1+0.414*(d/d0)^(2*nn));         % ¼ÆËãµÍͨÂ˲¨Æ÷´«µÝº¯Êý

           result(i,j)=h*g(i,j);

       end

end

result=ifftshift(result);

y2=ifft2(result);

y3=uint8(real(y2));

imshow(y3);                                 % ÏÔʾÂ˲¨´¦ÀíºóµÄͼÏñ

 

 

 

 

% --- Executes on button press in pushbutton15.

function pushbutton15_Callback(hObject, eventdata,handles)

% hObject    handleto pushbutton15 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

axes(handles.axes2);

x=(handles.img);

               

f=double(x);                            %Êý¾ÝÀàÐÍת»»

k=fft2(f);                                % ¸µÁ¢Ò¶±ä»»

g=fftshift(k);                             % ת»»Êý¾Ý¾ØÕó

[M,N]=size(g);

nn=2;

d0=25;                                  %½ØֹƵÂÊΪ25

m=fix(M/2); n=fix(N/2);

for i=1:M

        for j=1:N

            d=sqrt((i-m)^2+(j-n)^2);        % ¼ÆËã¸ßͨÂ˲¨Æ÷´«µÝº¯Êý

            if d<=d0

               h=0;

            else h=1;

            end

            result(i,j)=h*g(i,j);

        end

end

result=ifftshift(result);

y2=ifft2(result);

y3=uint8(real(y2));

imshow(y3);                               % ÏÔʾÂ˲¨´¦ÀíºóµÄͼÏñ

 

 

 

% --- Executes on button press in pushbutton16.

function pushbutton16_Callback(hObject, eventdata,handles)

% hObject    handleto pushbutton16 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

global T

axes(handles.axes2);

 T=getimage;

f=edge(handles.img,'canny');

imshow(f);

handles.img=f;

guidata(hObject,handles);

 

 

 

 

 

 

 

 

% --------------------------------------------------------------------

function edit_Callback(hObject, eventdata, handles)

% hObject    handleto edit (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

 

%--------------------------------------------------------------------

function tuxiangbianxing_Callback(hObject, eventdata,handles)

% hObject    handleto tuxiangbianxing (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

 

%--------------------------------------------------------------------

function tianjiazaosheng_Callback(hObject, eventdata,handles)

% hObject    handleto tianjiazaosheng (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.uipanel4,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

    set(handles.uipanel4,'Visible','on');

   set(gcbo, 'Checked', 'off');

   set(handles.uipanel4,'Visible','off');

else

   set(gcbo, 'Checked', 'on');

end

 

%--------------------------------------------------------------------

function lvbochuli_Callback(hObject, eventdata,handles)

% hObject    handleto lvbochuli (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

 

%--------------------------------------------------------------------

function changyongchuli_Callback(hObject, eventdata,handles)

% hObject    handleto changyongchuli (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

 

 

% --------------------------------------------------------------------

function teshuchuli_Callback(hObject, eventdata,handles)

% hObject    handleto teshuchuli (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles    structurewith handles and user data (see GUIDATA)

 

 

%--------------------------------------------------------------------

function tuxiangfanzhuan_Callback(hObject, eventdata,handles)

% hObject    handleto tuxiangfanzhuan (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.uipanel7,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

    set(handles.uipanel7,'Visible','on');

   set(gcbo, 'Checked', 'off');

   set(handles.uipanel7,'Visible','off');

else

   set(gcbo, 'Checked', 'on');

end

 

 

 

%--------------------------------------------------------------------

function tuxiangxuanzhuan_Callback(hObject,eventdata, handles)

% hObject    handleto tuxiangxuanzhuan (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.pushbutton3,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

    set(handles.pushbutton3,'Visible','on');

    set(gcbo, 'Checked', 'off');

   set(handles.pushbutton3,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

 

 

 

%--------------------------------------------------------------------

function ditonglvbochuli_Callback(hObject, eventdata,handles)

% hObject    handleto ditonglvbochuli (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.pushbutton14,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

   set(handles.pushbutton14,'Visible','on');

    set(gcbo, 'Checked', 'off');

   set(handles.pushbutton14,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

 

% --------------------------------------------------------------------

function gaotonglvbochuli_Callback(hObject,eventdata, handles)

% hObject    handleto gaotonglvbochuli (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.pushbutton15,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

   set(handles.pushbutton15,'Visible','on');

    set(gcbo, 'Checked', 'off');

   set(handles.pushbutton15,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

 

%--------------------------------------------------------------------

function tuxianglvbo_Callback(hObject, eventdata,handles)

% hObject    handleto tuxianglvbo (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.uipanel5,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

    set(handles.uipanel5,'Visible','on');

   set(gcbo, 'Checked', 'off');

   set(handles.uipanel5,'Visible','off');

else

   set(gcbo, 'Checked', 'on');

end

 

 

 

%--------------------------------------------------------------------

function liangdutiaojie_Callback(hObject, eventdata,handles)

% hObject    handleto liangdutiaojie (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.radiobutton12,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

   set(handles.radiobutton12,'Visible','on');

    set(gcbo, 'Checked', 'off');

   set(handles.radiobutton12,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

 

%--------------------------------------------------------------------

function huidutxiang_Callback(hObject, eventdata,handles)

% hObject    handleto huidutxiang (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.radiobutton16,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

   set(handles.radiobutton16,'Visible','on');

    set(gcbo, 'Checked', 'off');

   set(handles.radiobutton16,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

 

%--------------------------------------------------------------------

function duibidu_Callback(hObject, eventdata,handles)

% hObject    handleto duibidu (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.uipanel10,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

    set(handles.uipanel10,'Visible','on');

   set(gcbo, 'Checked', 'off');

   set(handles.uipanel10,'Visible','off');

else

   set(gcbo, 'Checked', 'on');

end

 

%--------------------------------------------------------------------

function zhifangtujunheng_Callback(hObject,eventdata, handles)

% hObject    handleto zhifangtujunheng (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.pushbutton7,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

   set(handles.pushbutton7,'Visible','on');

    set(gcbo, 'Checked', 'off');

   set(handles.pushbutton7,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

 

% --------------------------------------------------------------------

function zhifangtutongji_Callback(hObject, eventdata,handles)

% hObject    handleto zhifangtutongji (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.pushbutton8,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

   set(handles.pushbutton8,'Visible','on');

    set(gcbo, 'Checked', 'off');

   set(handles.pushbutton8,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

 

%--------------------------------------------------------------------

function fangdasuoxiao_Callback(hObject, eventdata,handles)

% hObject    handleto fangdasuoxiao (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.uipanel9,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

    set(handles.uipanel9,'Visible','on');

   set(gcbo, 'Checked', 'off');

   set(handles.uipanel9,'Visible','off');

else

   set(gcbo, 'Checked', 'on');

end

 

%--------------------------------------------------------------------

function dipianxiaoguo_Callback(hObject, eventdata,handles)

% hObject    handleto dipianxiaoguo (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.pushbutton12,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

   set(handles.pushbutton12,'Visible','on');

    set(gcbo, 'Checked', 'off');

   set(handles.pushbutton12,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

 

%--------------------------------------------------------------------

function bianyuanxinxi_Callback(hObject, eventdata,handles)

% hObject    handleto bianyuanxinxi (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles   structure with handles and user data (see GUIDATA)

set(handles.pushbutton16,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

    set(handles.pushbutton16,'Visible','on');

    set(gcbo, 'Checked', 'off');

   set(handles.pushbutton16,'Visible','off');

else

    set(gcbo, 'Checked', 'on');

end

1 0
原创粉丝点击