IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 人工智能 -> 【图像检测】基于K-mean和形态学算法实现叶子病虫害检测matlab源码 -> 正文阅读

[人工智能]【图像检测】基于K-mean和形态学算法实现叶子病虫害检测matlab源码

1 模型

蔬菜病虫害的预警通常依靠植保专家知识来进行,较少采用数学建模方法来进行定量分析.为此,利用部分已知类别的训练样本抽取其关联规则作为监督信息,结合非监督学习的K-mean聚类算法,建立蔬菜黄曲条跳甲的预警模型.半监督学习算法既能发挥有监督学习准确率高的优点,又能充分地利用无监督学习的灵活性,具有一定的研究意义和实际意义.通过对广东省蔬菜黄曲条跳甲数据实验表明,半监督学习算法预警准确率比同条件下K-mean聚类算法的准确率高出24.31%.

2 部分代码

function?varargout?=?LeafDiseaseGradingSystemGUI(varargin)
% LeafDiseaseGradingSystemGUI MATLAB code for LeafDiseaseGradingSystemGUI.fig
% ? ? LeafDiseaseGradingSystemGUI, by itself, creates a new LeafDiseaseGradingSystemGUI or raises the existing
% ? ? singleton*.
%
% ? ? H = LeafDiseaseGradingSystemGUI returns the handle to a new LeafDiseaseGradingSystemGUI or the handle to
% ? ? the existing singleton*.
%
% ? ? LeafDiseaseGradingSystemGUI('CALLBACK',hObject,eventData,handles,...) calls the local
% ? ? function named CALLBACK in LeafDiseaseGradingSystemGUI.M with the given input arguments.
%
% ? ? LeafDiseaseGradingSystemGUI('Property','Value',...) creates a new LeafDiseaseGradingSystemGUI or raises the
% ? ? existing singleton*. Starting from the left, property value pairs are
% ? ? applied to the LeafDiseaseGradingSystemGUI before LeafDiseaseGradingSystemGUI_OpeningFcn gets called. An
% ? ? unrecognized property name or invalid value makes property application
% ? ? stop. All inputs are passed to LeafDiseaseGradingSystemGUI_OpeningFcn via varargin.
%
% ? ? *See LeafDiseaseGradingSystemGUI Options on GUIDE's Tools menu. Choose "LeafDiseaseGradingSystemGUI allows only one
% ? ? instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help LeafDiseaseGradingSystemGUI

% Last Modified by GUIDE v2.5 20-Jan-2015 14:49:28

% Begin initialization code - DO NOT EDIT
gui_Singleton?=?1;
gui_State?=?struct('gui_Name', ? ? ??mfilename,?...
? ? ? ? ? ? ? ? ??'gui_Singleton', ?gui_Singleton,?...
? ? ? ? ? ? ? ? ??'gui_OpeningFcn',?@LeafDiseaseGradingSystemGUI_OpeningFcn,?...
? ? ? ? ? ? ? ? ??'gui_OutputFcn', ?@LeafDiseaseGradingSystemGUI_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 LeafDiseaseGradingSystemGUI is made visible.
function?LeafDiseaseGradingSystemGUI_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 LeafDiseaseGradingSystemGUI (see VARARGIN)
set(gcf,?'units','normalized','outerposition',[0?0?1?1]);

Disease_Grading?=?readfis('Disease_Grading.fis');

handles.Disease_Grading?=?Disease_Grading;
guidata(hObject,handles);

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

% Update handles structure
guidata(hObject,?handles);

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


% --- Outputs from this function are returned to the command line.
function?varargout?=?LeafDiseaseGradingSystemGUI_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 select_image.
function?select_image_Callback(hObject,?eventdata,?handles)
% hObject ? handle to select_image (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)

? ? ? [File_Name,?Path_Name] =?uigetfile('PATHNAME');
? ? ??I?=?imread([Path_Name,File_Name]);
? ? ??imshow([Path_Name,File_Name],?'Parent',?handles.axes1);?title('Original Leaf Image',?'Parent',?handles.axes1);
? ? ??
? ? ??%# store queryname, version 1
? ? ??handles.I?=?I;
? ? ??guidata(hObject,handles);
? ? ??



% --- Executes on button press in segmentation.
function?segmentation_Callback(hObject,?eventdata,?handles)
% hObject ? handle to segmentation (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)


end

% displaying different show_clusters objects %

I_cluster_1?=?segmented_images{1};

I_cluster_2?=?segmented_images{2};

I_cluster_3?=?segmented_images{3};

I_cluster_4?=?segmented_images{4};

I_cluster_5?=?segmented_images{5};

imshow(I_cluster_1,'Parent',?handles.axes2);?title('Cluster 1');

handles.I_cluster_1?=?I_cluster_1;
handles.I_cluster_2?=?I_cluster_2;
handles.I_cluster_3?=?I_cluster_3;
handles.I_cluster_4?=?I_cluster_4;
handles.I_cluster_5?=?I_cluster_5;

guidata(hObject,handles);


% --- Executes on button press in disease_grade.
function?disease_grade_Callback(hObject,?eventdata,?handles)
% hObject ? handle to disease_grade (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)

Disease_Grading?=?handles.Disease_Grading;

white_pixels_I?=?handles.white_pixels_I?;

white_pixels_I_selected?=?handles.white_pixels_I_selected?;

percentage_infected?= (white_pixels_I_selected/white_pixels_I)*100;

grade?=?evalfis(percentage_infected,Disease_Grading);

figure();

plot(percentage_infected,grade,'g*');

legend('Percent - Grade of Disease');

title('Disease Grade Classification Using Fuzzy Logic');
xlabel('Percentage');
ylabel('Disease Grade');

% --- Executes on button press in binary_original.
function?binary_original_Callback(hObject,?eventdata,?handles)
% hObject ? handle to binary_original (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)

I?=?handles.I;

BW_I?=?im2bw(I,0.17);

white_pixels_I?=?sum(BW_I(:)?==?1);

se?=?strel('disk',1);

closeBW?=?imclose(BW_I,se);

imshow(closeBW,'Parent',?handles.axes2);?title('Binary of Original Image');

handles.white_pixels_I?=?white_pixels_I;

guidata(hObject,handles);



% --- Executes on button press in binary_diseased.
function?binary_diseased_Callback(hObject,?eventdata,?handles)
% hObject ? handle to binary_diseased (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)

I_selected?=?handles.I_slected?;

BW_I_selected?=?im2bw(I_selected,0.17);

white_pixels_I_selected?=?sum(BW_I_selected(:)?==?1);

se?=?strel('disk',5);

closeBW?=?imclose(BW_I_selected,se);

imshow(closeBW,'Parent',?handles.axes2);?title('Binary of Clustered Image');

handles.white_pixels_I_selected?=?white_pixels_I_selected;

guidata(hObject,handles);


% --- Executes on selection change in show_clusters.
function?show_clusters_Callback(hObject,?eventdata,?handles)
% hObject ? handle to show_clusters (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns show_clusters contents as cell array
% ? ? ? contents{get(hObject,'Value')} returns selected item from show_clusters
I_cluster_1?=?handles.I_cluster_1?;
I_cluster_2?=?handles.I_cluster_2?;
I_cluster_3?=?handles.I_cluster_3?;
I_cluster_4?=?handles.I_cluster_4?;
I_cluster_5?=?handles.I_cluster_5?;

% Determine the selected data set.
str?=?get(hObject,?'String');
val?=?get(hObject,'Value');

% Set current data to the selected data set.
switch?str{val};
case?'Cluster 1'?% User selects peaks. ??
? ?imshow(I_cluster_1,'Parent',?handles.axes2);?title('Cluster 1');
? ?I_selected?=?I_cluster_1;
case?'Cluster 2'?% User selects membrane.
? ?imshow(I_cluster_2,'Parent',?handles.axes2);?title('Cluster 2');
? ?I_selected?=?I_cluster_2;
case?'Cluster 3'?% User selects sinc.
? ?imshow(I_cluster_3,'Parent',?handles.axes2);?title('Cluster 3');
? ?I_selected?=?I_cluster_3;
case?'Cluster 4'?% User selects sinc.
? ?imshow(I_cluster_4,'Parent',?handles.axes2);?title('Cluster 4');
? ?I_selected?=?I_cluster_4;
case?'Cluster 5'?% User selects sinc.
? ?imshow(I_cluster_5,'Parent',?handles.axes2);?title('Cluster 5');
? ?I_selected?=?I_cluster_5;
end

% Save the handles structure.

handles.I_slected?=?I_selected;

guidata(hObject,handles);



% --- Executes during object creation, after setting all properties.
function?show_clusters_CreateFcn(hObject,?eventdata,?handles)
% hObject ? handle to show_clusters (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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

%closing dilation


% --- Executes on button press in save_image.
function?save_image_Callback(hObject,?eventdata,?handles)
% hObject ? handle to save_image (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)

axes2?=?handles.axes2;

axes1?=?handles.axes1;

h1=get(axes1,'Title');
h2=get(axes2,'Title');

figure();

subplot(1,2,1) ;?imshow(getimage(axes1));?title(h1.String);
subplot(1,2,2) ;?imshow(getimage(axes2));?title(h2.String);

3 仿真结果

4 参考文献

[1]王海超, 宗哲英, 张文霞, 殷晓飞, 王晓蓉, & 张海军等. (2019). 基于k均值聚类和环形结构提取算法的狭叶锦鸡儿木质部提取. 农业工程学报(1).?

?

  人工智能 最新文章
2022吴恩达机器学习课程——第二课(神经网
第十五章 规则学习
FixMatch: Simplifying Semi-Supervised Le
数据挖掘Java——Kmeans算法的实现
大脑皮层的分割方法
【翻译】GPT-3是如何工作的
论文笔记:TEACHTEXT: CrossModal Generaliz
python从零学(六)
详解Python 3.x 导入(import)
【答读者问27】backtrader不支持最新版本的
上一篇文章      下一篇文章      查看所有文章
加:2021-10-17 12:00:06  更:2021-10-17 12:00:40 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/27 10:27:16-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码