1、demo能力html
OpenVINO提供了范例(human_pose_estimation_demo),可以在CPU上以较快速度识别出多人
-iE:/OpenVINO_modelZoo/head-pose-face-detection-female-and-male.mp4 -mE:/OpenVINO_modelZoo/human-pose-estimation-0001.xml -d CPU安全
基于这篇论文:函数

参考文档:
https://docs.openvinotoolkit.org/latest/_demos_human_pose_estimation_demo_README.html
2、抽取18个点,作简单的越界分析
既然以及可以从视频中抽取人体骨骼,而且对应18个数据点
那么就可以作定量分析。
对于这个视频,使用MarkMan可以测量出关键领域的位置,那么最简单的想法就是首先得到“人的中心”这个点,当这个点位于敏感区域的时候进行报警。
可是这种方法很粗糙,咱们但愿获得的是这个敏感区域里面,没有人体的任何一个位置,所以首先对全部的点进行排序,然后判断
bool SortbyXaxis(
const cv
:
:Point2f
& a,
const cv
:
:Point2f
&b)
{
return a.x
> b.x;
}
//然后对全部的点进行这样处理
HumanPose firstHumanPose
= poses[
0];
std
:
:vector
<cv
:
:Point2f
> firstKeypoints
= firstHumanPose.keypoints;
sort( firstKeypoints .begin(), firstKeypoints .end(), SortbyYaxis );
if (
! (firstKeypoints[
0].x
<
369
|| firstKeypoints[firstKeypoints.size()
-
1].x
>
544))
{
std
:
:stringstream inRanges;
inRanges
<<
"inRanges! ";
cv
:
:putText(image, inRanges.str(), cv
:
:Point(
16,
64),
cv
:
:FONT_HERSHEY_COMPLEX,
1, cv
:
:Scalar(
0,
0,
255));
}
3、更接近实际的状况
前面的状况仍是过于简单,这个视频更接近实际状况
好比地上有这条安全线,倾斜的,就是不能越过,应该如何来处理?
首先仍是量出这条线(固定物镜关系),而且咱们可以绘制出这条线;
下面,首先要作一个简单的数学复习
K = (y1-y2)/(x1-x2),当K1>K2的时候点在左边,而在左边灰色区域的时候,绝对在左边,在右边蓝色区域的时候,绝对在右边。
据此编写函数
bool PointIsLeftLine(cv
:
:Point2f point, cv
:
:Point2f PointLineLeft, cv
:
:Point2f PointLineRight)
{
//边界外直接返回
if (point.x
<
0)
return
false;
if (point.x
<
= PointLineLeft.x)
return
true;
if (point.x
> PointLineRight.x)
return
false;
//在边界内的状况,经过计算斜率
if (PointLineRight.x
== PointLineLeft.x)
assert(
"error PointLineRight.x == PointLineLeft.x");
float kLine
= (PointLineRight.y
- PointLineLeft.y)
/ (PointLineRight.x
- PointLineLeft.x);
float k
= (point.y
- PointLineLeft.y)
/ (point.x
- PointLineLeft.x);
return (k
>
= kLine);
}
而且分别对两个脚进行处理
bRight
= PointIsLeftLine(pointRightFoot, cv
:
:Point2f(
1017,
513), cv
:
:Point2f(
433, image.rows
-
1));
bLeft
= PointIsLeftLine(pointLeftFoot, cv
:
:Point2f(
1017,
513), cv
:
:Point2f(
433, image.rows
-
1));
加上一些图像绘制
if (bRight
|| bLeft)
{
line(image, cv
:
:Point(
1017,
513), cv
:
:Point(
433, image.rows
-
1), cv
:
:Scalar(
0,
0,
255),
8);
}
else
{
line(image, cv
:
:Point(
1017,
513), cv
:
:Point(
433, image.rows
-
1), cv
:
:Scalar(
0,
255,
0),
8);
}
可以获得这样的结果:
4、存在的问题
作到这一步,看起来问题获得了很好的解决,可是实际上仍是出现了新的问题:
一、速度。目前只能作到8-9FPS,如何提升速度是不卡视频输入是新问题;
二、多人的识别;
三、区域的划定;
四、界面操做。
这些问题都解决好,应该可以商用,最主要的是速度问题。
感谢阅读至此,但愿有所帮助。