1 简介
植物的叶片外形特征是传统识别植物常用和重要的形态特征,是人们认识和识别万千植物的基础和出发点。叶片和植物的繁殖器官比较,其具有非常多的优点,常作为识别特征和人们认识植物的主要参照器官。叶片形态特征是研究植物物种变异和分化的一个非常好的指标。结合图像处理技术,提取植物叶片的特征是行之有效的方法。对植物叶片进行参数测量,首先必须得获取叶片的图像,然后对其进行预处理,最后再进行参数特征提取并测量。所以,本章是第4章的基础,也就是说如何获取好的叶片图像是整个参数测量过程的基础。而预处理是关键,预处理的好坏直接影响到叶片参数特征的提取以及参数测量的精度和准确度。对植物叶片图像的预处理有很多,例如,灰度化、阈值分割、消除孔洞及孤立区域
2 部分代码
function?edit10_Callback(hObject,?eventdata,?handles)
% hObject ? handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text
% ? ? ? str2double(get(hObject,'String')) returns contents of edit7 as a double
% --- Executes during object creation, after setting all properties.
function?edit10_CreateFcn(hObject,?eventdata,?handles)
% hObject ? handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? empty - handles not created until after all CreateFcns called
% Hint: edit 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
% --------------------------------------------------------------------
function?shuangzhengjiao_Callback(hObject,?eventdata,?handles)
% hObject ? handle to shuangzhengjiao (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)
I=handles.imdata;
prompt={'请输入要进行多分辨率分解的层数'};
name='多分辨率分析';
numlines=1;
defaultanswer={'1'};
anss=inputdlg(prompt,name,numlines,defaultanswer);
th=str2num(anss{1});
for?i=1:th
? ? [ca1,ch1,cv1,cd1] =?dwt2(I,'bior1.1');
? ??I=ca1;
end
set(handles.edit6,'string',?anss{1});
set(handles.edit7,'string',?anss{1});
set(handles.edit8,'string',?anss{1});
axes(handles.axes2);
imshow(cd1);
axes(handles.axes3);
imshow(ch1);
axes(handles.axes4);
imshow(cv1);
handles.imdata=ca1;
guidata(hObject,?handles);
% --------------------------------------------------------------------
function?dau_Callback(hObject,?eventdata,?handles)
% hObject ? handle to dau (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)
I=handles.imdata;
prompt={'请输入要进行多分辨率分解的层数'};
name='多分辨率分析';
numlines=1;
defaultanswer={'1'};
anss=inputdlg(prompt,name,numlines,defaultanswer);
th=str2num(anss{1});
for?i=1:th
? ? [ca1,ch1,cv1,cd1] =?dwt2(I,'db2');
? ??I=ca1;
end
set(handles.edit6,'string',?anss{1});
set(handles.edit7,'string',?anss{1});
set(handles.edit8,'string',?anss{1});
axes(handles.axes2);
imshow(cd1);
axes(handles.axes3);
imshow(ch1);
axes(handles.axes4);
imshow(cv1);
handles.imdata=ca1;
guidata(hObject,?handles);
% --------------------------------------------------------------------
function?coi_Callback(hObject,?eventdata,?handles)
% hObject ? handle to coi (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)
I=handles.imdata;
prompt={'请输入要进行多分辨率分解的层数'};
name='多分辨率分析';
numlines=1;
defaultanswer={'1'};
anss=inputdlg(prompt,name,numlines,defaultanswer);
th=str2num(anss{1});
for?i=1:th
? ? [ca1,ch1,cv1,cd1] =?dwt2(I,'coif1');
? ??I=ca1;
end
set(handles.edit6,'string',?anss{1});
set(handles.edit7,'string',?anss{1});
set(handles.edit8,'string',?anss{1});
axes(handles.axes2);
imshow(cd1);
axes(handles.axes3);
imshow(ch1);
axes(handles.axes4);
imshow(cv1);
handles.imdata=ca1;
guidata(hObject,?handles);
% --------------------------------------------------------------------
function?sym_Callback(hObject,?eventdata,?handles)
% hObject ? handle to sym (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles ? structure with handles and user data (see GUIDATA)
I=handles.imdata;
prompt={'请输入要进行多分辨率分解的层数'};
name='多分辨率分析';
numlines=1;
defaultanswer={'1'};
anss=inputdlg(prompt,name,numlines,defaultanswer);
th=str2num(anss{1});
for?i=1:th
? ? [ca1,ch1,cv1,cd1] =?dwt2(I,'sym2');
? ??I=ca1;
end
set(handles.edit6,'string',?anss{1});
set(handles.edit7,'string',?anss{1});
set(handles.edit8,'string',?anss{1});
axes(handles.axes2);
imshow(cd1);
3 仿真结果
4 参考文献
[1]牛珂, and 何东健. "基于图像处理的植物叶片参数测量系统." 农村经济与科技 22.6(2011):3.
|