精华内容
下载资源
问答
  • matlab中GUI的建立及图像处理的命令函数整理-matlab图像处理-常用函数列表.doc 关于matlab中GUI的建立及图像处理的命令 函数整理
  • Matlab GUI图像学习图像处理进阶

    千次阅读 多人点赞 2016-04-11 12:28:58
    经过上一篇文章的《matlab GUI图像图像基础》,我们可以知道说是入门了GUI,对于GUI图像图形还可以调用函数形成,但是对于学习图像处理来说,感觉没有那个必要去学,会了基础,就可以自己GUI图像处理功能了,主要...

             经过上一篇文章的《matlab GUI图像图像基础》,我们可以知道说是入门了GUI,对于GUI图像图形还可以调用函数形成,但是对于学习图像处理来说,感觉没有那个必要去学,会了基础,就可以自己GUI图像处理功能了,主要还是算法和功能,所以我就没有写函数调用创建GUI,然后直接写了一篇关于GUI图像处理(根据matlab GUI编写),里面包括打开文件、保存文件灰度转换 、傅立叶变换 、颗粒面积的分布、 二维三维化、 图像融合几个功能,相信他们看就会明白怎么创建自己的功能,让界面更加好看,功能更加的多。完全可以自己DIY一个。

            因为回调函数的代码比较长,所以上传到资源,可以下载下来,对比添加,下载地址http://download.csdn.net/user/qq_20823641

            还是想给一张总图,一个是界面图,一个是菜单,对于控件回调函数不再这里多说了,主要的功能添加基本都在菜单和子菜单上面。

                                        

    现在说一下过程

    1.     看图上的坐标轴和按钮,添加三个坐标轴,2个按钮,2个可编辑文本

    2.     菜单编辑上增加,如图


    3.     添加各自的回调函数,会的可以参考下载的代码添加,不会的可以看上一篇学习。



    展开全文
  • 今天,将介绍GUI中获取图像坐标的最后一种方法—通过axes坐标轴的回调函数实现坐标的获取。 今天使用的回调函数是axes中的ButtonDownFcn函数,当鼠标在axes中点击时,MATLAB就会调用ButtonDownFcn函数。 下面是该...

    今天,将介绍GUI中获取图像坐标的最后一种方法—通过axes坐标轴的回调函数实现坐标的获取。

    今天使用的回调函数是axes中的ButtonDownFcn函数,当鼠标在axes中点击时,MATLAB就会调用ButtonDownFcn函数。

    下面是该GUI的gif图:

    下面贴出实现代码:

    function varargout = Getposition3(varargin)
    % GETPOSITION3 MATLAB code for Getposition3.fig
    %      GETPOSITION3, by itself, creates a new GETPOSITION3 or raises the existing
    %      singleton*.
    %
    %      H = GETPOSITION3 returns the handle to a new GETPOSITION3 or the handle to
    %      the existing singleton*.
    %
    %      GETPOSITION3('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in GETPOSITION3.M with the given input arguments.
    %
    %      GETPOSITION3('Property','Value',...) creates a new GETPOSITION3 or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before Getposition3_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to Getposition3_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    
    % Edit the above text to modify the response to help Getposition3
    
    % Last Modified by GUIDE v2.5 14-Apr-2019 12:00:42
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @Getposition3_OpeningFcn, ...
                       'gui_OutputFcn',  @Getposition3_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 Getposition3 is made visible.
    function Getposition3_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to 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 Getposition3 (see VARARGIN)
    
    % Choose default command line output for Getposition3
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    
    % UIWAIT makes Getposition3 wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
    
    
    % --- Outputs from this function are returned to the command line.
    function varargout = Getposition3_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to 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;
    
    
    % --- Executes on button press in pushbutton1.
    function pushbutton1_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    pic = imread('trees.tif');
    handles.im = imshow(pic);
    axis on
    axes(handles.axes1);
    set(handles.im,'Pickableparts','none');
    set(handles.axes1,'ButtonDownFcn',@mycallbackfcn);
    
    function mycallbackfcn(hObject,eventdata,handles)
    handles = guidata(hObject);
    pos = get(hObject,'Currentpoint');
    set(handles.edit1,'string',pos(1,1));
    set(handles.edit2,'string',pos(1,2));
    
    function edit1_Callback(hObject, eventdata, handles)
    % hObject    handle to edit1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Hints: get(hObject,'String') returns contents of edit1 as text
    %        str2double(get(hObject,'String')) returns contents of edit1 as a double
    
    
    % --- Executes during object creation, after setting all properties.
    function edit1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to edit1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: edit controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
    
    
    
    function edit2_Callback(hObject, eventdata, handles)
    % hObject    handle to edit2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Hints: get(hObject,'String') returns contents of edit2 as text
    %        str2double(get(hObject,'String')) returns contents of edit2 as a double
    
    
    % --- Executes during object creation, after setting all properties.
    function edit2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to edit2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: edit controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
    
    
    % --- Executes during object creation, after setting all properties.
    function pushbutton1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to pushbutton1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    

     一开始实现这个功能的时候,自己没有发现这种方式实现,后面是在师兄的指导下实现的,其中最重要的就是设置图像显示句柄中的Pickableparts参数。

    其中Pickableparts参数是确实对象是否捕获鼠标点击,同时HitTest参数是确定对象是否响应鼠标点击或将其传递给最近的父级。

    下面是这两个参数设置时实现的功能:

     具体详情请看MATLAB公司的帮助文档:https://ww2.mathworks.cn/help/matlab/creating_plots/capturing-mouse-clicks.html

    通过这种方法实现虽然比前两种方法都要好,但是还是存在一些缺点:

    ①因为使用的是axes的回调函数,因此axis必须打开,当使用imshow函数时,必须使用axis on将axis打开(imshow默认关闭axis),而使用imagesc时axis默认打开;

    ②从gif图中可以看出当获取图像外的坐标区域时同样也可以获取坐标信息,因为坐标区域仍然也是axes区域。

    ---------------------------------------------------------------------------------------------------------------------

    虽然这三种方法都可以获取GUI图像上的坐标,但是都存在缺点,如果大家有更好的办法,希望能分享,最后祝大家在学习的道路上一帆风顺~

    展开全文
  • 以前高中的时候想过有没有什么工具能立刻画出函数图像,受于当时的知识限制,不知道matlab。前段时间看了点GUI,就想一个工具,方便使用。工具界面如下图。 制作的视频链接如下图: ...

    以前高中的时候想过有没有什么工具能立刻画出函数图像,受于当时的知识限制,不知道matlab。前段时间看了点GUI,就想做一个工具,方便使用。工具界面如下图。
    在这里插入图片描述

    制作的视频链接如下图:初等函数图像绘制器
    源文件下载链接:

    展开全文
  • 数字图像处理——Matlab GUI与灰度变换函数简介Matlab具有强大的函数运算功能,利用这一点可以进行像素级的计算,也就是图像处理。这款软件基于Matlab平台,用户可以在软件界面中打开需要修改的图片,选择想要变换的...

    数字图像处理——Matlab GUI与灰度变换函数

    简介

    Matlab具有强大的函数运算功能,利用这一点可以进行像素级的计算,也就是图像处理。这款软件基于Matlab平台,用户可以在软件界面中打开需要修改的图片,选择想要变换的效果,通过拖动滑动条可以动态显示修改后的图片效果。

    涉及到的图像处理包括以下三种灰度变换:

    • 二值化

    • 伽马变换

    • 对数变换

    使用方法

    不允许修改空图片,必须打开一张图片后才能获得修改图片的权限。

    打开文件后,面板上显示两张图片,左边的是原图,右边的是原图副本,可以动态显示修改效果。如图:
    这里写图片描述

    其中PhotoProcess包含三个菜单项,分别是

    • BinaryImage:图像二值化处理
    • Gamma Trans:伽马变换
    • Log Trans:对数变换

    下面分别对这三种功能进行演示:

    图像二值化

    这里写图片描述

    其中在子窗口中出现的拖动条可以动态调整二值化阀值(Threshold),这里取值0到1,从而显示出不一样的效果。

    *伽马变换*

    这里写图片描述
    类似二值化功能,这里也有一个拖动条,可以动态调整γ值,我们知道伽马变换的表达式:

    s=crγ

    其中c取1,不再接受变化。

    **对数变换

    这里写图片描述

    对数变换公式:

    s=clogv+1(1+vr)

    保存

    退出的时候如果还未保存将提示是否需要保存。 可选格式为bmp和jpg格式。如图为修改后的图片
    这里写图片描述

    参考资料

    [数字图像处理]灰度变换——反转,对数变换,伽马变换,灰度拉伸,灰度切割,位图切割

    《一个实例搞定matlab界面编程》 https://wenku.baidu.com/view/fdf6ad6925c52cc58bd6be8e.html

    附录:Matlab代码

    DIP.m

    function varargout = DIP(varargin)
    % DIP MATLAB code for DIP.fig
    %      DIP, by itself, creates a new DIP or raises the existing
    %      singleton*.
    %
    %      H = DIP returns the handle to a new DIP or the handle to
    %      the existing singleton*.
    %
    %      DIP('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in DIP.M with the given input arguments.
    %
    %      DIP('Property','Value',...) creates a new DIP or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before DIP_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to DIP_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    
    % Edit the above text to modify the response to help DIP
    
    % Last Modified by GUIDE v2.5 10-Apr-2017 16:55:51
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @DIP_OpeningFcn, ...
                       'gui_OutputFcn',  @DIP_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 DIP is made visible.
    function DIP_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to 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 DIP (see VARARGIN)
    
    % Choose default command line output for DIP
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    
    % UIWAIT makes DIP wait for user response (see UIRESUME)
    % uiwait(handles.figure_DIP);
    setappdata(handles.figure_DIP,'img_src',0);
    set(handles.photoprocess,'Enable','off');
    setappdata(handles.figure_DIP,'bSave',false);
    setappdata(handles.figure_DIP,'bChanged',false);
    setappdata(handles.figure_DIP,'fstSave',true);
    setappdata(handles.figure_DIP,'fstPath',0);
    set(handles.toolSave,'Enable','off');
    set(handles.save,'Enable','off');
    set(handles.axes1,'visible','off');
    set(handles.axes2,'visible','off');
    % --- Outputs from this function are returned to the command line.
    function varargout = DIP_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to 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    handle to file (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function photoprocess_Callback(hObject, eventdata, handles)
    % hObject    handle to photoprocess (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function Untitled_8_Callback(hObject, eventdata, handles)
    % hObject    handle to Untitled_8 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function help_Callback(hObject, eventdata, handles)
    % hObject    handle to help (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function toBinary_Callback(hObject, eventdata, handles)
    % hObject    handle to toBinary (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);
    %img_src = getappdata(handles.figure_DIP,'img_src');
    %imshow(img_src);
    h = toBW;
    setappdata(handles.figure_DIP,'bChanged',true);
    set(handles.toolSave,'Enable','on');
    set(handles.save,'Enable','on');
    set(handles.axes2,'visible','on');
    % --------------------------------------------------------------------
    function gammatrans_Callback(hObject, eventdata, handles)
    % hObject    handle to gammatrans (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    h = toGamma;
    setappdata(handles.figure_DIP,'bChanged',true);
    set(handles.toolSave,'Enable','on');
    set(handles.save,'Enable','on');
    set(handles.axes2,'visible','on');
    
    % --------------------------------------------------------------------
    function contrast_Callback(~, eventdata, handles)
    % hObject    handle to contrast (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function brightness_Callback(hObject, eventdata, handles)
    % hObject    handle to brightness (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function open_Callback(hObject, eventdata, handles)
    % hObject    handle to open (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({'*.bmp;*.jpg;*.png;*.jpeg', 'Image Files (*.bmp, *.jpg, *.png,*.jpeg)'; '*.*', 'All Files (*.*)'}, 'Pick an image');
    if isequal(filename,0) || isequal(pathname,0),
        return;
    end
    axes(handles.axes1);%用axes命令设定当前操作的坐标轴是axes1
    fpath=[pathname filename];%将文件名和目录名组合成一个完整的路径
    img_src = imread(fpath);
    imshow(img_src);
    axes(handles.axes2);
    imshow(img_src);
    setappdata(handles.figure_DIP,'img_src',img_src);
    set(handles.photoprocess,'Enable','on');
    set(handles.axes1,'visible','on');
    % --------------------------------------------------------------------
    function save_Callback(hObject, eventdata, handles)
    % hObject    handle to save (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    fstSave=getappdata(handles.figure_DIP,'fstSave');
    if(fstSave==true)
        [filename, pathname] = uiputfile({'*.bmp','BMP files';'*.jpg;','JPG files'}, 'Pick an Image');
        if isequal(filename,0) || isequal(pathname,0)
            return;%如果点了“取消”
        else
            fpath=fullfile(pathname, filename);%获得全路径的另一种方法
        end    
        img_dst=getimage(handles.axes2);
        imwrite(img_dst,fpath);%保存图片
        setappdata(handles.figure_DIP,'fstPath',fpath);
        setappdata(handles.figure_DIP,'bSave',true);
        setappdata(handles.figure_DIP,'fstSave',false);
    else
        img_dst=getimage(handles.axes2);
        fpath=getappdata(handles.figure_DIP,'fstPath');
        imwrite(img_dst,fpath);
    end
    % --------------------------------------------------------------------
    function exit_Callback(hObject, eventdata, handles)
    % hObject    handle to exit (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    bChanged=getappdata(handles.figure_DIP,'bChanged');%获得是否更改
    bSave=getappdata(handles.figure_DIP,'bSave');%获得是否保存
    if bChanged==true && bSave==false,%更改了,而没保存时
        btnName=questdlg('Not Saved Yet','Warning','save','leave','save');%用提问对话框
        switch btnName,
          case 'save', %执行axes_dst_menu_save_Callback的功能
            feval(@save_Callback,handles.save,eventdata,handles);
          case 'leave',%什么也不做
        end
    end
    h=findobj('Tag','figure_toBW');%查找是否打开设置图像二值化参数窗口
    hh=findobj('Tag','figure_toLogTrans');
    hhh=findobj('Tag','figure_toGamma');
    if ~isempty(h),%找到的话,则关闭
      close(h);
      close(hh);
      close(hhh);
    end
    close(findobj('Tag','figure_DIP'));%关闭主窗口
    
    
    % --------------------------------------------------------------------
    function toolOpen_ClickedCallback(hObject, eventdata, handles)
    % hObject    handle to toolOpen (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    feval(@open_Callback,handles.open,eventdata,handles);
    
    
    % --------------------------------------------------------------------
    function toolSave_ClickedCallback(hObject, eventdata, handles)
    % hObject    handle to toolSave (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    feval(@save_Callback,handles.save,eventdata,handles);
    
    
    % --- Executes during object creation, after setting all properties.
    function axes1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to axes1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    set(hObject,'xTick',[]);
    set(hObject,'ytick',[]);
    set(hObject,'box','on');
    % Hint: place code in OpeningFcn to populate axes1
    
    
    % --- Executes during object creation, after setting all properties.
    function axes2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to axes2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    set(hObject,'xTick',[]);
    set(hObject,'ytick',[]);
    set(hObject,'box','on');
    % Hint: place code in OpeningFcn to populate axes2
    
    
    % --------------------------------------------------------------------
    function logtrans_Callback(hObject, eventdata, handles)
    % hObject    handle to logtrans (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);
    %img_src = getappdata(handles.figure_DIP,'img_src');
    %imshow(img_src);
    h = toLogTrans;
    setappdata(handles.figure_DIP,'bChanged',true);
    set(handles.toolSave,'Enable','on');
    set(handles.save,'Enable','on');
    set(handles.axes2,'visible','on');
    

    toBW.m

    function varargout = toBW(varargin)
    % TOBW MATLAB code for toBW.fig
    %      TOBW, by itself, creates a new TOBW or raises the existing
    %      singleton*.
    %
    %      H = TOBW returns the handle to a new TOBW or the handle to
    %      the existing singleton*.
    %
    %      TOBW('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in TOBW.M with the given input arguments.
    %
    %      TOBW('Property','Value',...) creates a new TOBW or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before toBW_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to toBW_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    
    % Edit the above text to modify the response to help toBW
    
    % Last Modified by GUIDE v2.5 10-Apr-2017 00:49:18
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @toBW_OpeningFcn, ...
                       'gui_OutputFcn',  @toBW_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 toBW is made visible.
    function toBW_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to 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 toBW (see VARARGIN)
    
    % Choose default command line output for toBW
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    %找到原始界面的句柄
    HH = findobj('Tag','figure_DIP');
    DIP = guihandles(HH);
    setappdata(handles.figure_toBW,'DIP',DIP)
    % UIWAIT makes toBW wait for user response (see UIRESUME)
    % uiwait(handles.figure_toBW);
    
    
    % --- Outputs from this function are returned to the command line.
    function varargout = toBW_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to 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;
    
    
    % --- Executes on slider movement.
    function slider1_Callback(hObject, eventdata, handles)
    % hObject    handle to slider1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Hints: get(hObject,'Value') returns position of slider
    %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    val = get(hObject,'Value');
    set(handles.text_bw,'String',num2str(val));
    DIP = getappdata(handles.figure_toBW,'DIP');
    axes(DIP.axes2);
    img_src = getappdata(DIP.figure_DIP,'img_src');
    bw = im2bw(img_src,val);
    imshow(bw);
    
    
    % --- Executes during object creation, after setting all properties.
    function slider1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to slider1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: slider controls usually have a light gray background.
    if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor',[.9 .9 .9]);
    end
    

    LogTrans.m

    function   [g] = LogTrans(f,c,v)
    %此处显示详细说明
        h = mat2gray(f,[0,255]);
        g = c*log2(1+v*h)/log2(v+1);
    end
    

    toLogTrans.m

    function varargout = toLogTrans(varargin)
    % TOLOGTRANS MATLAB code for toLogTrans.fig
    %      TOLOGTRANS, by itself, creates a new TOLOGTRANS or raises the existing
    %      singleton*.
    %
    %      H = TOLOGTRANS returns the handle to a new TOLOGTRANS or the handle to
    %      the existing singleton*.
    %
    %      TOLOGTRANS('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in TOLOGTRANS.M with the given input arguments.
    %
    %      TOLOGTRANS('Property','Value',...) creates a new TOLOGTRANS or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before toLogTrans_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to toLogTrans_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    
    % Edit the above text to modify the response to help toLogTrans
    
    % Last Modified by GUIDE v2.5 10-Apr-2017 16:41:28
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @toLogTrans_OpeningFcn, ...
                       'gui_OutputFcn',  @toLogTrans_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 toLogTrans is made visible.
    function toLogTrans_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to 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 toLogTrans (see VARARGIN)
    
    % Choose default command line output for toLogTrans
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    %找到原始界面的句柄
    HH = findobj('Tag','figure_DIP');
    DIP = guihandles(HH);
    setappdata(handles.figure_toLogTrans,'DIP',DIP)
    setappdata(handles.figure_toLogTrans,'val_C',0);
    setappdata(handles.figure_toLogTrans,'val_V',0);
    % UIWAIT makes toLogTrans wait for user response (see UIRESUME)
    % uiwait(handles.figure_toLogTrans);
    
    
    % --- Outputs from this function are returned to the command line.
    function varargout = toLogTrans_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to 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;
    
    
    % --- Executes on slider movement.
    function slider1_Callback(hObject, eventdata, handles)
    % hObject    handle to slider1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Hints: get(hObject,'Value') returns position of slider
    %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    val_C = get(hObject,'Value');
    set(handles.text2,'String',num2str(val_C));
    setappdata(handles.figure_toLogTrans,'val_C',val_C);
    val_V = getappdata(handles.figure_toLogTrans,'val_V');
    DIP = getappdata(handles.figure_toLogTrans,'DIP');
    axes(DIP.axes2);
    img_src = getappdata(DIP.figure_DIP,'img_src');
    bw = LogTrans(img_src,val_C,val_V);
    imshow(bw);
    
    % --- Executes during object creation, after setting all properties.
    function slider1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to slider1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: slider controls usually have a light gray background.
    if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor',[.9 .9 .9]);
    end
    
    
    % --- Executes on slider movement.
    function slider2_Callback(hObject, eventdata, handles)
    % hObject    handle to slider2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Hints: get(hObject,'Value') returns position of slider
    %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    val_V = get(hObject,'Value');
    set(handles.text4,'String',num2str(val_V));
    setappdata(handles.figure_toLogTrans,'val_V',val_V);
    val_C = getappdata(handles.figure_toLogTrans,'val_C');
    DIP = getappdata(handles.figure_toLogTrans,'DIP');
    axes(DIP.axes2);
    %img_src = getimage(DIP.axes2);
    img_src = getappdata(DIP.figure_DIP,'img_src');
    %bw = val_C*log2(1+val_V*img_src)/log2(val_V+1);
    bw = LogTrans(img_src,val_C,val_V);
    imshow(bw);
    % --- Executes during object creation, after setting all properties.
    function slider2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to slider2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: slider controls usually have a light gray background.
    if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor',[.9 .9 .9]);
    end
    

    toGamma.m

    function varargout = toGamma(varargin)
    % TOGAMMA MATLAB code for toGamma.fig
    %      TOGAMMA, by itself, creates a new TOGAMMA or raises the existing
    %      singleton*.
    %
    %      H = TOGAMMA returns the handle to a new TOGAMMA or the handle to
    %      the existing singleton*.
    %
    %      TOGAMMA('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in TOGAMMA.M with the given input arguments.
    %
    %      TOGAMMA('Property','Value',...) creates a new TOGAMMA or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before toGamma_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to toGamma_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    
    % Edit the above text to modify the response to help toGamma
    
    % Last Modified by GUIDE v2.5 10-Apr-2017 21:32:21
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @toGamma_OpeningFcn, ...
                       'gui_OutputFcn',  @toGamma_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 toGamma is made visible.
    function toGamma_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to 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 toGamma (see VARARGIN)
    
    % Choose default command line output for toGamma
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    %找到原始界面的句柄
    HH = findobj('Tag','figure_DIP');
    DIP = guihandles(HH);
    setappdata(handles.figure_toGamma,'DIP',DIP)
    % UIWAIT makes toGamma wait for user response (see UIRESUME)
    % uiwait(handles.figure_toGamma);
    
    
    % --- Outputs from this function are returned to the command line.
    function varargout = toGamma_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to 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;
    
    
    % --- Executes on slider movement.
    function slider2_Callback(hObject, eventdata, handles)
    % hObject    handle to slider2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    val = get(hObject,'Value');
    set(handles.text2,'String',num2str(val));
    DIP = getappdata(handles.figure_toGamma,'DIP');
    axes(DIP.axes2);
    img_src = getappdata(DIP.figure_DIP,'img_src');
    c = 1;
    bw = GammaTrans(img_src,c,val);
    imshow(bw);
    
    % Hints: get(hObject,'Value') returns position of slider
    %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    
    
    % --- Executes during object creation, after setting all properties.
    function slider2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to slider2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: slider controls usually have a light gray background.
    if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor',[.9 .9 .9]);
    end
    

    GammaTrans.m

    function  [g]=GammaTrans(f,c,gamma)
    %   此处显示详细说明
        h = mat2gray(f,[0,255]);
        g = c*(h.^gamma);
    end
    
    
    展开全文
  • matlab中GUI的建立及图像处理的命令函数整理-创建图形用户界面.rar 关于matlab中GUI的建立及图像处理的命令 函数整理
  • 使用 GUI函数调用将 Droste 效果应用于图像。 Droste 效应是指图像递归地包含自身。 基本方法是插入图像的缩放副本,但通过保角映射可以获得更有趣的结果。 GUI可以加载图像,为效果设置一个矩形区域,应用...
  • Opencv 图像操作函数gui操作

    千次阅读 2013-01-13 22:32:27
    如果已经存在这个名字的窗口,这个函数将不任何事情。 cvDestroyWindow 销毁一个窗口 void cvDestroyWindow( const char* name ); name 要被销毁的窗口的名字。 函数 cvDestroyWindow 销毁...
  • Matlab GUI图像图像基础

    万次阅读 多人点赞 2016-04-10 15:23:59
    当我们学习c++ MFC的时候,总会看到界面,所以当在用Matlab的时候也想用GUI,这里首先写一点关于GUI界面的一些基础的操作,基本包括了不同的... 主要的是基础的应用,后面也做出类似图像处理的GUI界面。整体代码工程在
  • Patchwork 是 IMAGEPATCH 函数GUI 包装器,它允许要粘贴或“修补”在一起的图像或矩阵。 单个图像由用户加载并根据用户可调整的图像坐标放置在合成图像中。 GUI 记录每个位置,并可以根据合成图像生成 HTML 图像...
  • Matlab GUI用于实现图像的灰度映射(LUT),实现对灰度图像的增强处理。
  • 论unity中UI工具与GUI.Label函数(一) 1.前言 当我们在unity中创建设计项目时,难免会遇到一些想表述文字的时候(比如说显示得分之类的),这时候我们就有俩种方法来达成目的: 1.unity中自带的ui工具。 2.c#中的...
  • MATLAB GUI设计 简单图像处理 灰度 | 缩放 | 存储 | GUI

    千次阅读 多人点赞 2020-03-20 13:48:05
    本简易图像处理GUI实现 加载图片、灰度处理图片、0.5倍缩放图片、保存处理后的图片功能;版本为R2018b 中文版本。
  • 上次讲的是通过ginput函数进行GUI图像坐标的获取,但是该方法存在很多缺点,如美观、可以获取图像外部区域等问题。今天,我将介绍一个较ginput函数较好的GUI图像坐标获取函数:datacursormode函数。 今天介绍的...
  • MATLAB 编写GUI进行图像处理

    万次阅读 多人点赞 2018-06-29 10:12:23
    GUI,即图形用户接口,是MATLAB的可视化操作功能,本文编写一个简单GUI进行图像处理。1、新建GUI文件,点击file->new->GUI如下图所示点击GUI后出现如下图界面,默认为Blank GUI (Default)选项,点击OK...
  • 在MATLAB的GUI界面中利用自己编写的函数完成指纹图像的中值滤波、均值滤波、黑白反转。另附带一多种格式阅读器
  • matlab利用GUI界面简单的图像处理

    千次阅读 热门讨论 2020-12-17 18:13:59
    piture_procession.fig文件 piture_procession.m文件 %GUI图形界面初始化 function varargout = piture_procession(varargin) gui_Singleton = 1;...gui_State = struct('gui_Name', mfilename, ... 'g...
  • Python GUI 打开图像并显示(一)

    万次阅读 多人点赞 2018-11-26 15:37:17
    通过GUI 界面搭建实现对图像的打开,程序如下 # 创建GUI窗口打开图像 并显示在窗口中 from PIL import Image, ImageTk # 导入图像处理函数库 import tkinter as tk # 导入GUI界面函数库 # 创建窗口 设定大小...
  • 2.回调函数设置 3.编写回调函数 1.组件布局 2.回调函数设置 右键单击plot按钮——查看回调——call backs 3.编写回调函数 % --- Executes on button press in pushbutton1. function pushbutton1_...
  • 基于Matlab的图形用户界面(GUI)设计,该算法实现了一元二次函数y=ax^2+bx+c的图形绘制,其中a、b、c为可输入参数,能够多次绘制函数图像,也能叠加绘制函数图像
  • 基于Matlab的图形用户界面(GUI)设计,该算法实现了一元二次函数y=ax^2+bx+c的图形绘制,其中a、b、c为可输入参数,能够多次绘制函数图像,也能叠加绘制函数图像
  • OpenCV-Python中的Gui特性-图像入门

    千次阅读 2020-04-13 21:46:54
    1 图像入门 ...cv.imread()函数用于读取图像,需要注意的是,该图像应该处在Python代码源文件或者已给出完整路径的工作目录中。针对函数的第二个参数,通过以下几个例子分别说明各自功能。 - cv....
  • 基于GUI的简易图像处理系统设计与实现

    万次阅读 热门讨论 2015-11-26 21:46:10
    自定义简易图像处理系统:综合此前内容得出该系统,系统功能包括:图像简单处理、图像的灰度变换、图像直方图均衡化和比特平面分层、空间域滤波、频率域滤波、彩色图像的空间域滤波。界面如图1: 图 1 ...
  • 输入传递函数,绘制出单位阶越函数图像,并显示函数增移k,零极点。属于反馈学习中的小项目,提供一种用matlab编程的GUI界面。
  • matlab GUI 可修改平滑模版 实现图像平滑处理
  • 图像裁切代码:   // ConvertColor.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include #pragma comment(lib,"opencv_core2410d.lib") #pragma ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 28,303
精华内容 11,321
关键字:

gui函数做图像