function varargout = zuoye(varargin)
% ZUOYE M-file for zuoye.fig
% ZUOYE, by itself, creates a new ZUOYE or raises the existing
% singleton*.
%
% H = ZUOYE returns the handle to a new ZUOYE or the handle to
% the existing singleton*.
%
% ZUOYE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in ZUOYE.M with the given input arguments.
%
% ZUOYE('Property','Value',...) creates a new ZUOYE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before zuoye_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to zuoye_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 zuoye
% Last Modified by GUIDE v2.5 04-Jan-2011 18:02:16
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @zuoye_OpeningFcn, ...
'gui_OutputFcn', @zuoye_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 zuoye is made visible.
function zuoye_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 zuoye (see VARARGIN)
% Choose default command line output for zuoye
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes zuoye wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = zuoye_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)
global I;
[filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.tif'},'Select Image');
if exist(strcat(pathname,filename))
I=imread(strcat(pathname,filename));
else
return;
end;
axes(handles.axes1);
imshow(I);
title('读取图像');
% --- 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 I;
I2=rgb2gray(I);
axes(handles.axes2);
set(handles.axes2,'HandleVisibility','On');
imhist(I2);
title('灰度直方图');
% --- 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 I;
I3=rgb2gray(I);
axes(handles.axes2);
set(handles.axes2,'HandleVisibility','On');
imhist(histeq(I3));
title('直方图均衡化');
% --- 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 I;
I40=rgb2gray(I);
Ieq=histeq(I40);
[c,x]=imhist(Ieq);
[filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.tif'},'Select Image');
if exist(strcat(pathname,filename))
I41=imread(strcat(pathname,filename));
else
return;
end;
I42=rgb2gray(I41);
J=histeq(I42,c);
l=J-Ieq;
axes(handles.axes2);
imshow(I41);
title('匹配图');
pause();
imshow(l);
title('匹配结果');
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global I;
global K;
I51=rgb2gray(I);
axes(handles.axes1);
imshow(I51);
I5=K.*I51;
axes(handles.axes2);
imshow(I5);
title('对比度变化');
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (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'},'Select Image');
if exist(strcat(pathname,filename))
A=imread(strcat(pathname,filename));
else
return;
end;
axes(handles.axes1);
imshow(A);
title('原图');
[y,x]=getpts;
x=floor(x);
y=floor(y);
[m,n]=size(x);
B1=zeros(3,m);
for i=1:m,
B1(1,i)=A(x(i),y(i),1);
B1(2,i)=A(x(i),y(i),2);
B1(3,i)=A(x(i),y(i),3);
B2(i)=(B1(1,i)+B1(2,i)+B1(3,i))/3;
end;
pr=polyfit(B1(1,:),B2,2);
pg=polyfit(B1(2,:),B2,2);
pb=polyfit(B1(3,:),B2,2);
[m1,n1,z1]=size(A);
C=zeros(m1,n1,z1);
A=double(A);
for i1=1:m1,
for j1=1:n1,
C(i1,j1,1)=polyval(pr,A(i1,j1,1));
C(i1,j1,2)=polyval(pg,A(i1,j1,2));
C(i1,j1,3)=polyval(pb,A(i1,j1,3));
end;
end;
C=uint8(C);
axes(handles.axes2);
imshow(C);
title('白平衡');
% --- 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 version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global I;global K;
k8=imrotate(I,K);
set(handles.axes2,'HandleVisibility','On');%显示可见
axes(handles.axes2);
imshow(k8);
title('角度旋转')
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global I; global I7;
I7=imnoise(I,'gaussian',0.02);%高斯噪声
axes(handles.axes1);
imshow(I7);
title('加噪声');
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (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'},'Select Image');
if exist(strcat(pathname,filename))
I100=imread(strcat(pathname,filename));
else
return;
end;
axes(handles.axes1);
imshow(I100);
title('原图');
I101=rgb2gray(I100);
I102=im2bw(I101);
I103=medfilt2(I102,[5,5]);%中值滤波
axes(handles.axes2);
imshow(I103);
title('滤波后的图');
[m,n]=size(I103);
count=0;
count=sum(sum(I103==0));
area=5200*5200/n/n*count;
I104=edge(I103,'sobel');
count2=0;
count2=sum(sum(I104==1));
length=count2*5200/n;
set(handles.edit2,'string',num2str(area));
set(handles.edit3,'string',num2str(length));%计算面积
% --- Executes on button press in pushbutton10.
f
matlab.rar_图像直方图_白平衡_白平衡 matlab_直方匹配_边缘检测
版权申诉
115 浏览量
2022-09-20
17:54:10
上传
评论
收藏 4KB RAR 举报
小贝德罗
- 粉丝: 69
- 资源: 1万+
最新资源
- 基于Matlab实现扩展卡尔曼滤波EKF源码+项目说明+超详细注释.zip
- 学生课程实验的流程.doc
- 微信消息防撤回证据记录软件-大飞哥软件自习室.exe
- 2023-04-06-项目笔记 - 第一百二十阶段 - 4.4.2.118全局变量的作用域-118 -2024.05.01
- 课程设计基于python+mediapipe+opencv手势识别系统源码(含示例图片).zip
- 联想L-IG41M v1.0 BIOS
- 学生课程实验的流程.doc
- 基于MATLAB和Simulink通过正运动学和逆运动学设计了PID控制器.zip
- 文档内置图片提取工具 2.0能够将WORD PDF PPT等文档里面的图片解析并提取出来.exe
- 2023-04-06-项目笔记 - 第一百二十阶段 - 4.4.2.118全局变量的作用域-118 -2024.05.01
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