function varargout = Fruirecognition(varargin)
% FRUIRECOGNITION MATLAB code for Fruirecognition.fig
% FRUIRECOGNITION, by itself, creates a new FRUIRECOGNITION or raises the existing
% singleton*.
%
% H = FRUIRECOGNITION returns the handle to a new FRUIRECOGNITION or the handle to
% the existing singleton*.
%
% FRUIRECOGNITION('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FRUIRECOGNITION.M with the given input arguments.
%
% FRUIRECOGNITION('Property','Value',...) creates a new FRUIRECOGNITION or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Fruirecognition_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Fruirecognition_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 Fruirecognition
% Last Modified by GUIDE v2.5 30-Jun-2021 16:40:03
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Fruirecognition_OpeningFcn, ...
'gui_OutputFcn', @Fruirecognition_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 Fruirecognition is made visible.
function Fruirecognition_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 Fruirecognition (see VARARGIN)
% Choose default command line output for Fruirecognition
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Fruirecognition wait for user response (see UIRESUME)
% uiwait(handles.figure1);
axis equal;
axis tight;
axis off;
% --- Outputs from this function are returned to the command line.
function varargout = Fruirecognition_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)
axes(handles.axes1);
cla;
% 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 img;
[filename, pathname]=uigetfile('dw.bmp',' ');
path=[pathname filename];
img=imread(path);
axes(handles.axes1);
imshow(img);
axis off;
%----------------------------对图片进行灰度计算----------------
% --- 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 img;
global path;
I2=rgb2gray(img);
axes(handles.axes1);
imshow(I2);
axis off;
%--------------------------------对图像进行二值化计算-----------
% --- 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;
global BW;
global path;
I2=rgb2gray(img);
BW=im2bw(I2,0.9);%level=0.9来实现二值化
axes(handles.axes1);
imshow(BW);
axis off;
%-------------图片腐蚀---------------------
% --- 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)
%-----------------------对图片进行边缘提取计算------------------------
% --- 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 dat
%--------------对图片进行识别以及显示在界面中------------------------
% --- 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 (
str1=sprintf('思路\n\n');
str2=sprintf('欢迎沟通交流Q:3752243968\n');
string=[str1 str2];
msgbox(string,'温馨提示','none');
% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATe version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: delete(hObject) closes the figure
% --- Executes during object deletion, before destroying properties.
function figure1_DeleteFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function figure1_CloseRequestFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
button=questdlg('是否退出程序?','退出程序','YES','NO','YES');
if strcmp(button,'YES')
delete(hObject);
end
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
第 68 章 基于matlab的水果识别(苹果香蕉菠萝梨桃子).zip (11个子文件)
第 68 章 基于matlab的水果识别(苹果香蕉菠萝梨桃子)
1_程序
0识别结果图1.png 145KB
image
3.bmp 72KB
9.bmp 668KB
5.bmp 87KB
1.bmp 108KB
92.bmp 116KB
2.bmp 31KB
Fruirecognition.fig 29KB
Fruirecognition.m 7KB
0识别结果图.png 45KB
0识别结果图2.png 45KB
共 11 条
- 1
资源评论
Matlab程序设计
- 粉丝: 15
- 资源: 105
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功