function varargout = yuzhifenge(varargin)
% CHENGPIN6 MATLAB code for chengpin6.fig
% CHENGPIN6, by itself, creates a new CHENGPIN6 or raises the existing
% singleton*.
%
% H = CHENGPIN6 returns the handle to a new CHENGPIN6 or the handle to
% the existing singleton*.
%
% CHENGPIN6('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CHENGPIN6.M with the given input arguments.
%
% CHENGPIN6('Property','Value',...) creates a new CHENGPIN6 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before chengpin6_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to chengpin6_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 chengpin6
% Last Modified by GUIDE v2.5 16-Mar-2020 14:46:02
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @chengpin6_OpeningFcn, ...
'gui_OutputFcn', @chengpin6_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 chengpin6 is made visible.
function chengpin6_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 chengpin6 (see VARARGIN)
% Choose default command line output for chengpin6
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes chengpin6 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = chengpin6_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 anniu_drtp_Callback(hObject, eventdata, handles)
%%导入图片进axse1
[drtp,path] = uigetfile('*.jpg;*.png');
if isequal(drtp,0)| isequal(drtp,0) errordlg('没有选中文件','出错');
return;
else
axes(handles.axes1); %吧导入的图片放进axes1
disp(imshow(drtp)); %显示导入的图片
end
% --- Executes on button press in anniu_bctp.
function anniu_bctp_Callback(hObject, eventdata, handles)
%保存图片
[bctp,path] = uiputfile('*.jpg');
if isequal(bctp,0);
disp('User selected Cancel'); %用户选择取消
else
t=getimage(handles.axes2); %吧axes2里的图给t
imwrite(t,bctp,'jpg'); %保存t
end
% 灰度图像
function anniu_hdtx_Callback(hObject, eventdata, handles)
hd=getimage(handles.axes1);
Data=rgb2gray(hd);
axes(handles.axes2);
disp(imshow(Data));
%二值图像
function anniu_eztx_Callback(hObject, eventdata, handles)
ez=getimage(handles.axes1);
Data=im2bw(ez);
axes(handles.axes2);
disp(imshow(Data)) ;
%局部阈值分割
function anniu_jbyzfg_Callback(hObject, eventdata, handles)
jbyz=getimage(handles.axes1);
c=rgb2gray(jbyz);
b=im2double(c);
se=strel('disk',50); %se.Neighborhood:50*50圆盘
ft=imtophat(b,se); %高帽变换
gt=uint8(255*ft);
th=graythresh(ft);
g=imbinarize(gt,th); %阈值分割
axes(handles.axes2);
disp(imshow(g)) ;
%全局Otus阈值分割
function anniu_qjyz_Otus_Callback(hObject, eventdata, handles)
qjyz_Otus=getimage(handles.axes1);
a=rgb2gray(qjyz_Otus);
t3=graythresh(a);
bw2=imbinarize(a,t3);
axes(handles.axes2);
disp(imshow(bw2)) ;
function anniu_tc_Callback(hObject, eventdata, handles)
close(gcf)
chengpin3
MATLAB图像处理专栏--阈值分割算法
版权申诉
5星 · 超过95%的资源 160 浏览量
2022-06-24
21:39:45
上传
评论 5
收藏 1.25MB ZIP 举报
向前@DM
- 粉丝: 3
- 资源: 6
最新资源
- C语言基础-C语言编程基础之Leetcode编程题解之第39题组合总和.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第38题外观数列.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第37题解数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第36题有效的数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第35题搜索插入位置.zip
- index.wxml
- C语言基础-C语言编程基础之Leetcode编程题解之第33题搜索旋转排序数组.zip
- 基于Python实现的手写数字识别系统源码.zip
- 从网页提取禁止转载的文字
- C语言基础-C语言编程基础之Leetcode编程题解之第32题最长有效括号.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页