Matlab k-means聚类手势识别

K-means聚类 —— matlab 1.简介 2.算法原理 3.实例分析 3.1 读取数据 3.2原理推导K均值过程 3.3 自带kmeans函数求解过程 完整代码 阅读详情

Matlab k-means聚类手势识别

一、简介

根据手的特征,提取手部轮廓特征,k-means聚类算法,训练得到手势识别的模型,然后用测试数据测试。

1 K-means算法原理介绍
K-means算法是最常用的一种聚类算法。算法的输入为一个样本集(或者称为点集),通过该算法可以将样本进行聚类,具有相似特征的样本聚为一类。

针对每个点,计算这个点距离所有中心点最近的那个中心点,然后将这个点归为这个中心点代表的簇。一次迭代结束之后,针对每个簇类,重新计算中心点,然后针对每个点,重新寻找距离自己最近的中心点。如此循环,直到前后两次迭代的簇类没有变化。

下面通过一个简单的例子,说明K-means算法的过程。如下图所示,目标是将样本点聚类成3个类别。
2 基本的步骤为:

step1:选定要聚类的类别数目k(如上例的k=3类),选择k个中心点。

step2:针对每个样本点,找到距离其最近的中心点(寻找组织),距离同一中心点最近的点为一个类,这样完成了一次聚类。

step3:判断聚类前后的样本点的类别情况是否相同,如果相同,则算法终止,否则进入step4。

step4:针对每个类别中的样本点,计算这些样本点的中心点,当做该类的新的中心点,继续step2。

3 上述步骤的关键两点是:

找到距离自己最近的中心点。

更新中心点。

二、源代码

%------------------hand shape analysis

%

close all

format long     %显示小数点后4位的数据

%读入hand的landmark数值

fid=fopen('shapes.txt');

hand=fscanf(fid, '%g %g',[40,inf]); %  X(1,1)X(2,1)...X(56,1);X(1,2)X(2,2)...X(56,2)

% choose 40 shapes as a row column

Shape=600*hand;

%-----------------------------------------------------

%   shape 矩阵每行112列,对应一个手的数据,

%   前56列对应X坐标 后56列对应Y坐标

%   Odata中所有形状的质点已经平移到原点

temp=Shape;

[temp,X,Y]=show2D(temp);             

% %--------Show unaligned shape  

% plot(X,Y,'r*');

% title('unaligned hands');

%------------------Compute the shape metric---------------------------

%-------------------------计算each Shape Size-------------------------

T=temp*temp';                             % Diag的对角元素为∑(x^2+y^2)

V=diag(T);                                % compute 对角线

size=sqrt(V);                             % Size 为40×1矩阵

%------------------------将Size归一化--------------------------------

%%%         根据形状大小的函数满足S(ax)=aS(x),每个坐标都除以对应Size的值

for i=1:40

  preHand(i,:)=temp(i,:)/size(i);               % preHand 为已经对准质点和大小

end

% -------------------------将各个形状以hand1为mean旋转------------------------

x1=preHand(1,:);      % vector 1*40

x1=reshape(x1,56,2);

x2=preHand(2,:);

for i=2:40

    x3=preHand(i,:);

    x2=reshape(x3,56,2);

    XD=x1'*x2;

    [U,S,V]=svd(XD);

    I=x2*V*U';

    preHand(i,:)=reshape(I,1,112);

end

aligned=preHand;

for i=1:40

for j=1:56

     XX(i,j)=aligned(i,j);            % the mean x-axis coordinate of every landmark  

     YY(i,j)=aligned(i,j+56);         % the mean y-axis coordinate of every landmark

end   

end

plot(XX,YY,'ro')

%-----------------compute the mean shape coordinates

%   every column of colm is the mean cooridnate of all the 40 hands'

%   coordinate respectively

colm=mean(aligned);              % mean(X) 求每一列元素的均值

for i=1:56

     XX(i)=colm(i);            % the mean x-axis coordinate of every landmark  

     YY(i)=colm(i+56);         % the mean y-axis coordinate of every landmark

