⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hahao.m

📁 上个形态学的基本方法的程序的
💻 M
字号:
function varargout = hahao(varargin)
% HAHAO M-file for hahao.fig
%      HAHAO, by itself, creates a new HAHAO or raises the existing
%      singleton*.
%
%      H = HAHAO returns the handle to a new HAHAO or the handle to
%      the existing singleton*.
%
%      HAHAO('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in HAHAO.M with the given input arguments.
%
%      HAHAO('Property','Value',...) creates a new HAHAO or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before hahao_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to hahao_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 hahao

% Last Modified by GUIDE v2.5 25-Jun-2006 20:52:27
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @hahao_OpeningFcn, ...
                   'gui_OutputFcn',  @hahao_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(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 hahao is made visible.
function hahao_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 hahao (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = hahao_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;
    imoriginal = imread('1.bmp');
    axes(handles.originalimage);    
    imshow(imoriginal); 
    set(handles.originalimage,'UserData',['on']);    
    set(handles.processedimage,'UserData',['off']);
    imoriginal = imread('1.bmp');
    axes(handles.processedimage);    
    imshow(imoriginal); 
    set(handles.processedimage,'UserData',['on']);
    imshow(X)
    %axes(handles.originalimage);
    %set(handles.originalimage,'UserData',['on']);
    %cla
    %imshow('1.bmp');
    %set(handles.processedimage,'UserData',['on']);% --- 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)clear
imoriginal=double(imread('1.bmp'))
imresult = imoriginal;
imresult(find(imoriginal<105)) = 0;
imresult(find(imoriginal>=105)) = 1;
X  = 1 - imresult
imshow(X)% --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)

clear all;      clc;
imoriginal=double(imread('1.bmp'))
imresult = imoriginal;

imresult(find(imoriginal<105)) = 0;
imresult(find(imoriginal>=105)) = 1;

X = double(imresult);
X = 1 - X

s = zeros(3,3);
sorigin = [2,2];


% 腐蚀
imresult1 = imageerode(X,s,sorigin);

imshow(imresult1)
% --- 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)

clear all;      clc;
imoriginal=double(imread('1.bmp'))
imresult = imoriginal;

imresult(find(imoriginal<105)) = 0;
imresult(find(imoriginal>=105)) = 1;

X = double(imresult);
X = 1 - X

s = zeros(3,3);
sorigin = [2,2];


% 膨胀
imresult2 = imagedilate(X,s,sorigin);
imshow(imresult2);% --- 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)clear all;      clc;
imoriginal=double(imread('1.bmp'))
imresult = imoriginal;

imresult(find(imoriginal<105)) = 0;
imresult(find(imoriginal>=105)) = 1;

X = double(imresult);
X = 1-X;

s = zeros(3,3);
sorigin = [2,2];


% 腐蚀
imresult1 = imageerode(X,s,sorigin);

% 膨胀
imresult2 = imagedilate(imresult1,s,sorigin);

imshow(imresult2)% --- 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)clear all;      clc;
imoriginal=double(imread('1.bmp'))
imresult = imoriginal;

imresult(find(imoriginal<105)) = 0;
imresult(find(imoriginal>=105)) = 1;

X = double(imresult);
X = 1-X;

s = zeros(3,3);
sorigin = [2,2];

% 膨胀
imresult1 = imagedilate(X,s,sorigin);

% 腐蚀
imresult2 = imageerode(imresult1,s,sorigin);


imshow(imresult2);% --- 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)imoriginal = imshow('1.bmp')% --- 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)clear all;      clc;
imoriginal=double(imread('1.bmp'))
imresult = imoriginal;

imresult(find(imoriginal<105)) = 0;
imresult(find(imoriginal>=105)) = 1;

X = double(imresult);
X = 1-X;

s = zeros(3,3);
sorigin = [2,2];

for i = 1:1:3
    % 膨胀
    imresult1 = imagedilate(X,s,sorigin);

    % 腐蚀
    imresult2 = imageerode(imresult1,s,sorigin);
end
imshow(imresult2)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -