【跌倒检测】基于计算机视觉和帧差法的人体跌倒检测系统附matlab代码

简介: 【跌倒检测】基于计算机视觉和帧差法的人体跌倒检测系统附matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信      无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机

⛄ 内容介绍

一种基于人体姿态估计的跌倒检测方法.包括接入视频,对视频进行解码得到视频帧,对视频帧做实时人体姿态估计,获取视频帧中人的关节点坐标;根据关节点的坐标位置,判断是否跌倒,本发明根据人体姿态估计,获取人体关节点的位置信息,根据部分关节点之间的位置关系判断是否有"跌倒"出现.

⛄ 部分代码

function [rectx,recty,area,perimeter] = minboundrect(x,y,metric)

% minboundrect: Compute the minimal bounding rectangle of points in the plane

% usage: [rectx,recty,area,perimeter] = minboundrect(x,y,metric)

%

% arguments: (input)

%  x,y - vectors of points, describing points in the plane as

%        (x,y) pairs. x and y must be the same lengths.

%

%  metric - (OPTIONAL) - single letter character flag which

%        denotes the use of minimal area or perimeter as the

%        metric to be minimized. metric may be either 'a' or 'p',

%        capitalization is ignored. Any other contraction of 'area'

%        or 'perimeter' is also accepted.

%

%        DEFAULT: 'a'    ('area')

%

% arguments: (output)

%  rectx,recty - 5x1 vectors of points that define the minimal

%        bounding rectangle.

%

%  area - (scalar) area of the minimal rect itself.

%

%  perimeter - (scalar) perimeter of the minimal rect as found

%

%

% Note: For those individuals who would prefer the rect with minimum

% perimeter or area, careful testing convinces me that the minimum area

% rect was generally also the minimum perimeter rect on most problems

% (with one class of exceptions). This same testing appeared to verify my

% assumption that the minimum area rect must always contain at least

% one edge of the convex hull. The exception I refer to above is for

% problems when the convex hull is composed of only a few points,

% most likely exactly 3. Here one may see differences between the

% two metrics. My thanks to Roger Stafford for pointing out this

% class of counter-examples.

%

% Thanks are also due to Roger for pointing out a proof that the

% bounding rect must always contain an edge of the convex hull, in

% both the minimal perimeter and area cases.

%

%

% Example usage:

%  x = rand(50000,1);

%  y = rand(50000,1);

%  tic,[rx,ry,area] = minboundrect(x,y);toc

%

%  Elapsed time is 0.105754 seconds.

%

%  [rx,ry]

%  ans =

%      0.99994  -4.2515e-06

%      0.99998      0.99999

%   2.6441e-05            1

%  -5.1673e-06   2.7356e-05

%      0.99994  -4.2515e-06

%

%  area

%  area =

%      0.99994

%

%

% See also: minboundcircle, minboundtri, minboundsphere

%

%

% Author: John D'Errico

% E-mail: woodchips@rochester.rr.com

% Release: 3.0

% Release date: 3/7/07


% default for metric

if (nargin<3) || isempty(metric)

 metric = 'a';

elseif ~ischar(metric)

 error 'metric must be a character flag if it is supplied.'

else

 % check for 'a' or 'p'

 metric = lower(metric(:)');

 ind = strmatch(metric,{'area','perimeter'});

 if isempty(ind)

   error 'metric does not match either ''area'' or ''perimeter'''

 end

 

 % just keep the first letter.

 metric = metric(1);

end


% preprocess data

x=x(:);

y=y(:);


% not many error checks to worry about

n = length(x);

if n~=length(y)

 error 'x and y must be the same sizes'

end


% start out with the convex hull of the points to

% reduce the problem dramatically. Note that any

% points in the interior of the convex hull are

% never needed, so we drop them.

if n>3

 edges = convhull(x,y);  % 'Pp' will silence the warnings


 % exclude those points inside the hull as not relevant

 % also sorts the points into their convex hull as a

 % closed polygon

 

 x = x(edges);

 y = y(edges);

 

 % probably fewer points now, unless the points are fully convex

 nedges = length(x) - 1;

elseif n>1

 % n must be 2 or 3

 nedges = n;

 x(end+1) = x(1);

 y(end+1) = y(1);

else

 % n must be 0 or 1

 nedges = n;

end


% now we must find the bounding rectangle of those

% that remain.


% special case small numbers of points. If we trip any

% of these cases, then we are done, so return.

switch nedges

 case 0

   % empty begets empty

   rectx = [];

   recty = [];

   area = [];

   perimeter = [];

   return

 case 1

   % with one point, the rect is simple.

   rectx = repmat(x,1,5);

   recty = repmat(y,1,5);

   area = 0;

   perimeter = 0;

   return

 case 2

   % only two points. also simple.

   rectx = x([1 2 2 1 1]);

   recty = y([1 2 2 1 1]);

   area = 0;

   perimeter = 2*sqrt(diff(x).^2 + diff(y).^2);

   return

end

% 3 or more points.


% will need a 2x2 rotation matrix through an angle theta

Rmat = @(theta) [cos(theta) sin(theta);-sin(theta) cos(theta)];


% get the angle of each edge of the hull polygon.

ind = 1:(length(x)-1);

edgeangles = atan2(y(ind+1) - y(ind),x(ind+1) - x(ind));

% move the angle into the first quadrant.

edgeangles = unique(mod(edgeangles,pi/2));


% now just check each edge of the hull

nang = length(edgeangles);

area = inf;

perimeter = inf;

met = inf;

xy = [x,y];

for i = 1:nang

 % rotate the data through -theta

 rot = Rmat(-edgeangles(i));

 xyr = xy*rot;

 xymin = min(xyr,[],1);

 xymax = max(xyr,[],1);

 

 % The area is simple, as is the perimeter

 A_i = prod(xymax - xymin);

 P_i = 2*sum(xymax-xymin);

 

 if metric=='a'

   M_i = A_i;

 else

   M_i = P_i;

 end

 

 % new metric value for the current interval. Is it better?

 if M_i<met

   % keep this one

   met = M_i;

   area = A_i;

   perimeter = P_i;

   

   rect = [xymin;[xymax(1),xymin(2)];xymax;[xymin(1),xymax(2)];xymin];

   rect = rect*rot';

   rectx = rect(:,1);

   recty = rect(:,2);

 end

end

% get the final rect


% all done


end % mainline end


⛄ 运行结果

⛄ 参考文献

[1] 谢开明. 基于GPRS的跌倒检测报警系统的设计与实现[D]. 重庆大学, 2010.

[2] 王竞禹, 张晖, 钟琳灏,等. 一种基于计算机视觉的人体跌倒检测方法:.

[3] 周民刚. 基于计算机视觉的人体跌倒检测算法研究[J].  2013.

[4] 张璐. 基于计算机视觉的人体室内跌倒检测方法研究[D]. 山东理工大学.

⛳️ 完整代码

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料


相关文章
|
6天前
|
算法 调度
基于多目标粒子群算法冷热电联供综合能源系统运行优化(matlab代码)
基于多目标粒子群算法冷热电联供综合能源系统运行优化(matlab代码)
|
6天前
|
流计算
计及多能耦合的区域综合能源系统电气热能流计算(含matlab代码)
计及多能耦合的区域综合能源系统电气热能流计算(含matlab代码)
基于纳什谈判理论的风–光–氢多主体能源系统合作运行方法(含matlab代码)
基于纳什谈判理论的风–光–氢多主体能源系统合作运行方法(含matlab代码)
|
6天前
|
算法 调度
计及需求响应和电能交互的多主体综合能源系统主从博弈优化调度策略(含matlab代码)
计及需求响应和电能交互的多主体综合能源系统主从博弈优化调度策略(含matlab代码)
|
4月前
|
机器学习/深度学习 计算机视觉
AIGC核心技术——计算机视觉(CV)预训练大模型
【1月更文挑战第13天】AIGC核心技术——计算机视觉(CV)预训练大模型
398 3
AIGC核心技术——计算机视觉(CV)预训练大模型
|
5月前
|
机器学习/深度学习 PyTorch 算法框架/工具
Azure 机器学习 - 使用 ONNX 对来自 AutoML 的计算机视觉模型进行预测
Azure 机器学习 - 使用 ONNX 对来自 AutoML 的计算机视觉模型进行预测
69 0
|
4月前
|
机器学习/深度学习 编解码 人工智能
Vision Mamba:将Mamba应用于计算机视觉任务的新模型
Mamba是LLM的一种新架构,与Transformers等传统模型相比,它能够更有效地处理长序列。就像VIT一样现在已经有人将他应用到了计算机视觉领域,让我们来看看最近的这篇论文“Vision Mamba: Efficient Visual Representation Learning with Bidirectional State Space Models,”
280 7
|
2月前
|
机器学习/深度学习 人工智能 计算机视觉
生成式计算机视觉(CV)模型的发展历程及最新进展
在计算机视觉(CV)领域,生成式AI技术的发展经历了多个阶段。在深度学习革命之前,传统的图像生成技术主要依赖于手工制作的特征,如纹理合成和纹理映射等方法。然而,这些方法在生成复杂和生动的图像方面的能力是有限的。
147 2
|
5月前
|
算法 数据库 计算机视觉
【计算机视觉】FCN、Seg-Net、U-Net模型进行图像分割实战(附源码和数据集 超详细必看)
【计算机视觉】FCN、Seg-Net、U-Net模型进行图像分割实战(附源码和数据集 超详细必看)
89 2
|
5月前
|
机器学习/深度学习 存储 JSON
Azure - 机器学习:使用自动化机器学习训练计算机视觉模型的数据架构
Azure - 机器学习:使用自动化机器学习训练计算机视觉模型的数据架构
35 0

热门文章

最新文章