【课题研究】基于matlab GUI图像直方图、滤波、小波变换、分割处理系统【含Matlab源码 608期】

一、简介

基于matlab GUI图像直方图、滤波、小波变换、分割处理系统

二、源代码

unction varargout = exp_gs(varargin)
% EXP_GS M-file for exp_gs.fig
%      EXP_GS, by itself, creates a new EXP_GS or raises the existing
%      singleton*.
%
%      H = EXP_GS returns the handle to a new EXP_GS or the handle to
%      the existing singleton*.
%
%      EXP_GS('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in EXP_GS.M with the given input arguments.
%
%      EXP_GS('Property','Value',...) creates a new EXP_GS or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before exp_gs_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to exp_gs_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 exp_gs

% Last Modified by GUIDE v2.5 30-Jun-2010 13:33:39

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @exp_gs_OpeningFcn, ...
                   'gui_OutputFcn',  @exp_gs_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 exp_gs is made visible.
function exp_gs_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 exp_gs (see VARARGIN)

% Choose default command line output for exp_gs
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes exp_gs wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = exp_gs_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 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


% --- 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)
ImgPath=get(handles.edit1,'String');
global img_1;
img_1=imread(ImgPath);
axes(handles.axes1);
imshow(img_1);
global histogram1;
histogram1=zeros(1,256);
[sizex,sizey]=size(img_1);
for ii=1:sizex % 计算直方图
    for jj=1:sizey
        histogram1(img_1(ii,jj)+1)=histogram1(img_1(ii,jj)+1)+1;
    end
end
maxhisto1=sum(histogram1);% 归一化
histogram1=histogram1/maxhisto1;
axes(handles.axes2);
bar(0:255,histogram1);
axis([0 255 0 max(histogram1)]);

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global img_1;
[sizex,sizey]=size(img_1);
for ii=1:sizex % 减小动态范围
    for jj=1:sizey
        img_1tmp(ii,jj)=floor(img_1(ii,jj)/2)+64;
    end
end
global img_11;
img_11=img_1tmp;
axes(handles.axes3);
imshow(img_11);
histogram2=zeros(1,256);
for ii=1:sizex
    for jj=1:sizey
        histogram2(img_11(ii,jj)+1)=histogram2(img_11(ii,jj)+1)+1;
    end
end
maxhisto2=sum(histogram2);
histogram2=histogram2/maxhisto2;
axes(handles.axes4);
bar(0:255,histogram2);
axis([0 255 0 max(histogram2)]);

% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global img_1;
[sizex,sizey]=size(img_1);
for ii=1:sizex % 直方图左移
    for jj=1:sizey
        img_1tmp(ii,jj)=img_1(ii,jj)-30;
    end
end
global img_11;
img_11=img_1tmp;
axes(handles.axes3);
imshow(img_11);
histogram3=zeros(1,256);
for ii=1:sizex
    for jj=1:sizey
        histogram3(img_11(ii,jj)+1)=histogram3(img_11(ii,jj)+1)+1;
    end
end
maxhisto3=sum(histogram3);
histogram3=histogram3/maxhisto3;
axes(handles.axes4);
bar(0:255,histogram3);
axis([0 255 0 max(histogram3)]);

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global img_1;
[sizex,sizey]=size(img_1);
for ii=1:sizex % 直方图右移
    for jj=1:sizey
        img_1tmp(ii,jj)=img_1(ii,jj)+30;
    end
end
global img_11;
img_11=img_1tmp;
axes(handles.axes3);
imshow(img_11);
histogram4=zeros(1,256);
for ii=1:sizex
    for jj=1:sizey
        histogram4(img_11(ii,jj)+1)=histogram4(img_11(ii,jj)+1)+1;
    end
end

三、运行结果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、备注

完整代码或者代写添加QQ 1564658423
往期回顾>>>>>>
【课题研究】基于matlab GUI学生成绩管理系统【含Matlab源码 601期】
【课题研究】基于matlab GUI 教室人数统计系统【含Matlab源码 602期】
【课题研究】基于matlab GUI图书管理系统【含Matlab源码 603期】
【课题研究】基于matlab GUI学生成绩查询系统【含Matlab源码 604期】
【课题研究】基于GUI FISHER线性判决的人脸识别系统【含Matlab源码 605期】
【课题研究】基于matlab GUI dwt与svd算法数字水印【含Matlab源码 606期】
【课题研究】基于matlab GUI二维条形码的识别【含Matlab源码 607期】

猜你喜欢

转载自blog.csdn.net/TIQCmatlab/article/details/115107076