end  

% subplot(1,2,1);

% figure;

% plot(XX,YY,'g-',XX,YY,'rx');               % show the mean shape of 40 hands

% title('the Mean Shape of Aligned');

% title('b1=0');

%---------------------------------------------------------------

%   tangent space projection

absx=colm*colm';absx=absx*absx;

for i=1:40

    xo=dot(colm,aligned(i,:));          % 矩阵点乘

    xt(i,:)=absx*aligned(i,:)/xo;

end    

%---------------------------------------------------------------

%    PCA

[signals,PC,V] = pca1(xt');

% eAB=xt*xt';       % 应该减去均值球协方差矩阵

% eAb=xt*xt'/39;

% % eBA=xt'*xt;

% [PC,V]=eig(eAB);

% [PC1,V1]=eig(eAb);

% V=diag(V);

% V1=diag(V1);

% sumV=40*mean(V);

%   compute the eigenvector of eBA

% PC1=xt'*PC;

% figure(2)

% bar(V);

% title('Shape eigenvalue');

% xlabel('Eigenvalue');

% ylabel('variance expansion factor(percent)');

%   now the shape model can be x=xmean+PC1*B,

%   where b {-3*sqrt(λ),3*sqrt(λ)}

% Pb=PC(:,1)*3*sqrt(V1(1));

% Xz=colm+Pb1';

% Xz=colm-Pb1';

Pb2=signals(:,2)*3*sqrt(V(2));

 Xz=colm-Pb2';

% Xz=colm-Pb2';

% for i=1:56

%      Xp(i)=Xz(i);            % the mean x-axis coordinate of every landmark  

%      Yp(i)=Xz(i+56);         % the mean y-axis coordinate of every landmark

% end   

function edgedemo(action, varargin)

%EDGEDEMO Edge detection demo.

%   This demo uses the EDGE function to apply different edge detection

%   

%

%   The Saturn and Lifting Body images are courtesy of NASA.

%  

%   See also EDGE.

%   Copyright 1993-2004 The MathWorks, Inc.  

%   $Revision: 1.19.4.7 $  $Date: 2004/04/01 16:12:06 $

% Function subroutines:

%

% InitializeEDGEDEMO -      Initialization of controls, axes, and

%                           Images.

%

% ComputeEdgeMap -          Computes the Edge map of the original

%                           image using edge.m

%

% SelectMethod -            Selects Edge Detection method and enable/disable

%                           the appropriate controls

%

% LoadNewImage -            Loads the selected Image

%

% UpdateThreshCtrl -     Grabs the threshold from the Edit box and

%                           enables the Apply button

%

% UpdateDirectionality -    Sets the directionality string based on the

%                           popup menu.

%

% Radio -                   Sets values for Radio Buttons and enables/disables

%                           the threshold edit box.

%

% UpdateLOGSize -           Grabs the LOG filter size from edit box

%

% UpdateLOGSigma -          Grabs LOG filter Sigma from edit box

%

% ActivateSPRControls -     Turns on controls for Sobel, Prewitt, Roberts

%

% ActivateLOGControls -     Turns on controls for LOG.

if nargin<1,

   action='InitializeEDGEDEMO';

end;

feval(action,varargin{:});

return;

%%%

%%%  Sub-function - InitializeEDGEDEMO

%%%

function InitializeEDGEDEMO()

% If dctdemo is already running, bring it to the foreground.

screenD = get(0, 'ScreenDepth');

if screenD>8

   grayres=256;

else

   grayres=128;

end

EdgeDemoFig = figure( ...

   'Name','Edge Detection Demo', ...

   'NumberTitle','off', 'HandleVisibility', 'on', ...

   'tag', 'Edge Detection Demo', ...

   'Visible','off', 'Resize', 'off',...

   'BusyAction','Queue','Interruptible','off', ...

   'Color', [.8 .8 .8], ...

   'IntegerHandle', 'off', ...

   'DoubleBuffer', 'on', ...

   'Colormap', gray(grayres));

figpos = get(EdgeDemoFig, 'position');

% Adjust the size of the figure window

figpos(3:4) = [560 420];

horizDecorations = 10;  % resize controls, etc.

vertDecorations = 45;   % title bar, etc.

screenSize = get(0,'ScreenSize');

if (screenSize(3) <= 1)

    % No display connected (apparently)

    screenSize(3:4) = [100000 100000]; % don't use Inf because of vms

end

if (((figpos(3) + horizDecorations) > screenSize(3)) | ...

            ((figpos(4) + vertDecorations) > screenSize(4)))

    % Screen size is too small for this demo!

    delete(EdgeDemoFig);

    error(['Screen resolution is too low ', ...

          '(or text fonts are too big) to run this demo']);

end

dx = screenSize(3) - figpos(1) - figpos(3) - horizDecorations;

dy = screenSize(4) - figpos(2) - figpos(4) - vertDecorations;

if (dx < 0)

    figpos(1) = max(5,figpos(1) + dx);

end

if (dy < 0)

    figpos(2) = max(5,figpos(2) + dy);

end

set(EdgeDemoFig, 'position', figpos);

rows = figpos(4); cols = figpos(3);

hs = (cols-512) / 3;        % Horizantal Spacing

bot = rows-2*hs-256;        % Bottom of the images

%====================================

% Parameters for all buttons and menus

ifs = hs/2;   % Intraframe Spacing

Std.Interruptible = 'off';

Std.BusyAction = 'queue';    

%================================

% Original Image Axes

hdl.ImageAxes = axes(Std, ...

   'Units', 'Pixels', ...

   'Parent',EdgeDemoFig,...

   'ydir', 'reverse', ...

   'XLim', [.5 256.5], ...

   'YLim', [.5 256.5],...

   'CLim', [0 255], ...

   'Position',[hs bot 256 256], ...

   'XTick',[],'YTick',[]);

set(get(hdl.ImageAxes, 'title'), 'string', 'Original Image');

%================================

% Edge Map Axes

hdl.EdgeAxes = axes(Std, ...

   'Units', 'Pixels', ...

   'Parent',EdgeDemoFig,...

   'ydir', 'reverse', ...

   'XLim', [.5 256.5], ...

   'YLim', [.5 256.5],...

   'CLim', [0 1], ...

   'Position',[cols-hs-256 bot 256 256], ...

   'XTick',[],'YTick',[]);

set(get(hdl.EdgeAxes, 'title'), 'string', 'Edge Map');

%================================

% Original Image

hdl.Image = image(Std, ...

   'CData', [], ...

   'CDataMapping', 'scaled', ...

   'Parent',hdl.ImageAxes,...

   'Xdata', [1 256],...

   'Ydata', [1 256],...

   'EraseMode', 'none');

%================================

% Edge Map Image

hdl.Edge = image(Std, ...

   'CData', [], ...

   'CDataMapping', 'scaled', ...

   'Parent',hdl.EdgeAxes,...

   'Xdata', [1 256],...

   'Ydata', [1 256],...

   'EraseMode', 'none');

% Background color for frames

bgcolor = [0.45 0.45 0.45];

fgcolor = [1 1 1];  % For text

%================================

% The Menu frame - image and method popups go here

mfleft=hs;

mfbot=hs;

mfwid=(3*cols/8)-1.5*hs; % 2*cols/7

mfht=bot-2*hs;

hdl.MenuFrame = uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style', 'frame', ...

   'Units', 'pixels', ...

   'Position', [mfleft mfbot mfwid mfht], ...

   'BackgroundColor', bgcolor);

%====================================

% The LoadNewImage menu : ip-> Image Popup

ipwid = mfwid-2*ifs;

ipht = 21;       % (mfht-5*ifs)/3;

ipleft = mfleft+ifs;

ipbot = mfbot+1.7*ifs + 2*ipht;

hdl.ImgPop=uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','popupmenu', ...

   'Units','pixels', ...

   'Position',[ipleft ipbot ipwid ipht], ...

   'Enable','on', ...

   'String','Coins|Circuit|Vertigo|Lifting Body|Rice|Saturn|Eight Bit|Glass', ...

   'Tag','ImagesPop',...

   'Callback','edgedemo(''LoadNewImage'')');

% Text label for Image Menu Popup

% The Method menu : mp-> Method Popup

hdl.Method = 'Sobel';

mpwid = ipwid;

mpht = ipht;

mpleft = ipleft;

mpbot = mfbot+1.2*ifs;

hdl.MethodPop=uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','popupmenu', ...

   'Units','pixels', ...

   'Position',[mpleft mpbot mpwid mpht], ...

   'Enable','on', ...

   'String','Sobel|Prewitt|Roberts|Laplacian of Gaussian|Canny', ...

   'Tag','MethodPop',...

   'Callback','edgedemo(''SelectMethod'')');

% Text label for Method Popup

uicontrol( Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','text', ...

   'Units','pixels', ...

   'Position',[mpleft mpbot+mpht mpwid 18], ...

   'Horiz','left', ...

   'Background',bgcolor, ...

   'Foreground',fgcolor, ...

   'String','Edge Detection Method:');

%================================

% The Parameter frame - method specific parameters go here

pfleft =(3*cols/8)+0.5*hs; % 2*cols/7

pfbot = 1.5*hs;

pfwid =(3*cols/8)-hs; % 3*cols/7

pfht = bot-2.5*hs;

hdl.ParamFrame = uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style', 'frame', ...

   'Units', 'pixels', ...

   'Position', [ pfleft pfbot pfwid pfht ], ...

   'BackgroundColor', bgcolor);

%====================================

% Controls for Sobel/Prewitt/Roberts edge detectors:

% Text label for Threshold Controls

labelleft = pfleft+ifs;

labelwid = pfwid/2-hs;

labelbot = pfbot+2*pfht/3;

hdl.sprThLbl = uicontrol(Std,...

   'Parent', EdgeDemoFig, ...

   'Style','text', ...

   'Units','pixels', ...

   'Position',[labelleft labelbot labelwid 18], ...

   'Horiz','left', ...

   'String','Threshold:', ...

   'BackgroundColor',bgcolor, ...

   'ForegroundColor',fgcolor);

hdl.Threshold = 0;             % Initial value

raleft = pfleft + pfwid/2 - hs/2;

rabot = pfbot+2*pfht/3+hs/6;

rawid = pfwid/2;

raht = ipht;

hdl.RadioAutomatic=uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','radiobutton', ...

   'Units','pixels', ...

   'Position',[raleft rabot rawid raht], ...

   'String','Automatic', ...

   'value',1,'Userdata',1, ...

   'Callback','edgedemo(''Radio'',''auto'')');

rmleft = pfleft + pfwid/2 - hs/2;

rmbot = pfbot+pfht/3+hs/3;

rmwid = hs*1.5;

rmht = ipht;

hdl.RadioManual=uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','radiobutton', ...

   'Units','pixels', ...

   'Position',[rmleft rmbot rmwid rmht], ...

   'String','', ...

   'value',0,'Userdata',0, ...

   'Callback','edgedemo(''Radio'',''manual'')');

thleft = rmleft+rmwid;

thwid = rawid-rmwid;

thbot = rmbot;

thht = rmht;

hdl.ThreshCtrl = uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Enable', 'off', ...

   'Style','edit', ...

   'Units','pixels', ...

   'Position',[thleft thbot thwid thht], ...

   'Horiz','right', ...

   'Background','white', ...

   'Foreground','black', ...

   'String','0',...

   'callback','edgedemo(''UpdateSprThresh'')');

% The Directionality Popup menu : dp-> Direction Popup

dpwid = pfwid/2;

dpht = ipht;

dpleft = pfleft + pfwid/2 - hs/2;

dpbot = pfbot+.4*hs;

hdl.sprDirPop=uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','popupmenu', ...

   'Units','pixels', ...

   'Position',[dpleft dpbot dpwid dpht], ...

   'Enable','on', ...

   'String','Both|Horizontal|Vertical', ...

   'Tag','DirectionPop',...

   'Callback','edgedemo(''UpdateDirectionality'')');

% Text label for Directionality Popup

labelleft = pfleft+ifs;

labelwid = pfwid/2-hs;     %5*hs/4

labelbot = dpbot;

hdl.sprDirLbl = uicontrol( Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','text', ...

   'Units','pixels', ...

   'Position',[labelleft labelbot labelwid 18], ...

   'Horiz','left', ...

   'Background',bgcolor, ...

   'Foreground',fgcolor, ...

   'String','Direction:');

hdl.Directionality = 'both';

hdl.logSigmaCtrl=uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','edit', ...

   'Units','pixels', ...

   'Position',[dpleft dpbot dpwid dpht], ...

   'Horiz','right', ...

   'Background','white', ...

   'Foreground','black', ...

   'String','2', ...

   'Tag','DirectionPop',...

   'Visible', 'off', ...

   'Callback','edgedemo(''UpdateLOGSigma'')');

% Text label for Sigma edit box

hdl.logSigmaLbl = uicontrol( Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','text', ...

   'Units','pixels', ...

   'Position',[labelleft labelbot labelwid 18], ...

   'Horiz','left', ...

   'Background',bgcolor, ...

   'Foreground',fgcolor, ...

   'Visible', 'off', ...

   'String','Sigma:');

hdl.LogSigma = 2;

%====================================

% Status bar

colr = get(EdgeDemoFig,'Color');

hdl.Status = uicontrol( Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','text', ...

   'Units','pixels', ...

   'Background', colr, ...

   'Foreground', [.8 0 0], ...

   'Position',[pfleft 2 pfwid 18], ...

   'Horiz','center', ...

   'Tag', 'Status', ...

   'String','Initializing Edge Detection Demo...');

%================================

% The Button frame - Apply, Info, and Close buttons go here

bfleft = (3*cols/4)+.5*hs; % 5*cols/7

bfbot = hs;

bfwid = (cols/4)-1.5*hs; % 2*cols/7

bfht = bot-2*hs;

hdl.ButtonFrame = uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style', 'frame', ...

   'Units', 'pixels', ...

   'Position', [ bfleft bfbot bfwid bfht ], ...

   'BackgroundColor', bgcolor);

%====================================

% The APPLY button

btnwid = bfwid - 2*ifs;

btnht =  (bfht-4*ifs)/3;     % 21

btnleft = bfleft + ifs;

btnbot = bfbot + bfht - ifs - btnht;

hdl.Apply=uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','pushbutton', ...

   'Units','pixels', ...

   'Position',[btnleft btnbot btnwid btnht], ...

   'Enable','off', ...

   'String','Apply', ...

   'Callback','edgedemo(''ComputeEdgeMap'')');

%====================================

% The INFO button

btnbot = bfbot + bfht - 2*ifs - 2*btnht;

hdl.Help=uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','pushbutton', ...

   'Units','pixels', ...

   'Position',[btnleft btnbot btnwid btnht], ...

   'Enable','off', ...

   'String','Info', ...

   'Callback','helpwin edgedemo');

%====================================

% The CLOSE button

btnbot = bfbot + ifs;

hdl.Close=uicontrol(Std, ...

   'Parent', EdgeDemoFig, ...

   'Style','pushbutton', ...

   'Units','pixels', ...

   'Position',[btnleft btnbot btnwid btnht], ...

   'Enable','off', ...

   'String','Close', ...

   'Callback','close(gcbf)');

set(EdgeDemoFig, 'Userdata', hdl, 'Visible', 'on');

drawnow

LoadNewImage(EdgeDemoFig);

drawnow

set(EdgeDemoFig, 'HandleVisibility', 'Callback');

set([hdl.Apply hdl.Help hdl.Close] , 'Enable', 'on');

return

%%%

%%%  Sub-Function - ComputeEdgeMap

%%%

function ComputeEdgeMap(DemoFig)

if nargin<1

   callb = 1;    % We're in a callback

   DemoFig = gcbf;

else

   callb = 0;    % We're in the initialization

end

三、参考运行图

Matlab实现Kmeans聚类算法 matlab实现kmeans聚类算法 阅读详情

相关推荐

最优化方法——K-means实现手写数字图像聚类

本篇博客主要介绍K-means算法的原理与流程,降维算法的优化问题解决与使用,并分别使用Matlab、Pycharm分别实现了使用K-means算法在实际问题中(对MNIST手写数字数据集)的聚类并进行分析,并分别使用了PCA与LDA对其进行了降维可视化(内附数据集和python及matlab代码)。

转载请标明出处,完整项目/代码详见github:https://github.com/yiru1225 9134

k-means聚类算法及matlab实现(简单实现)

k-means简介   k-means算法也称k均值算法,是一种常用的聚类算法。聚类算法是研究最多、应用最广的一种无监督学习算法。   聚类试图将数据集中的样本划分为若干个通常是不相交的子集,每个子集称为一个“簇”。通过这样的划分,每个簇里的样本可能有一些潜在的、共同的特质。   例如,对于给定样本集D={x1,x2,x3,…,xm}包含m个无标记样本,其中每个样本xi是一个n维的特征向量,聚类算法将样本集D划分为k个不相交的簇。其中,k个簇之间互不相交,且k个簇的并集为D。 k-means原理 k-mea

qq_43812171的博客 4万+

【手势识别】基于matlab k-means聚类手势识别【含Matlab源码 386期】

k-means聚类手势识别 完整的代码,方可运行;可提供运行操作视频!适合小白!

订阅付费专栏Matlab(奶茶价版),可赠送奶茶价版付费专栏指定代码1份; 2914

基于MATLAB的简单手势识别

用卷积神经网络做了一个简单的手势识别,能够别手势1、2、3,数据集是使用笔记本电脑自带摄像头截取的,每种手势截取40张图片,一共120张,其中90张用于训练,30张用于验证,训练的准确率一般在百分之九十左右,目前最高的准确率达到过百分之百(简直太满意了)。后面进一步的实验可以把手势的种类增加到10种,每种手势截取的图片增加到100张。...

qq_1070971363的博客 7477

手势识别中基于 MATLAB 的 k-means 聚类算法

在手势识别中,聚类算法是一种常用的技术,可以将相似的手势样本归为一类。本文将介绍如何使用 MATLAB 中的 k-means 聚类算法实现手势识别,并提供相应的源代码。通过将相似的手势样本归为一类,我们可以对手势数据进行聚类分析,并根据聚类结果进行手势识别。接下来,我们使用 MATLAB 中的 k-means 聚类算法对手势数据集进行聚类。k-means 算法是一种迭代的聚类算法,它将样本划分为 k 个簇,使得同一簇内的样本之间的距离最小化。在实际应用中,我们可以根据手势的聚类结果进行手势识别和分类。

HackCyberX的博客 147

【手势识别】k-means聚类手势识别【含Matlab源码 386期】

k-means聚类手势识别 完整的代码,方可运行;可提供运行操作视频!适合小白!

订阅付费专栏Matlab(奶茶价版),可赠送奶茶价版付费专栏指定代码1份; 872

Kmeans聚类算法——Matlab

matlab实现Kmeans聚类算法+过程、结果可视化

m0_69715013的博客 3565

【图像识别】基于k-means聚类实现手势识别matlab代码

1 简介 k-means算法是一种聚类算法,所谓聚类,即根据相似性原则,将具有较高相似度的数据对象划分至同一类簇,将具有较高相异度的数据对象划分至不同的类簇。聚类与分类最大的区别在于,聚类过程为无监督过程,即待处理数据对象没有任何先验知识,而分类过程为有监督过程,即存在有先验知识的训练数据集。k-means算法中的 k代表类簇的个数,means代表类簇内数据对象的均值(这种均值是一种对类簇中心的描述),因此 k-means 算法又称为 k-均值算法。k-means 算法是一种基于划分的聚类算法,以距离作为

qq_59747472的博客 885

Matlab k-means聚类手势识别【源码 GUI】

-------------------------将各个形状以hand1为mean旋转------------------------%-------------------------计算each Shape Size-------------------------%------------------------将Size归一化--------------------------------%%% 根据形状大小的函数满足S(ax)=aS(x),每个坐标都除以对应Size的值。

GPT_code的博客 973

基于k-means算法的手势识别matlab实现

本文中,我们选择了UCI机器学习库中的手势识别数据集,该数据集包含5个手势动作和1100个样本,每个样本由64个特征向量组成。接着,我们使用matlab的PCA函数对数据进行降维,将64维的特征向量降为2维以便于可视化展示。k-means算法是一种经典的无监督聚类算法,它将数据集分成k个类别。k-means算法的核心思想是迭代更新每个数据点所属的类别,以使得数据点到所属类别的质心距离最小。本文将介绍如何使用matlab实现基于k-means算法的手势识别,并提供相应的源代码。k-means聚类算法。

uote_e的博客 241

基于 Matlab K-Means 算法的手势识别

在训练集上,我们使用 K-Means 算法对图像进行聚类处理,并计算每个手势在每个簇中所占的比例。我们使用了一个公开的手势数据集,包含5种手势(数字1-5)和一个空手势(手势静止)。具体地,我们计算待分类的手势图像向量与每个聚类中心的距离,并选择距离最近的那个聚类中心所在的簇。如果该簇对应的手势为数字1,则将待分类的手势归为数字1,以此类推。对于新的手势图像,我们使用已经训练好的 K-Means 聚类模型将其分配到某一个簇。K-Means 算法是一种常用的聚类算法,它可以将样本划分为K个簇。

NoerrorCode的博客 287

基于Matlab k-means聚类手势识别【源码 GUI】

-------------------------将各个形状以hand1为mean旋转------------------------%-------------------------计算each Shape Size-------------------------%------------------------将Size归一化--------------------------------%%% 根据形状大小的函数满足S(ax)=aS(x),每个坐标都除以对应Size的值。

2401_84149290的博客 1157

Altium Designer 18 将Gerber文件逆向转换成PCB(详细记录)

自己看了网上的教程,弄了很久,估计还有不足的地方,但是先把思路理一理(初学AD) 同时遇到了许多问题: 不是AD导出的Gerber估计不能自动识别层 要自己设置层顺序 要有钻孔文件数据制作NC工具(我也不懂是怎么说,就是size尺寸的) 这里记录一下,以防忘记。 正常顺序: 1.新建CAM 2.导入Gerber,选择CAM文件夹下的所有文件导入 3.设置层属性和物理顺序 4.设置NC工具 5.提取网络表 ...

lb_monkey的博客 1万+

【图像识别】基于k-means聚类的手势识别matlab 源码

一、简介 提取手部轮廓特征,k-means聚类算法,训练得到手势识别模型,然后用测试数据测试。1 K-means算法原理K-means算法是最常用的一种聚类算法。算法的输入为一个样本集(或者称为点集),通过该算法可以将样本进行聚类,具有相似特征的样本聚为一类。 针对每个点,计算这个点距离所有中心点最近的那个中心点,然后将...

Matlab_dashi的博客 96

MATPOWER的安装详细教程

MATPOWER的安装包实际为一个程序包,安装教程很简单,详见本文。

半个月亮Zz的博客 3万+

安时积分法和开路电压法结合估算锂电池SOC

基于安时积分法和开路电压法结合的锂电池SOC估计Simulink仿真建模,利用安时积分法计算放电过程中的SOC,在搁置状态利用开路电压法进行SOC修正。

qq_39304296的博客 2561
上一篇: 基于matlab的视频和深度学习的手势识别
下一篇: Matlab k-means聚类手势识别【源码 GUI】
GPT_code
博客等级 码龄3年 3543粉丝 338原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值