资源简介
K均值和C均值聚类,实现间隔采样,绘制三维聚类中心轨迹,实现道路标志检测
代码片段和文件信息
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 homework2\
文件 64512 2015-05-17 23:55 homework2\Kmeans.vsd
文件 22006 2010-05-11 18:23 homework2\K_means.fig
文件 11241 2010-05-12 19:03 homework2\K_means.m
文件 233120 1998-04-12 16:09 homework2\S3a.bmp
文件 18355 2010-04-25 19:28 homework2\图片1.jpg
文件 47104 2010-05-13 19:24 homework2\模式识别homework2.ppt
文件 140902 2010-04-21 19:59 homework2\照片 064.jpg
文件 188309 2010-04-21 20:03 homework2\照片 085.jpg
文件 131347 2010-04-21 20:03 homework2\照片 088.jpg
- 上一篇:K-均值聚类实现路标检测
- 下一篇:igmp proxy
相关资源
- 用中值滤波和均值滤波去除高斯白噪
- 微电网的调度优化,采用智能算法进
- 蚁群算法进行三维路径规划
- noma系统实现代码
- LDPC 编码,随机生成 H 矩阵,LLR-BP算法
- CEEMD-信息熵-完美运行,你指的拥有。
- 遗传算法函数优化三元二次函数
- 单元级联高压STATCOM仿真-cascaded_Hbrid
- 遗传算法优化bp神经网络权值和单纯
- LSSVM工具箱中文版-LS-SVM.doc
- Matalbpso优化bp网络程序-PSO-bp.rar
- 基于干扰观测器的单机械臂滑模控制
- SAR图像CFAR检测算法实现
- 经典经典的粒子群算法
- Virus Spread Model.rar
- 有效去除阴影代码效果很好.zip
- 模糊神经网络,结合模糊算法与神经
- 匹配追踪MP、正交匹配追踪算法OMP,稀
- 带约束处理的粒子群算法,简明清晰
- 二值图像的轮廓提取以及跟踪算法
- OFDM完整仿真过程与教程.zip
- 数字图像去雾处理
- 基于后投影算法穿墙雷达成像
- 风光储微网模型仿真.zip
- 三次样条插值法,求信号包络线
- 《通信系统课群综合训练与设计》武
- BP神经网络PID控制器
- 基于SS3型电力机车的仿真模型
- 压缩感知算法
- RL负载33节点标准配电网模型
评论
共有 条评论