Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sq975
openpose
提交
9a47921c
O
openpose
项目概览
sq975
/
openpose
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
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,发现更多精彩内容 >>
提交
9a47921c
编写于
5月 10, 2018
作者:
G
gineshidalgo99
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PoseExtractor for 3D
上级
b162274d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
61 addition
and
35 deletion
+61
-35
include/openpose/experimental/tracking/personTracker.hpp
include/openpose/experimental/tracking/personTracker.hpp
+2
-0
include/openpose/pose/poseExtractor.hpp
include/openpose/pose/poseExtractor.hpp
+2
-2
include/openpose/wrapper/wrapper.hpp
include/openpose/wrapper/wrapper.hpp
+3
-3
src/openpose/experimental/tracking/personTracker.cpp
src/openpose/experimental/tracking/personTracker.cpp
+13
-0
src/openpose/gui/guiInfoAdder.cpp
src/openpose/gui/guiInfoAdder.cpp
+28
-25
src/openpose/pose/poseExtractor.cpp
src/openpose/pose/poseExtractor.cpp
+13
-5
未找到文件。
include/openpose/experimental/tracking/personTracker.hpp
浏览文件 @
9a47921c
...
...
@@ -20,6 +20,8 @@ namespace op
void
trackLockThread
(
Array
<
float
>&
poseKeypoints
,
const
cv
::
Mat
&
cvMatInput
,
const
Array
<
long
long
>&
poseIds
,
const
long
long
frameId
);
bool
getMergeResults
()
const
;
private:
const
bool
mMergeResults
;
...
...
include/openpose/pose/poseExtractor.hpp
浏览文件 @
9a47921c
...
...
@@ -17,7 +17,7 @@ namespace op
PoseExtractor
(
const
std
::
shared_ptr
<
PoseExtractorNet
>&
poseExtractorNet
,
const
std
::
shared_ptr
<
KeepTopNPeople
>&
keepTopNPeople
=
nullptr
,
const
std
::
shared_ptr
<
PersonIdExtractor
>&
personIdExtractor
=
nullptr
,
const
std
::
vector
<
std
::
shared_ptr
<
PersonTracker
>>&
personTracker
=
{},
const
std
::
shared_ptr
<
std
::
vector
<
std
::
shared_ptr
<
PersonTracker
>
>>&
personTracker
=
{},
const
int
numberPeopleMax
=
-
1
,
const
int
tracking
=
-
1
);
virtual
~
PoseExtractor
();
...
...
@@ -67,7 +67,7 @@ namespace op
const
std
::
shared_ptr
<
PoseExtractorNet
>
spPoseExtractorNet
;
const
std
::
shared_ptr
<
KeepTopNPeople
>
spKeepTopNPeople
;
const
std
::
shared_ptr
<
PersonIdExtractor
>
spPersonIdExtractor
;
const
std
::
vector
<
std
::
shared_ptr
<
PersonTracker
>>
spPersonTrackers
;
const
std
::
shared_ptr
<
std
::
vector
<
std
::
shared_ptr
<
PersonTracker
>
>>
spPersonTrackers
;
DELETE_COPY
(
PoseExtractor
);
};
...
...
include/openpose/wrapper/wrapper.hpp
浏览文件 @
9a47921c
...
...
@@ -616,10 +616,10 @@ namespace op
std
::
make_shared
<
KeepTopNPeople
>
(
wrapperStructPose
.
numberPeopleMax
)
:
nullptr
);
// Person tracker
std
::
vector
<
std
::
shared_ptr
<
PersonTracker
>>
personTrackers
;
auto
personTrackers
=
std
::
make_shared
<
std
::
vector
<
std
::
shared_ptr
<
PersonTracker
>>>
()
;
if
(
wrapperStructPose
.
tracking
>
-
1
)
personTrackers
.
resize
(
spWPoseExtractors
.
size
(),
std
::
make_shared
<
PersonTracker
>
(
wrapperStructPose
.
tracking
==
0
));
personTrackers
->
emplace_back
(
std
::
make_shared
<
PersonTracker
>
(
wrapperStructPose
.
tracking
==
0
));
for
(
auto
i
=
0u
;
i
<
spWPoseExtractors
.
size
();
i
++
)
{
// OpenPose keypoint detector + keepTopNPeople
...
...
src/openpose/experimental/tracking/personTracker.cpp
浏览文件 @
9a47921c
...
...
@@ -58,4 +58,17 @@ namespace op
error
(
e
.
what
(),
__LINE__
,
__FUNCTION__
,
__FILE__
);
}
}
bool
PersonTracker
::
getMergeResults
()
const
{
try
{
return
mMergeResults
;
}
catch
(
const
std
::
exception
&
e
)
{
error
(
e
.
what
(),
__LINE__
,
__FUNCTION__
,
__FILE__
);
return
false
;
}
}
}
src/openpose/gui/guiInfoAdder.cpp
浏览文件 @
9a47921c
...
...
@@ -60,36 +60,39 @@ namespace op
if
(
!
poseIds
.
empty
())
{
const
auto
poseKeypointsArea
=
poseKeypoints
.
getSize
(
1
)
*
poseKeypoints
.
getSize
(
2
);
const
auto
isVisible
=
0.05
f
;
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
)
if
(
poseIds
[
i
]
>
-
1
)
{
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
indexMain
=
i
*
poseKeypointsArea
;
const
auto
indexSecondary
=
i
*
poseKeypointsArea
+
poseKeypoints
.
getSize
(
2
);
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
;
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
);
}
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
);
}
}
}
...
...
src/openpose/pose/poseExtractor.cpp
浏览文件 @
9a47921c
...
...
@@ -8,7 +8,7 @@ namespace op
PoseExtractor
::
PoseExtractor
(
const
std
::
shared_ptr
<
PoseExtractorNet
>&
poseExtractorNet
,
const
std
::
shared_ptr
<
KeepTopNPeople
>&
keepTopNPeople
,
const
std
::
shared_ptr
<
PersonIdExtractor
>&
personIdExtractor
,
const
std
::
vector
<
std
::
shared_ptr
<
PersonTracker
>>&
personTrackers
,
const
std
::
shared_ptr
<
std
::
vector
<
std
::
shared_ptr
<
PersonTracker
>
>>&
personTrackers
,
const
int
numberPeopleMax
,
const
int
tracking
)
:
mNumberPeopleMax
{
numberPeopleMax
},
mTracking
{
tracking
},
...
...
@@ -174,13 +174,17 @@ namespace op
{
try
{
if
(
!
spPersonTrackers
.
empty
()
&&
spPersonTrackers
.
at
(
imageViewIndex
))
if
(
!
spPersonTrackers
->
empty
(
))
{
// Resize if required
while
(
spPersonTrackers
->
size
()
<=
imageViewIndex
)
spPersonTrackers
->
emplace_back
(
std
::
make_shared
<
PersonTracker
>
(
(
*
spPersonTrackers
)[
0
]
->
getMergeResults
()));
// Security check
if
(
!
poseKeypoints
.
empty
()
&&
poseIds
.
empty
()
&&
mNumberPeopleMax
!=
1
)
error
(
errorMessage
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
// Run person ID extractor
spPersonTrackers
[
imageViewIndex
]
->
track
(
(
*
spPersonTrackers
)
[
imageViewIndex
]
->
track
(
poseKeypoints
,
cvMatInput
,
(
poseIds
.
empty
()
?
Array
<
long
long
>
{
1
,
0
}
:
poseIds
));
}
}
...
...
@@ -196,13 +200,17 @@ namespace op
{
try
{
if
(
!
spPersonTrackers
.
empty
()
&&
spPersonTrackers
.
at
(
imageViewIndex
))
if
(
!
spPersonTrackers
->
empty
(
))
{
// Resize if required
while
(
spPersonTrackers
->
size
()
<=
imageViewIndex
)
spPersonTrackers
->
emplace_back
(
std
::
make_shared
<
PersonTracker
>
(
(
*
spPersonTrackers
)[
0
]
->
getMergeResults
()));
// Security check
if
(
!
poseKeypoints
.
empty
()
&&
poseIds
.
empty
()
&&
mNumberPeopleMax
!=
1
)
error
(
errorMessage
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
// Run person ID extractor
spPersonTrackers
[
imageViewIndex
]
->
trackLockThread
(
(
*
spPersonTrackers
)
[
imageViewIndex
]
->
trackLockThread
(
poseKeypoints
,
cvMatInput
,
(
poseIds
.
empty
()
?
Array
<
long
long
>
{
1
,
0
}
:
poseIds
),
frameId
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录