Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
活在明天
openpose
提交
78531bd8
O
openpose
项目概览
活在明天
/
openpose
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openpose
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
78531bd8
编写于
4月 29, 2018
作者:
G
gineshidalgo99
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Display of id
上级
5e22e43f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
66 addition
and
11 deletion
+66
-11
include/openpose/gui/guiInfoAdder.hpp
include/openpose/gui/guiInfoAdder.hpp
+3
-1
include/openpose/gui/wGuiInfoAdder.hpp
include/openpose/gui/wGuiInfoAdder.hpp
+2
-1
src/openpose/gui/guiInfoAdder.cpp
src/openpose/gui/guiInfoAdder.cpp
+59
-7
ubuntu/Makefile.example
ubuntu/Makefile.example
+2
-2
未找到文件。
include/openpose/gui/guiInfoAdder.hpp
浏览文件 @
78531bd8
...
...
@@ -13,7 +13,9 @@ namespace op
GuiInfoAdder
(
const
int
numberGpus
,
const
bool
guiEnabled
=
false
);
void
addInfo
(
cv
::
Mat
&
cvOutputData
,
const
int
numberPeople
,
const
unsigned
long
long
id
,
const
std
::
string
&
elementRenderedName
,
const
unsigned
long
long
frameNumber
);
const
std
::
string
&
elementRenderedName
,
const
unsigned
long
long
frameNumber
,
const
Array
<
long
long
>&
poseIds
=
Array
<
long
long
>
{},
const
Array
<
float
>&
poseKeypoints
=
Array
<
float
>
{});
private:
// Const variables
...
...
include/openpose/gui/wGuiInfoAdder.hpp
浏览文件 @
78531bd8
...
...
@@ -58,7 +58,8 @@ namespace op
for
(
auto
&
tDatum
:
*
tDatums
)
spGuiInfoAdder
->
addInfo
(
tDatum
.
cvOutputData
,
std
::
max
(
tDatum
.
poseKeypoints
.
getSize
(
0
),
tDatum
.
faceKeypoints
.
getSize
(
0
)),
tDatum
.
id
,
tDatum
.
elementRendered
.
second
,
tDatum
.
frameNumber
);
tDatum
.
id
,
tDatum
.
elementRendered
.
second
,
tDatum
.
frameNumber
,
tDatum
.
poseIds
,
tDatum
.
poseKeypoints
);
// Profiling speed
Profiler
::
timerEnd
(
profilerKey
);
Profiler
::
printAveragedTimeMsOnIterationX
(
profilerKey
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
...
...
src/openpose/gui/guiInfoAdder.cpp
浏览文件 @
78531bd8
...
...
@@ -7,6 +7,9 @@
namespace
op
{
// Used colors
const
cv
::
Scalar
WHITE_SCALAR
{
255
,
255
,
255
};
void
updateFps
(
unsigned
long
long
&
lastId
,
double
&
fps
,
unsigned
int
&
fpsCounter
,
std
::
queue
<
std
::
chrono
::
high_resolution_clock
::
time_point
>&
fpsQueue
,
const
unsigned
long
long
id
,
const
int
numberGpus
)
...
...
@@ -49,6 +52,54 @@ namespace op
}
}
void
addPeopleIds
(
cv
::
Mat
&
cvOutputData
,
const
Array
<
long
long
>&
poseIds
,
const
Array
<
float
>&
poseKeypoints
,
const
int
borderMargin
)
{
try
{
if
(
!
poseIds
.
empty
())
{
const
auto
poseKeypointsArea
=
poseKeypoints
.
getSize
(
1
)
*
poseKeypoints
.
getSize
(
2
);
for
(
auto
i
=
0u
;
i
<
poseIds
.
getVolume
()
;
i
++
)
{
const
auto
indexMain
=
i
*
poseKeypointsArea
;
const
auto
indexSecondary
=
i
*
poseKeypointsArea
+
poseKeypoints
.
getSize
(
2
);
const
auto
isVisible
=
0.05
f
;
if
(
poseKeypoints
[
indexMain
+
2
]
>
isVisible
||
poseKeypoints
[
indexSecondary
+
2
]
>
isVisible
)
{
const
auto
xA
=
intRound
(
poseKeypoints
[
indexMain
]);
const
auto
yA
=
intRound
(
poseKeypoints
[
indexMain
+
1
]);
const
auto
xB
=
intRound
(
poseKeypoints
[
indexSecondary
]);
const
auto
yB
=
intRound
(
poseKeypoints
[
indexSecondary
+
1
]);
int
x
;
int
y
;
if
(
poseKeypoints
[
indexMain
+
2
]
>
isVisible
&&
poseKeypoints
[
indexSecondary
+
2
]
>
isVisible
)
{
const
auto
keypointRatio
=
intRound
(
0.15
f
*
std
::
sqrt
((
xA
-
xB
)
*
(
xA
-
xB
)
+
(
yA
-
yB
)
*
(
yA
-
yB
)));
x
=
xA
+
3
*
keypointRatio
;
y
=
yA
-
3
*
keypointRatio
;
}
else
if
(
poseKeypoints
[
indexMain
+
2
]
>
isVisible
)
{
x
=
xA
+
intRound
(
0.25
f
*
borderMargin
);
y
=
yA
-
intRound
(
0.25
f
*
borderMargin
);
}
else
//if (poseKeypoints[indexSecondary+2] > isVisible)
{
x
=
xB
+
intRound
(
0.25
f
*
borderMargin
);
y
=
yB
-
intRound
(
0.5
f
*
borderMargin
);
}
putTextOnCvMat
(
cvOutputData
,
std
::
to_string
(
poseIds
[
i
]),
{
x
,
y
},
WHITE_SCALAR
,
false
,
cvOutputData
.
cols
);
}
}
}
}
catch
(
const
std
::
exception
&
e
)
{
error
(
e
.
what
(),
__LINE__
,
__FUNCTION__
,
__FILE__
);
}
}
GuiInfoAdder
::
GuiInfoAdder
(
const
int
numberGpus
,
const
bool
guiEnabled
)
:
mNumberGpus
{
numberGpus
},
mGuiEnabled
{
guiEnabled
},
...
...
@@ -59,7 +110,8 @@ namespace op
}
void
GuiInfoAdder
::
addInfo
(
cv
::
Mat
&
cvOutputData
,
const
int
numberPeople
,
const
unsigned
long
long
id
,
const
std
::
string
&
elementRenderedName
,
const
unsigned
long
long
frameNumber
)
const
std
::
string
&
elementRenderedName
,
const
unsigned
long
long
frameNumber
,
const
Array
<
long
long
>&
poseIds
,
const
Array
<
float
>&
poseKeypoints
)
{
try
{
...
...
@@ -70,15 +122,13 @@ namespace op
const
auto
borderMargin
=
intRound
(
fastMax
(
cvOutputData
.
cols
,
cvOutputData
.
rows
)
*
0.025
);
// Update fps
updateFps
(
mLastId
,
mFps
,
mFpsCounter
,
mFpsQueue
,
id
,
mNumberGpus
);
// Used colors
const
cv
::
Scalar
white
{
255
,
255
,
255
};
// Fps or s/gpu
char
charArrayAux
[
15
];
std
::
snprintf
(
charArrayAux
,
15
,
"%4.1f fps"
,
mFps
);
// Recording inverse: sec/gpu
// std::snprintf(charArrayAux, 15, "%4.2f s/gpu", (mFps != 0. ? mNumberGpus/mFps : 0.));
putTextOnCvMat
(
cvOutputData
,
charArrayAux
,
{
intRound
(
cvOutputData
.
cols
-
borderMargin
),
borderMargin
},
white
,
true
,
cvOutputData
.
cols
);
WHITE_SCALAR
,
true
,
cvOutputData
.
cols
);
// Part to show
// Allowing some buffer when changing the part to show (if >= 2 GPUs)
// I.e. one GPU might return a previous part after the other GPU returns the new desired part, it looks
...
...
@@ -92,18 +142,20 @@ namespace op
}
mLastElementRenderedCounter
=
fastMin
(
mLastElementRenderedCounter
,
std
::
numeric_limits
<
int
>::
max
()
-
5
);
mLastElementRenderedCounter
++
;
// Add each person ID
addPeopleIds
(
cvOutputData
,
poseIds
,
poseKeypoints
,
borderMargin
);
// OpenPose name as well as help or part to show
putTextOnCvMat
(
cvOutputData
,
"OpenPose - "
+
(
!
mLastElementRenderedName
.
empty
()
?
mLastElementRenderedName
:
(
mGuiEnabled
?
"'h' for help"
:
""
)),
{
borderMargin
,
borderMargin
},
white
,
false
,
cvOutputData
.
cols
);
{
borderMargin
,
borderMargin
},
WHITE_SCALAR
,
false
,
cvOutputData
.
cols
);
// Frame number
putTextOnCvMat
(
cvOutputData
,
"Frame: "
+
std
::
to_string
(
frameNumber
),
{
borderMargin
,
(
int
)(
cvOutputData
.
rows
-
borderMargin
)},
white
,
false
,
cvOutputData
.
cols
);
{
borderMargin
,
(
int
)(
cvOutputData
.
rows
-
borderMargin
)},
WHITE_SCALAR
,
false
,
cvOutputData
.
cols
);
// Number people
putTextOnCvMat
(
cvOutputData
,
"People: "
+
std
::
to_string
(
numberPeople
),
{(
int
)(
cvOutputData
.
cols
-
borderMargin
),
(
int
)(
cvOutputData
.
rows
-
borderMargin
)},
white
,
true
,
cvOutputData
.
cols
);
WHITE_SCALAR
,
true
,
cvOutputData
.
cols
);
}
catch
(
const
std
::
exception
&
e
)
{
...
...
ubuntu/Makefile.example
浏览文件 @
78531bd8
...
...
@@ -189,9 +189,9 @@ ifeq ($(USE_OPENCV), 1)
LIBRARIES
+=
opencv_core opencv_highgui opencv_imgproc opencv_objdetect
ifeq
($(OPENCV_VERSION), 3)
LIBRARIES
+=
opencv_imgcodecs opencv_videoio
LIBRARIES
+=
opencv_imgcodecs opencv_videoio
opencv_cudawarping
else
LIBRARIES
+=
opencv_contrib
LIBRARIES
+=
opencv_contrib
opencv_gpu
endif
endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录