资源简介
基于聚类的路标检测(K-means)(MATLAB)(RGB)通过采用RGB的颜色特征空间,如果和YUV结合使用,识别效果更佳。
代码片段和文件信息
function varargout = K_means(varargin)
% K_MEANS M-file for K_means.fig
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name‘ mfilename ...
‘gui_Singleton‘ gui_Singleton ...
‘gui_OpeningFcn‘ @K_means_OpeningFcn ...
‘gui_OutputFcn‘ @K_means_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 K_means is made visible.
function K_means_OpeningFcn(hobject eventdata handles varargin)
handles.output = hobject;
guidata(hobject handles);
% --- Outputs from this function are returned to the command line.
function varargout = K_means_OutputFcn(hobject eventdata handles)
varargout{1} = handles.output;
% --- Executes on button press in Pushbutton_Imread.
function Pushbutton_Imread_Callback(hobject eventdata handles)
global Fig;
global Length;
global Width;
global Dim;
global Num;
global PopUp;
global xPos;
global yPos;
global R;
global G;
global B;
global R_GB;
global angle_x;
angle_x=0;
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% : Initilize var
Length=0;
Width=0;
Num=0;
PopUp=0;
xPos=0;
yPos=0;
Fig=0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%显示图像和尺寸
[filenamepathname]=uigetfile({‘*.jpg‘:‘*.bmp‘:‘*.gif‘}‘选择图片‘);
str=[pathname filename];
Fig=imread(str);
[LengthWidthDim]=size(Fig);
str1=num2str(Length);
str2=‘*‘;
str3=num2str(Width);
str=strcat(str3str2str1);
set(handles.Edit_Imread‘string‘str);
axes(handles.Axes_ResultPho);
hold off
Fig_white=Fig;
Fig_white=255*ones(LengthWidthDim);
imshow(Fig_white);
axes(handles.Axes_InitPho);
hold off;
h=imshow(Fig);
set(handles.Axes_InitPho‘visible‘‘on‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%读取样本点数量
Str=get(handles.edit_Num‘string‘);
Num=str2num(Str);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%读取产生样本点
Fig=double(Fig);
Val=get(handles.pop_example‘Value‘);
Str=get(handles.pop_example‘String‘);
switch Str{Val}
case ‘Rand‘
PopUp=1;
for i=1:Num
xPos(i)=floor(rand*Length)+1;
yPos(i)=floor(rand*Width)+1;
R(i)=Fig(xPos(i)yPos(i)1);
G(i)=Fig(xPos(i)yPos(i)2);
B(i)=Fig(xPos(i)yPos(i)3);
R_GB(i)=R(i)/(G(i)+B(i));
% GB_R(i)=(G(i)+B(i))/R(i);
end
case ‘Rules‘
PopUp=2;
temp=round(sqrt((Num*Length)/Width));
if temp % temp=temp+1;
temp=temp;
end
LenNum=temp;
WidNum=round(temp*Width/Length);
if LenNum*WidNum WidNum=WidNum+1;
end
deta_Len=floo
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-05-18 18:08 2\
文件 64512 2015-05-17 23:55 2\Kmeans.vsd
文件 22006 2010-05-11 18:23 2\K_means.fig
文件 11241 2010-05-12 19:03 2\K_means.m
文件 233120 1998-04-12 16:09 2\S3a.bmp
文件 18355 2010-04-25 19:28 2\图片1.jpg
文件 47104 2010-05-13 19:24 2\模式识别homework2.ppt
文件 140902 2010-04-21 19:59 2\照片 064.jpg
文件 188309 2010-04-21 20:03 2\照片 085.jpg
文件 131347 2010-04-21 20:03 2\照片 088.jpg
相关资源
- 动物图像多分类识别MATLAB可运行
- 模式识别身高体重贝叶斯算法
- ISODATA聚类算法matlab实现
- 贝叶斯高斯分类作业
- 模式识别大作业MATLAB版)
- FCMClust(模糊c均值聚类算法MATLAB实现
- 量子聚类算法matlab实现
- MATLAB应用BP神经网络对英文字母的识别
- matlab模式识别感知器实现线性可分、
- ISOMAP 源码matlab编写
- ISODATA的matlab代码
- 水果智能分类系统模式识别
- FLICM聚类算法matlab代码与C代码
- 模式识别或数字识别
- 光学字符识别系统matlab版
- 支持向量机用于肌电信号模式识别的
- 蚁群聚类算法matlab实现
- matlab实现字母识别
- 蚂蚁聚类算法MATLAB程序
- 超全的模式识别Matlab源程序,涉及几
- matlab模糊聚类算法进行图像分割的源
- meanshift的matlab实现及2维图演示代码
- 神经网络用于模式识别及MATLAB源代码
- ap聚类算法MATLAB实现代码
- 模式识别第四版matlab代码
- DBSCAN聚类算法matlab代码
- AP聚类算法的源代码
- matlab实现模式识别的聚类分类算法
- 用matlab实现基于灰度的阈值分割算法
- 用matlab实现最大最小距离聚类算法
评论
共有 条评论