Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sq975
openpose
提交
29ea7e24
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,发现更多精彩内容 >>
提交
29ea7e24
编写于
4月 01, 2018
作者:
G
gineshidalgo99
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Face/hand working with any output resolution
上级
a2032494
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
28 addition
and
33 deletion
+28
-33
doc/release_notes.md
doc/release_notes.md
+2
-0
include/openpose/face/faceDetector.hpp
include/openpose/face/faceDetector.hpp
+1
-1
include/openpose/face/wFaceDetector.hpp
include/openpose/face/wFaceDetector.hpp
+1
-1
include/openpose/hand/handDetector.hpp
include/openpose/hand/handDetector.hpp
+2
-2
include/openpose/hand/wHandDetector.hpp
include/openpose/hand/wHandDetector.hpp
+1
-1
include/openpose/hand/wHandDetectorTracking.hpp
include/openpose/hand/wHandDetectorTracking.hpp
+1
-1
src/openpose/face/faceDetector.cpp
src/openpose/face/faceDetector.cpp
+14
-7
src/openpose/hand/handDetector.cpp
src/openpose/hand/handDetector.cpp
+3
-5
src/openpose/producer/spinnakerWrapper.cpp
src/openpose/producer/spinnakerWrapper.cpp
+3
-15
未找到文件。
doc/release_notes.md
浏览文件 @
29ea7e24
...
@@ -215,7 +215,9 @@ OpenPose Library - Release Notes
...
@@ -215,7 +215,9 @@ OpenPose Library - Release Notes
1.
Main improvements:
1.
Main improvements:
1.
Flir cameras: Added software trigger and a dedicated thread to keep reading images to remove latency (analogously to webcamReader).
1.
Flir cameras: Added software trigger and a dedicated thread to keep reading images to remove latency (analogously to webcamReader).
2.
Functions or parameters renamed:
2.
Functions or parameters renamed:
1.
Removed scale parameter from hand and face rectangle extractor (causing wrong results if custom
`--output_resolution`
).
3.
Main bugs fixed:
3.
Main bugs fixed:
1.
Hand and face work properly again with any
`--output_resolution`
.
...
...
include/openpose/face/faceDetector.hpp
浏览文件 @
29ea7e24
...
@@ -11,7 +11,7 @@ namespace op
...
@@ -11,7 +11,7 @@ namespace op
public:
public:
explicit
FaceDetector
(
const
PoseModel
poseModel
);
explicit
FaceDetector
(
const
PoseModel
poseModel
);
std
::
vector
<
Rectangle
<
float
>>
detectFaces
(
const
Array
<
float
>&
poseKeypoints
,
const
double
scaleInputToOutput
)
const
;
std
::
vector
<
Rectangle
<
float
>>
detectFaces
(
const
Array
<
float
>&
poseKeypoints
)
const
;
private:
private:
const
unsigned
int
mNeck
;
const
unsigned
int
mNeck
;
...
...
include/openpose/face/wFaceDetector.hpp
浏览文件 @
29ea7e24
...
@@ -56,7 +56,7 @@ namespace op
...
@@ -56,7 +56,7 @@ namespace op
const
auto
profilerKey
=
Profiler
::
timerInit
(
__LINE__
,
__FUNCTION__
,
__FILE__
);
const
auto
profilerKey
=
Profiler
::
timerInit
(
__LINE__
,
__FUNCTION__
,
__FILE__
);
// Detect people face
// Detect people face
for
(
auto
&
tDatum
:
*
tDatums
)
for
(
auto
&
tDatum
:
*
tDatums
)
tDatum
.
faceRectangles
=
spFaceDetector
->
detectFaces
(
tDatum
.
poseKeypoints
,
tDatum
.
scaleInputToOutput
);
tDatum
.
faceRectangles
=
spFaceDetector
->
detectFaces
(
tDatum
.
poseKeypoints
);
// Profiling speed
// Profiling speed
Profiler
::
timerEnd
(
profilerKey
);
Profiler
::
timerEnd
(
profilerKey
);
Profiler
::
printAveragedTimeMsOnIterationX
(
profilerKey
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
Profiler
::
printAveragedTimeMsOnIterationX
(
profilerKey
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
...
...
include/openpose/hand/handDetector.hpp
浏览文件 @
29ea7e24
...
@@ -14,9 +14,9 @@ namespace op
...
@@ -14,9 +14,9 @@ namespace op
public:
public:
explicit
HandDetector
(
const
PoseModel
poseModel
);
explicit
HandDetector
(
const
PoseModel
poseModel
);
std
::
vector
<
std
::
array
<
Rectangle
<
float
>
,
2
>>
detectHands
(
const
Array
<
float
>&
poseKeypoints
,
const
double
scaleInputToOutput
)
const
;
std
::
vector
<
std
::
array
<
Rectangle
<
float
>
,
2
>>
detectHands
(
const
Array
<
float
>&
poseKeypoints
)
const
;
std
::
vector
<
std
::
array
<
Rectangle
<
float
>
,
2
>>
trackHands
(
const
Array
<
float
>&
poseKeypoints
,
const
double
scaleInputToOutput
);
std
::
vector
<
std
::
array
<
Rectangle
<
float
>
,
2
>>
trackHands
(
const
Array
<
float
>&
poseKeypoints
);
void
updateTracker
(
const
std
::
array
<
Array
<
float
>
,
2
>&
handKeypoints
,
const
unsigned
long
long
id
);
void
updateTracker
(
const
std
::
array
<
Array
<
float
>
,
2
>&
handKeypoints
,
const
unsigned
long
long
id
);
...
...
include/openpose/hand/wHandDetector.hpp
浏览文件 @
29ea7e24
...
@@ -56,7 +56,7 @@ namespace op
...
@@ -56,7 +56,7 @@ namespace op
const
auto
profilerKey
=
Profiler
::
timerInit
(
__LINE__
,
__FUNCTION__
,
__FILE__
);
const
auto
profilerKey
=
Profiler
::
timerInit
(
__LINE__
,
__FUNCTION__
,
__FILE__
);
// Detect people hand
// Detect people hand
for
(
auto
&
tDatum
:
*
tDatums
)
for
(
auto
&
tDatum
:
*
tDatums
)
tDatum
.
handRectangles
=
spHandDetector
->
detectHands
(
tDatum
.
poseKeypoints
,
tDatum
.
scaleInputToOutput
);
tDatum
.
handRectangles
=
spHandDetector
->
detectHands
(
tDatum
.
poseKeypoints
);
// Profiling speed
// Profiling speed
Profiler
::
timerEnd
(
profilerKey
);
Profiler
::
timerEnd
(
profilerKey
);
Profiler
::
printAveragedTimeMsOnIterationX
(
profilerKey
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
Profiler
::
printAveragedTimeMsOnIterationX
(
profilerKey
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
...
...
include/openpose/hand/wHandDetectorTracking.hpp
浏览文件 @
29ea7e24
...
@@ -56,7 +56,7 @@ namespace op
...
@@ -56,7 +56,7 @@ namespace op
const
auto
profilerKey
=
Profiler
::
timerInit
(
__LINE__
,
__FUNCTION__
,
__FILE__
);
const
auto
profilerKey
=
Profiler
::
timerInit
(
__LINE__
,
__FUNCTION__
,
__FILE__
);
// Detect people hand
// Detect people hand
for
(
auto
&
tDatum
:
*
tDatums
)
for
(
auto
&
tDatum
:
*
tDatums
)
tDatum
.
handRectangles
=
spHandDetector
->
trackHands
(
tDatum
.
poseKeypoints
,
tDatum
.
scaleInputToOutput
);
tDatum
.
handRectangles
=
spHandDetector
->
trackHands
(
tDatum
.
poseKeypoints
);
// Profiling speed
// Profiling speed
Profiler
::
timerEnd
(
profilerKey
);
Profiler
::
timerEnd
(
profilerKey
);
Profiler
::
printAveragedTimeMsOnIterationX
(
profilerKey
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
Profiler
::
printAveragedTimeMsOnIterationX
(
profilerKey
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
...
...
src/openpose/face/faceDetector.cpp
浏览文件 @
29ea7e24
...
@@ -15,9 +15,11 @@ namespace op
...
@@ -15,9 +15,11 @@ namespace op
{
{
}
}
inline
Rectangle
<
float
>
getFaceFromPoseKeypoints
(
const
Array
<
float
>&
poseKeypoints
,
const
unsigned
int
personIndex
,
const
unsigned
int
neck
,
inline
Rectangle
<
float
>
getFaceFromPoseKeypoints
(
const
Array
<
float
>&
poseKeypoints
,
const
unsigned
int
personIndex
,
const
unsigned
int
headNose
,
const
unsigned
int
lEar
,
const
unsigned
int
rEar
,
const
unsigned
int
neck
,
const
unsigned
int
headNose
,
const
unsigned
int
lEye
,
const
unsigned
int
rEye
,
const
float
threshold
)
const
unsigned
int
lEar
,
const
unsigned
int
rEar
,
const
unsigned
int
lEye
,
const
unsigned
int
rEye
,
const
float
threshold
)
{
{
try
try
{
{
...
@@ -58,13 +60,17 @@ namespace op
...
@@ -58,13 +60,17 @@ namespace op
{
{
pointTopLeft
.
x
+=
(
posePtr
[
lEye
*
3
]
+
posePtr
[
lEar
*
3
]
+
posePtr
[
headNose
*
3
])
/
3.
f
;
pointTopLeft
.
x
+=
(
posePtr
[
lEye
*
3
]
+
posePtr
[
lEar
*
3
]
+
posePtr
[
headNose
*
3
])
/
3.
f
;
pointTopLeft
.
y
+=
(
posePtr
[
lEye
*
3
+
1
]
+
posePtr
[
lEar
*
3
+
1
]
+
posePtr
[
headNose
*
3
+
1
])
/
3.
f
;
pointTopLeft
.
y
+=
(
posePtr
[
lEye
*
3
+
1
]
+
posePtr
[
lEar
*
3
+
1
]
+
posePtr
[
headNose
*
3
+
1
])
/
3.
f
;
faceSize
+=
0.85
f
*
(
getDistance
(
poseKeypoints
,
personIndex
,
headNose
,
lEye
)
+
getDistance
(
poseKeypoints
,
personIndex
,
headNose
,
lEar
)
+
getDistance
(
poseKeypoints
,
personIndex
,
neck
,
headNose
));
faceSize
+=
0.85
f
*
(
getDistance
(
poseKeypoints
,
personIndex
,
headNose
,
lEye
)
+
getDistance
(
poseKeypoints
,
personIndex
,
headNose
,
lEar
)
+
getDistance
(
poseKeypoints
,
personIndex
,
neck
,
headNose
));
}
}
else
// if(lEyeScoreAbove)
else
// if(lEyeScoreAbove)
{
{
pointTopLeft
.
x
+=
(
posePtr
[
rEye
*
3
]
+
posePtr
[
rEar
*
3
]
+
posePtr
[
headNose
*
3
])
/
3.
f
;
pointTopLeft
.
x
+=
(
posePtr
[
rEye
*
3
]
+
posePtr
[
rEar
*
3
]
+
posePtr
[
headNose
*
3
])
/
3.
f
;
pointTopLeft
.
y
+=
(
posePtr
[
rEye
*
3
+
1
]
+
posePtr
[
rEar
*
3
+
1
]
+
posePtr
[
headNose
*
3
+
1
])
/
3.
f
;
pointTopLeft
.
y
+=
(
posePtr
[
rEye
*
3
+
1
]
+
posePtr
[
rEar
*
3
+
1
]
+
posePtr
[
headNose
*
3
+
1
])
/
3.
f
;
faceSize
+=
0.85
f
*
(
getDistance
(
poseKeypoints
,
personIndex
,
headNose
,
rEye
)
+
getDistance
(
poseKeypoints
,
personIndex
,
headNose
,
rEar
)
+
getDistance
(
poseKeypoints
,
personIndex
,
neck
,
headNose
));
faceSize
+=
0.85
f
*
(
getDistance
(
poseKeypoints
,
personIndex
,
headNose
,
rEye
)
+
getDistance
(
poseKeypoints
,
personIndex
,
headNose
,
rEar
)
+
getDistance
(
poseKeypoints
,
personIndex
,
neck
,
headNose
));
}
}
}
}
// else --> 2 * dist(neck, headNose)
// else --> 2 * dist(neck, headNose)
...
@@ -108,7 +114,7 @@ namespace op
...
@@ -108,7 +114,7 @@ namespace op
}
}
}
}
std
::
vector
<
Rectangle
<
float
>>
FaceDetector
::
detectFaces
(
const
Array
<
float
>&
poseKeypoints
,
const
double
scaleInputToOutput
)
const
std
::
vector
<
Rectangle
<
float
>>
FaceDetector
::
detectFaces
(
const
Array
<
float
>&
poseKeypoints
)
const
{
{
try
try
{
{
...
@@ -119,7 +125,8 @@ namespace op
...
@@ -119,7 +125,8 @@ namespace op
// Otherwise, get face position(s)
// Otherwise, get face position(s)
if
(
!
poseKeypoints
.
empty
())
if
(
!
poseKeypoints
.
empty
())
for
(
auto
person
=
0
;
person
<
numberPeople
;
person
++
)
for
(
auto
person
=
0
;
person
<
numberPeople
;
person
++
)
faceRectangles
.
at
(
person
)
=
getFaceFromPoseKeypoints
(
poseKeypoints
,
person
,
mNeck
,
mNose
,
mLEar
,
mREar
,
mLEye
,
mREye
,
threshold
)
/
(
float
)
scaleInputToOutput
;
faceRectangles
.
at
(
person
)
=
getFaceFromPoseKeypoints
(
poseKeypoints
,
person
,
mNeck
,
mNose
,
mLEar
,
mREar
,
mLEye
,
mREye
,
threshold
);
return
faceRectangles
;
return
faceRectangles
;
}
}
catch
(
const
std
::
exception
&
e
)
catch
(
const
std
::
exception
&
e
)
...
...
src/openpose/hand/handDetector.cpp
浏览文件 @
29ea7e24
...
@@ -130,7 +130,7 @@ namespace op
...
@@ -130,7 +130,7 @@ namespace op
{
{
}
}
std
::
vector
<
std
::
array
<
Rectangle
<
float
>
,
2
>>
HandDetector
::
detectHands
(
const
Array
<
float
>&
poseKeypoints
,
const
double
scaleInputToOutput
)
const
std
::
vector
<
std
::
array
<
Rectangle
<
float
>
,
2
>>
HandDetector
::
detectHands
(
const
Array
<
float
>&
poseKeypoints
)
const
{
{
try
try
{
{
...
@@ -148,8 +148,6 @@ namespace op
...
@@ -148,8 +148,6 @@ namespace op
mPoseIndexes
[(
int
)
PosePart
::
LShoulder
],
mPoseIndexes
[(
int
)
PosePart
::
RWrist
],
mPoseIndexes
[(
int
)
PosePart
::
LShoulder
],
mPoseIndexes
[(
int
)
PosePart
::
RWrist
],
mPoseIndexes
[(
int
)
PosePart
::
RElbow
],
mPoseIndexes
[(
int
)
PosePart
::
RShoulder
],
threshold
mPoseIndexes
[(
int
)
PosePart
::
RElbow
],
mPoseIndexes
[(
int
)
PosePart
::
RShoulder
],
threshold
);
);
handRectangles
.
at
(
person
).
at
(
0
)
/=
(
float
)
scaleInputToOutput
;
handRectangles
.
at
(
person
).
at
(
1
)
/=
(
float
)
scaleInputToOutput
;
}
}
}
}
return
handRectangles
;
return
handRectangles
;
...
@@ -161,13 +159,13 @@ namespace op
...
@@ -161,13 +159,13 @@ namespace op
}
}
}
}
std
::
vector
<
std
::
array
<
Rectangle
<
float
>
,
2
>>
HandDetector
::
trackHands
(
const
Array
<
float
>&
poseKeypoints
,
const
double
scaleInputToOutput
)
std
::
vector
<
std
::
array
<
Rectangle
<
float
>
,
2
>>
HandDetector
::
trackHands
(
const
Array
<
float
>&
poseKeypoints
)
{
{
try
try
{
{
std
::
lock_guard
<
std
::
mutex
>
lock
{
mMutex
};
std
::
lock_guard
<
std
::
mutex
>
lock
{
mMutex
};
// Baseline detectHands
// Baseline detectHands
auto
handRectangles
=
detectHands
(
poseKeypoints
,
scaleInputToOutput
);
auto
handRectangles
=
detectHands
(
poseKeypoints
);
// If previous hands saved
// If previous hands saved
for
(
auto
&
handRectangle
:
handRectangles
)
for
(
auto
&
handRectangle
:
handRectangles
)
{
{
...
...
src/openpose/producer/spinnakerWrapper.cpp
浏览文件 @
29ea7e24
...
@@ -354,8 +354,10 @@ namespace op
...
@@ -354,8 +354,10 @@ namespace op
}
}
if
(
imagesExtracted
)
if
(
imagesExtracted
)
{
{
const
std
::
lock_guard
<
std
::
mutex
>
lock
{
mBufferMutex
};
std
::
unique_lock
<
std
::
mutex
>
lock
{
mBufferMutex
};
std
::
swap
(
mBuffer
,
imagePtrs
);
std
::
swap
(
mBuffer
,
imagePtrs
);
lock
.
unlock
();
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
microseconds
{
1
});
}
}
}
}
}
}
...
@@ -408,23 +410,9 @@ namespace op
...
@@ -408,23 +410,9 @@ namespace op
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
microseconds
{
5
});
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
microseconds
{
5
});
}
}
}
}
// Commented code was supposed to clean buffer, but `NewestFirstOverwrite` does that
// Getting frames
// Getting frames
// Retrieve next received image and ensure image completion
// Retrieve next received image and ensure image completion
// Spinnaker::ImagePtr imagePtr = cameraPtrs.at(i)->GetNextImage();
// Spinnaker::ImagePtr imagePtr = cameraPtrs.at(i)->GetNextImage();
// Clean buffer + retrieve next received image + ensure image completion
// auto durationMs = 0.;
// // for (auto counter = 0 ; counter < 10 ; counter++)
// while (durationMs < 1.)
// {
// const auto begin = std::chrono::high_resolution_clock::now();
// for (auto i = 0u; i < cameraPtrs.size(); i++)
// imagePtrs.at(i) = cameraPtrs.at(i)->GetNextImage();
// durationMs = std::chrono::duration_cast<std::chrono::nanoseconds>(
// std::chrono::high_resolution_clock::now()-begin
// ).count() * 1e-6;
// // log("Time extraction (ms): " + std::to_string(durationMs), Priority::High);
// }
// All images completed
// All images completed
bool
imagesExtracted
=
true
;
bool
imagesExtracted
=
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录