Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
huiyeruzhou
openpose
提交
25d021e7
O
openpose
项目概览
huiyeruzhou
/
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,发现更多精彩内容 >>
提交
25d021e7
编写于
9月 18, 2017
作者:
G
gineshidalgo99
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed all sign warnings
上级
02354bb3
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
65 addition
and
64 deletion
+65
-64
3rdparty/caffe/include/caffe/blob.hpp
3rdparty/caffe/include/caffe/blob.hpp
+1
-1
Makefile
Makefile
+4
-1
doc/release_notes.md
doc/release_notes.md
+1
-0
examples/tests/wrapperHandFromJsonTest.hpp
examples/tests/wrapperHandFromJsonTest.hpp
+1
-1
include/openpose/filestream/wFaceSaver.hpp
include/openpose/filestream/wFaceSaver.hpp
+1
-1
include/openpose/filestream/wHandSaver.hpp
include/openpose/filestream/wHandSaver.hpp
+2
-2
include/openpose/filestream/wHeatMapSaver.hpp
include/openpose/filestream/wHeatMapSaver.hpp
+1
-1
include/openpose/filestream/wImageSaver.hpp
include/openpose/filestream/wImageSaver.hpp
+1
-1
include/openpose/filestream/wKeypointJsonSaver.hpp
include/openpose/filestream/wKeypointJsonSaver.hpp
+1
-1
include/openpose/filestream/wPoseSaver.hpp
include/openpose/filestream/wPoseSaver.hpp
+1
-1
include/openpose/filestream/wVideoSaver.hpp
include/openpose/filestream/wVideoSaver.hpp
+1
-1
include/openpose/thread/wQueueOrderer.hpp
include/openpose/thread/wQueueOrderer.hpp
+4
-4
include/openpose/wrapper/wrapper.hpp
include/openpose/wrapper/wrapper.hpp
+8
-8
src/openpose/core/array.cpp
src/openpose/core/array.cpp
+9
-9
src/openpose/filestream/cocoJsonSaver.cpp
src/openpose/filestream/cocoJsonSaver.cpp
+2
-2
src/openpose/filestream/fileStream.cpp
src/openpose/filestream/fileStream.cpp
+5
-5
src/openpose/filestream/heatMapSaver.cpp
src/openpose/filestream/heatMapSaver.cpp
+3
-3
src/openpose/filestream/imageSaver.cpp
src/openpose/filestream/imageSaver.cpp
+2
-2
src/openpose/filestream/keypointSaver.cpp
src/openpose/filestream/keypointSaver.cpp
+2
-2
src/openpose/filestream/videoSaver.cpp
src/openpose/filestream/videoSaver.cpp
+1
-1
src/openpose/hand/handDetector.cpp
src/openpose/hand/handDetector.cpp
+3
-6
src/openpose/pose/bodyPartConnectorBase.cpp
src/openpose/pose/bodyPartConnectorBase.cpp
+8
-8
src/openpose/pose/poseRenderer.cpp
src/openpose/pose/poseRenderer.cpp
+1
-1
src/openpose/utilities/keypoint.cpp
src/openpose/utilities/keypoint.cpp
+2
-2
未找到文件。
3rdparty/caffe/include/caffe/blob.hpp
浏览文件 @
25d021e7
...
...
@@ -53,7 +53,7 @@ class Blob {
void
ReshapeLike
(
const
Blob
&
other
);
inline
string
shape_string
()
const
{
ostringstream
stream
;
for
(
int
i
=
0
;
i
<
shape_
.
size
();
++
i
)
{
for
(
auto
i
=
0u
;
i
<
shape_
.
size
();
++
i
)
{
stream
<<
shape_
[
i
]
<<
" "
;
}
stream
<<
"("
<<
count_
<<
")"
;
...
...
Makefile
浏览文件 @
25d021e7
...
...
@@ -169,7 +169,10 @@ ifeq ($(USE_OPENCV), 1)
endif
endif
WARNINGS
:=
-Wall -Wno-sign-compare
##############################
# OpenPose extra code: commented
##############################
# WARNINGS := -Wall -Wno-sign-compare
##############################
# Set build directories
...
...
doc/release_notes.md
浏览文件 @
25d021e7
...
...
@@ -105,5 +105,6 @@ OpenPose Library - Release Notes
## Current version (future OpenPose 1.0.3)
1.
Main improvements:
1.
Added how to use keypoint data in
`examples/tutorial_wrapper/`
.
2.
Added flag for warnings of type
`-Wsign-compare`
and removed in code.
2.
Main bugs fixed:
1.
Windows version crashing with std::map copy.
examples/tests/wrapperHandFromJsonTest.hpp
浏览文件 @
25d021e7
...
...
@@ -185,7 +185,7 @@ namespace op
{
spWPoses
.
resize
(
gpuNumber
);
const
auto
handDetector
=
std
::
make_shared
<
HandDetectorFromTxt
>
(
handGroundTruth
);
for
(
auto
gpuId
=
0
;
gpuId
<
spWPoses
.
size
();
gpuId
++
)
for
(
auto
gpuId
=
0
u
;
gpuId
<
spWPoses
.
size
();
gpuId
++
)
{
// Hand detector
// If tracking
...
...
include/openpose/filestream/wFaceSaver.hpp
浏览文件 @
25d021e7
...
...
@@ -59,7 +59,7 @@ namespace op
auto
&
tDatumsNoPtr
=
*
tDatums
;
// Record people face keypoint data
std
::
vector
<
Array
<
float
>>
keypointVector
(
tDatumsNoPtr
.
size
());
for
(
auto
i
=
0
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
keypointVector
[
i
]
=
tDatumsNoPtr
[
i
].
faceKeypoints
;
const
auto
fileName
=
(
!
tDatumsNoPtr
[
0
].
name
.
empty
()
?
tDatumsNoPtr
[
0
].
name
:
std
::
to_string
(
tDatumsNoPtr
[
0
].
id
));
spKeypointSaver
->
saveKeypoints
(
keypointVector
,
fileName
,
"face"
);
...
...
include/openpose/filestream/wHandSaver.hpp
浏览文件 @
25d021e7
...
...
@@ -61,11 +61,11 @@ namespace op
const
auto
fileName
=
(
!
tDatumsNoPtr
[
0
].
name
.
empty
()
?
tDatumsNoPtr
[
0
].
name
:
std
::
to_string
(
tDatumsNoPtr
[
0
].
id
));
std
::
vector
<
Array
<
float
>>
keypointVector
(
tDatumsNoPtr
.
size
());
// Left hand
for
(
auto
i
=
0
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
keypointVector
[
i
]
=
tDatumsNoPtr
[
i
].
handKeypoints
[
0
];
spKeypointSaver
->
saveKeypoints
(
keypointVector
,
fileName
,
"hand_left"
);
// Right hand
for
(
auto
i
=
0
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
keypointVector
[
i
]
=
tDatumsNoPtr
[
i
].
handKeypoints
[
1
];
spKeypointSaver
->
saveKeypoints
(
keypointVector
,
fileName
,
"hand_right"
);
// Profiling speed
...
...
include/openpose/filestream/wHeatMapSaver.hpp
浏览文件 @
25d021e7
...
...
@@ -58,7 +58,7 @@ namespace op
auto
&
tDatumsNoPtr
=
*
tDatums
;
// Record image(s) on disk
std
::
vector
<
Array
<
float
>>
poseHeatMaps
(
tDatumsNoPtr
.
size
());
for
(
auto
i
=
0
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
poseHeatMaps
[
i
]
=
tDatumsNoPtr
[
i
].
poseHeatMaps
;
const
auto
fileName
=
(
!
tDatumsNoPtr
[
0
].
name
.
empty
()
?
tDatumsNoPtr
[
0
].
name
:
std
::
to_string
(
tDatumsNoPtr
[
0
].
id
));
spHeatMapSaver
->
saveHeatMaps
(
poseHeatMaps
,
fileName
);
...
...
include/openpose/filestream/wImageSaver.hpp
浏览文件 @
25d021e7
...
...
@@ -58,7 +58,7 @@ namespace op
auto
&
tDatumsNoPtr
=
*
tDatums
;
// Record image(s) on disk
std
::
vector
<
cv
::
Mat
>
cvOutputDatas
(
tDatumsNoPtr
.
size
());
for
(
auto
i
=
0
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
cvOutputDatas
[
i
]
=
tDatumsNoPtr
[
i
].
cvOutputData
;
const
auto
fileName
=
(
!
tDatumsNoPtr
[
0
].
name
.
empty
()
?
tDatumsNoPtr
[
0
].
name
:
std
::
to_string
(
tDatumsNoPtr
[
0
].
id
));
spImageSaver
->
saveImages
(
cvOutputDatas
,
fileName
);
...
...
include/openpose/filestream/wKeypointJsonSaver.hpp
浏览文件 @
25d021e7
...
...
@@ -59,7 +59,7 @@ namespace op
const
auto
baseFileName
=
(
!
tDatumFirst
.
name
.
empty
()
?
tDatumFirst
.
name
:
std
::
to_string
(
tDatumFirst
.
id
))
+
"_keypoints"
;
const
bool
humanReadable
=
true
;
for
(
auto
i
=
0
;
i
<
tDatums
->
size
()
;
i
++
)
for
(
auto
i
=
0
u
;
i
<
tDatums
->
size
()
;
i
++
)
{
const
auto
&
tDatum
=
(
*
tDatums
)[
i
];
// const auto fileName = baseFileName;
...
...
include/openpose/filestream/wPoseSaver.hpp
浏览文件 @
25d021e7
...
...
@@ -59,7 +59,7 @@ namespace op
auto
&
tDatumsNoPtr
=
*
tDatums
;
// Record people pose keypoint data
std
::
vector
<
Array
<
float
>>
keypointVector
(
tDatumsNoPtr
.
size
());
for
(
auto
i
=
0
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
tDatumsNoPtr
.
size
();
i
++
)
keypointVector
[
i
]
=
tDatumsNoPtr
[
i
].
poseKeypoints
;
const
auto
fileName
=
(
!
tDatumsNoPtr
[
0
].
name
.
empty
()
?
tDatumsNoPtr
[
0
].
name
:
std
::
to_string
(
tDatumsNoPtr
[
0
].
id
));
spKeypointSaver
->
saveKeypoints
(
keypointVector
,
fileName
,
"pose"
);
...
...
include/openpose/filestream/wVideoSaver.hpp
浏览文件 @
25d021e7
...
...
@@ -58,7 +58,7 @@ namespace op
auto
&
tDatumsNoPtr
=
*
tDatums
;
// Record video(s)
std
::
vector
<
cv
::
Mat
>
cvOutputDatas
(
tDatumsNoPtr
.
size
());
for
(
auto
i
=
0
;
i
<
cvOutputDatas
.
size
()
;
i
++
)
for
(
auto
i
=
0
u
;
i
<
cvOutputDatas
.
size
()
;
i
++
)
cvOutputDatas
[
i
]
=
tDatumsNoPtr
[
i
].
cvOutputData
;
spVideoSaver
->
write
(
cvOutputDatas
);
// Profiling speed
...
...
include/openpose/thread/wQueueOrderer.hpp
浏览文件 @
25d021e7
...
...
@@ -12,7 +12,7 @@ namespace op
class
WQueueOrderer
:
public
Worker
<
TDatums
>
{
public:
explicit
WQueueOrderer
(
const
int
maxBufferSize
=
64
);
explicit
WQueueOrderer
(
const
unsigned
int
maxBufferSize
=
64u
);
void
initializationOnThread
();
...
...
@@ -21,7 +21,7 @@ namespace op
void
tryStop
();
private:
const
int
mMaxBufferSize
;
const
unsigned
int
mMaxBufferSize
;
bool
mStopWhenEmpty
;
unsigned
long
long
mNextExpectedId
;
std
::
priority_queue
<
TDatums
,
std
::
vector
<
TDatums
>
,
PointerContainerGreater
<
TDatums
>>
mPriorityQueueBuffer
;
...
...
@@ -40,7 +40,7 @@ namespace op
namespace
op
{
template
<
typename
TDatums
>
WQueueOrderer
<
TDatums
>::
WQueueOrderer
(
const
int
maxBufferSize
)
:
WQueueOrderer
<
TDatums
>::
WQueueOrderer
(
const
unsigned
int
maxBufferSize
)
:
mMaxBufferSize
{
maxBufferSize
},
mStopWhenEmpty
{
false
},
mNextExpectedId
{
0
}
...
...
@@ -99,7 +99,7 @@ namespace op
mNextExpectedId
=
tDatumsNoPtr
[
0
].
id
+
1
;
}
// Sleep if no new tDatums to either pop
if
(
!
checkNoNullNorEmpty
(
tDatums
)
&&
mPriorityQueueBuffer
.
size
()
<
mMaxBufferSize
/
2
)
if
(
!
checkNoNullNorEmpty
(
tDatums
)
&&
mPriorityQueueBuffer
.
size
()
<
mMaxBufferSize
/
2
u
)
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
{
1
});
// If TDatum popped and/or pushed
if
(
profileSpeed
||
tDatums
!=
nullptr
)
...
...
include/openpose/wrapper/wrapper.hpp
浏览文件 @
25d021e7
...
...
@@ -589,7 +589,7 @@ namespace op
// GPU rendering
if
(
renderOutputGpu
)
{
for
(
auto
gpuId
=
0
;
gpuId
<
poseExtractors
.
size
();
gpuId
++
)
for
(
auto
gpuId
=
0
u
;
gpuId
<
poseExtractors
.
size
();
gpuId
++
)
{
poseRenderers
.
emplace_back
(
std
::
make_shared
<
PoseRenderer
>
(
poseNetOutputSize
,
finalOutputSize
,
wrapperStructPose
.
poseModel
,
poseExtractors
[
gpuId
],
...
...
@@ -621,14 +621,14 @@ namespace op
// Pose extractor(s)
spWPoses
.
resize
(
poseExtractors
.
size
());
for
(
auto
i
=
0
;
i
<
spWPoses
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
spWPoses
.
size
();
i
++
)
spWPoses
.
at
(
i
)
=
{
std
::
make_shared
<
WPoseExtractor
<
TDatumsPtr
>>
(
poseExtractors
.
at
(
i
))};
// Face extractor(s)
if
(
wrapperStructFace
.
enable
)
{
const
auto
faceDetector
=
std
::
make_shared
<
FaceDetector
>
(
wrapperStructPose
.
poseModel
);
for
(
auto
gpuId
=
0
;
gpuId
<
spWPoses
.
size
();
gpuId
++
)
for
(
auto
gpuId
=
0
u
;
gpuId
<
spWPoses
.
size
();
gpuId
++
)
{
// Face detector
spWPoses
.
at
(
gpuId
).
emplace_back
(
std
::
make_shared
<
WFaceDetector
<
TDatumsPtr
>>
(
faceDetector
));
...
...
@@ -645,7 +645,7 @@ namespace op
if
(
wrapperStructHand
.
enable
)
{
const
auto
handDetector
=
std
::
make_shared
<
HandDetector
>
(
wrapperStructPose
.
poseModel
);
for
(
auto
gpuId
=
0
;
gpuId
<
spWPoses
.
size
();
gpuId
++
)
for
(
auto
gpuId
=
0
u
;
gpuId
<
spWPoses
.
size
();
gpuId
++
)
{
// Hand detector
// If tracking
...
...
@@ -669,7 +669,7 @@ namespace op
// Pose renderer(s)
if
(
!
poseRenderers
.
empty
())
for
(
auto
i
=
0
;
i
<
spWPoses
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
spWPoses
.
size
();
i
++
)
spWPoses
.
at
(
i
).
emplace_back
(
std
::
make_shared
<
WPoseRenderer
<
TDatumsPtr
>>
(
poseRenderers
.
at
(
i
)));
// Face renderer(s)
...
...
@@ -689,7 +689,7 @@ namespace op
// GPU rendering
else
if
(
wrapperStructFace
.
renderMode
==
RenderMode
::
Gpu
)
{
for
(
auto
i
=
0
;
i
<
spWPoses
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
spWPoses
.
size
();
i
++
)
{
// Construct face renderer
const
auto
faceRenderer
=
std
::
make_shared
<
FaceRenderer
>
(
finalOutputSize
,
wrapperStructFace
.
renderThreshold
,
...
...
@@ -727,7 +727,7 @@ namespace op
// GPU rendering
else
if
(
wrapperStructHand
.
renderMode
==
RenderMode
::
Gpu
)
{
for
(
auto
i
=
0
;
i
<
spWPoses
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
spWPoses
.
size
();
i
++
)
{
// Construct hands renderer
const
auto
handRenderer
=
std
::
make_shared
<
HandRenderer
>
(
finalOutputSize
,
wrapperStructHand
.
renderThreshold
,
...
...
@@ -751,7 +751,7 @@ namespace op
// Itermediate workers (e.g. OpenPose format to cv::Mat, json & frames recorder, ...)
mPostProcessingWs
.
clear
();
// Frame buffer and ordering
if
(
spWPoses
.
size
()
>
1
)
if
(
spWPoses
.
size
()
>
1
u
)
mPostProcessingWs
.
emplace_back
(
std
::
make_shared
<
WQueueOrderer
<
TDatumsPtr
>>
());
// Frames processor (OpenPose format -> cv::Mat format)
if
(
renderOutput
)
...
...
src/openpose/core/array.cpp
浏览文件 @
25d021e7
...
...
@@ -173,7 +173,7 @@ namespace op
else
{
mSize
=
{};
mVolume
=
0
;
mVolume
=
0
ul
;
spData
.
reset
();
// cv::Mat available but empty
mCvMatData
=
std
::
make_pair
(
true
,
cv
::
Mat
());
...
...
@@ -222,7 +222,7 @@ namespace op
{
// New size
std
::
vector
<
int
>
newSize
(
cvMat
.
dims
,
0
);
for
(
auto
i
=
0
;
i
<
newSize
.
size
()
;
i
++
)
for
(
auto
i
=
0
u
;
i
<
newSize
.
size
()
;
i
++
)
newSize
[
i
]
=
cvMat
.
size
[
i
];
// Reset data & volume
reset
(
newSize
);
...
...
@@ -252,7 +252,7 @@ namespace op
if
(
mCvMatData
.
first
)
mCvMatData
.
second
.
setTo
((
double
)
value
);
else
for
(
auto
i
=
0
;
i
<
mVolume
;
i
++
)
for
(
auto
i
=
0
u
;
i
<
mVolume
;
i
++
)
operator
[](
i
)
=
value
;
}
}
...
...
@@ -270,12 +270,12 @@ namespace op
// Matlab style:
// If empty -> return 0
// If index >= # dimensions -> return 1
if
(
index
<
mSize
.
size
()
&&
0
<=
index
)
if
(
(
unsigned
int
)
index
<
mSize
.
size
()
&&
0
<=
index
)
return
mSize
[
index
];
// Long version:
// else if (mSize.empty())
// return 0;
// else // if mSize.size() <=
index
// else // if mSize.size() <=
(unsigned int)index
// return 1;
// Equivalent to:
else
...
...
@@ -295,7 +295,7 @@ namespace op
{
if
(
indexA
<
indexB
)
{
if
(
0
<=
indexA
&&
indexB
<
mSize
.
size
())
// 0 <= indexA < indexB < mSize.size()
if
(
0
<=
indexA
&&
(
unsigned
int
)
indexB
<
mSize
.
size
())
// 0 <= indexA < indexB < mSize.size()
return
std
::
accumulate
(
mSize
.
begin
()
+
indexA
,
mSize
.
begin
()
+
indexB
+
1
,
1ul
,
std
::
multiplies
<
size_t
>
());
else
{
...
...
@@ -358,14 +358,14 @@ namespace op
// Initial value
std
::
string
string
{
"Array<T>::toString():
\n
"
};
// Add each element
for
(
auto
i
=
0
;
i
<
mVolume
;
i
++
)
for
(
auto
i
=
0
u
;
i
<
mVolume
;
i
++
)
{
// Adding element sepearted by an space
string
+=
std
::
to_string
(
spData
[
i
])
+
" "
;
// Introduce an enter for each dimension change
// If comented, all values will be printed in the same line
auto
multiplier
=
1
;
for
(
auto
dimension
=
(
int
)(
mSize
.
size
()
-
1u
)
;
dimension
>
0
&&
((
i
/
multiplier
)
%
getSize
(
dimension
)
==
getSize
(
dimension
)
-
1
)
;
dimension
--
)
for
(
auto
dimension
=
(
int
)(
mSize
.
size
()
-
1u
)
;
dimension
>
0
&&
(
int
(
i
/
multiplier
)
%
getSize
(
dimension
)
==
getSize
(
dimension
)
-
1
)
;
dimension
--
)
{
string
+=
"
\n
"
;
multiplier
*=
getSize
(
dimension
);
...
...
@@ -423,7 +423,7 @@ namespace op
{
try
{
if
(
0
<=
index
&&
index
<
mVolume
)
if
(
0
<=
index
&&
(
size_t
)
index
<
mVolume
)
return
spData
[
index
];
else
{
...
...
src/openpose/filestream/cocoJsonSaver.cpp
浏览文件 @
25d021e7
...
...
@@ -63,7 +63,7 @@ namespace op
mJsonOfstream
.
key
(
"keypoints"
);
mJsonOfstream
.
arrayOpen
();
const
std
::
vector
<
int
>
indexesInCocoOrder
{
0
,
15
,
14
,
17
,
16
,
5
,
2
,
6
,
3
,
7
,
4
,
11
,
8
,
12
,
9
,
13
,
10
};
for
(
auto
bodyPart
=
0
;
bodyPart
<
indexesInCocoOrder
.
size
()
;
bodyPart
++
)
for
(
auto
bodyPart
=
0
u
;
bodyPart
<
indexesInCocoOrder
.
size
()
;
bodyPart
++
)
{
const
auto
finalIndex
=
3
*
(
person
*
numberBodyParts
+
indexesInCocoOrder
.
at
(
bodyPart
));
mJsonOfstream
.
plainText
(
poseKeypoints
[
finalIndex
]);
...
...
@@ -71,7 +71,7 @@ namespace op
mJsonOfstream
.
plainText
(
poseKeypoints
[
finalIndex
+
1
]);
mJsonOfstream
.
comma
();
mJsonOfstream
.
plainText
(
1
);
if
(
bodyPart
<
indexesInCocoOrder
.
size
()
-
1
)
if
(
bodyPart
<
indexesInCocoOrder
.
size
()
-
1
u
)
mJsonOfstream
.
comma
();
}
mJsonOfstream
.
arrayClose
();
...
...
src/openpose/filestream/fileStream.cpp
浏览文件 @
25d021e7
...
...
@@ -82,7 +82,7 @@ namespace op
error
(
"cvMats.size() != cvMatNames.size()"
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
// Save cv::Mat data
cv
::
FileStorage
fileStorage
{
getFullName
(
fileNameNoExtension
,
format
),
cv
::
FileStorage
::
WRITE
};
for
(
auto
i
=
0
;
i
<
cvMats
.
size
()
;
i
++
)
for
(
auto
i
=
0
u
;
i
<
cvMats
.
size
()
;
i
++
)
fileStorage
<<
cvMatNames
[
i
]
<<
(
cvMats
[
i
].
empty
()
?
cv
::
Mat
()
:
cvMats
[
i
]);
// Release file
fileStorage
.
release
();
...
...
@@ -114,7 +114,7 @@ namespace op
cv
::
FileStorage
fileStorage
{
getFullName
(
fileNameNoExtension
,
format
),
cv
::
FileStorage
::
READ
};
std
::
vector
<
cv
::
Mat
>
cvMats
(
cvMatNames
.
size
());
for
(
auto
i
=
0
;
i
<
cvMats
.
size
()
;
i
++
)
for
(
auto
i
=
0
u
;
i
<
cvMats
.
size
()
;
i
++
)
fileStorage
[
cvMatNames
[
i
]]
>>
cvMats
[
i
];
fileStorage
.
release
();
return
cvMats
;
...
...
@@ -171,12 +171,12 @@ namespace op
jsonOfstream
.
arrayOpen
();
// Ger max numberPeople
auto
numberPeople
=
0
;
for
(
auto
vectorIndex
=
0
;
vectorIndex
<
keypointVector
.
size
()
;
vectorIndex
++
)
for
(
auto
vectorIndex
=
0
u
;
vectorIndex
<
keypointVector
.
size
()
;
vectorIndex
++
)
numberPeople
=
fastMax
(
numberPeople
,
keypointVector
[
vectorIndex
].
first
.
getSize
(
0
));
for
(
auto
person
=
0
;
person
<
numberPeople
;
person
++
)
{
jsonOfstream
.
objectOpen
();
for
(
auto
vectorIndex
=
0
;
vectorIndex
<
keypointVector
.
size
()
;
vectorIndex
++
)
for
(
auto
vectorIndex
=
0
u
;
vectorIndex
<
keypointVector
.
size
()
;
vectorIndex
++
)
{
const
auto
&
keypoints
=
keypointVector
[
vectorIndex
].
first
;
const
auto
&
keypointName
=
keypointVector
[
vectorIndex
].
second
;
...
...
@@ -262,7 +262,7 @@ namespace op
std
::
vector
<
float
>
splittedInts
;
for
(
auto
splittedString
:
splittedStrings
)
splittedInts
.
emplace_back
(
std
::
stof
(
splittedString
));
if
(
splittedInts
.
size
()
!=
4
)
if
(
splittedInts
.
size
()
!=
4
u
)
error
(
"splittedInts.size() != 4, but splittedInts.size() = "
+
std
::
to_string
(
splittedInts
.
size
())
+
"."
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
const
Rectangle
<
float
>
handRectangleZero
;
...
...
src/openpose/filestream/heatMapSaver.cpp
浏览文件 @
25d021e7
...
...
@@ -31,16 +31,16 @@ namespace op
// Get names for each heatMap
std
::
vector
<
std
::
string
>
fileNames
(
heatMaps
.
size
());
for
(
auto
i
=
0
;
i
<
fileNames
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
fileNames
.
size
();
i
++
)
fileNames
[
i
]
=
{
fileNameNoExtension
+
(
i
!=
0
?
"_"
+
std
::
to_string
(
i
)
:
""
)
+
"."
+
mImageFormat
};
// heatMaps -> cvOutputDatas
std
::
vector
<
cv
::
Mat
>
cvOutputDatas
(
heatMaps
.
size
());
for
(
auto
i
=
0
;
i
<
cvOutputDatas
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
cvOutputDatas
.
size
();
i
++
)
unrollArrayToUCharCvMat
(
cvOutputDatas
[
i
],
heatMaps
[
i
]);
// Save each heatMap
for
(
auto
i
=
0
;
i
<
cvOutputDatas
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
cvOutputDatas
.
size
();
i
++
)
saveImage
(
cvOutputDatas
[
i
],
fileNames
[
i
]);
}
}
...
...
src/openpose/filestream/imageSaver.cpp
浏览文件 @
25d021e7
...
...
@@ -30,11 +30,11 @@ namespace op
// Get names for each image
std
::
vector
<
std
::
string
>
fileNames
(
cvOutputDatas
.
size
());
for
(
auto
i
=
0
;
i
<
fileNames
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
fileNames
.
size
();
i
++
)
fileNames
[
i
]
=
{
fileNameNoExtension
+
(
i
!=
0
?
"_"
+
std
::
to_string
(
i
)
:
""
)
+
"."
+
mImageFormat
};
// Save each image
for
(
auto
i
=
0
;
i
<
cvOutputDatas
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
cvOutputDatas
.
size
();
i
++
)
saveImage
(
cvOutputDatas
[
i
],
fileNames
[
i
]);
}
}
...
...
src/openpose/filestream/keypointSaver.cpp
浏览文件 @
25d021e7
...
...
@@ -20,12 +20,12 @@ namespace op
// Get vector of people poses
std
::
vector
<
cv
::
Mat
>
cvMatPoses
(
keypointVector
.
size
());
for
(
auto
i
=
0
;
i
<
keypointVector
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
keypointVector
.
size
();
i
++
)
cvMatPoses
[
i
]
=
keypointVector
[
i
].
getConstCvMat
();
// Get names inside file
std
::
vector
<
std
::
string
>
keypointVectorNames
(
cvMatPoses
.
size
());
for
(
auto
i
=
0
;
i
<
cvMatPoses
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
cvMatPoses
.
size
();
i
++
)
keypointVectorNames
[
i
]
=
{
keypointName
+
"_"
+
std
::
to_string
(
i
)};
// Record people poses in desired format
...
...
src/openpose/filestream/videoSaver.cpp
浏览文件 @
25d021e7
...
...
@@ -79,7 +79,7 @@ namespace op
if
(
cvMats
.
size
()
!=
mVideoWriters
.
size
())
error
(
"Size cvMats != size video writers"
);
for
(
auto
i
=
0
;
i
<
mVideoWriters
.
size
()
;
i
++
)
for
(
auto
i
=
0
u
;
i
<
mVideoWriters
.
size
()
;
i
++
)
mVideoWriters
[
i
].
write
(
cvMats
[
i
]);
}
catch
(
const
std
::
exception
&
e
)
...
...
src/openpose/hand/handDetector.cpp
浏览文件 @
25d021e7
...
...
@@ -94,7 +94,7 @@ namespace op
// Find closest previous rectangle
auto
maxIndex
=
-
1
;
auto
maxValue
=
0.
f
;
for
(
auto
previous
=
0
;
previous
<
previousHands
.
size
()
;
previous
++
)
for
(
auto
previous
=
0
u
;
previous
<
previousHands
.
size
()
;
previous
++
)
{
const
auto
areaRatio
=
getAreaRatio
(
currentRectangle
,
previousHands
[
previous
]);
if
(
maxValue
<
areaRatio
)
...
...
@@ -169,11 +169,8 @@ namespace op
// Baseline detectHands
auto
handRectangles
=
detectHands
(
poseKeypoints
,
scaleInputToOutput
);
// If previous hands saved
// for (auto current = 0 ; current < handRectangles.size() ; current++)
for
(
auto
&
handRectangle
:
handRectangles
)
{
// trackHand(handRectangles[current][0], mHandLeftPrevious);
// trackHand(handRectangles[current][1], mHandRightPrevious);
trackHand
(
handRectangle
[
0
],
mHandLeftPrevious
);
trackHand
(
handRectangle
[
1
],
mHandRightPrevious
);
}
...
...
@@ -203,7 +200,7 @@ namespace op
mPoseTrack
.
resize
(
numberPeople
);
mHandLeftPrevious
.
clear
();
mHandRightPrevious
.
clear
();
for
(
auto
person
=
0
;
person
<
mPoseTrack
.
size
()
;
person
++
)
for
(
auto
person
=
0
u
;
person
<
mPoseTrack
.
size
()
;
person
++
)
{
const
auto
scoreThreshold
=
0.66667
f
;
// Left hand
...
...
@@ -234,7 +231,7 @@ namespace op
)
const
{
std
::
array
<
unsigned
int
,
(
int
)
PosePart
::
Size
>
poseKeypoints
;
for
(
auto
i
=
0
;
i
<
poseKeypoints
.
size
()
;
i
++
)
for
(
auto
i
=
0
u
;
i
<
poseKeypoints
.
size
()
;
i
++
)
poseKeypoints
.
at
(
i
)
=
poseBodyPartMapStringToKey
(
poseModel
,
poseStrings
.
at
(
i
));
return
poseKeypoints
;
}
...
...
src/openpose/pose/bodyPartConnectorBase.cpp
浏览文件 @
25d021e7
...
...
@@ -25,7 +25,7 @@ namespace op
const
auto
peaksOffset
=
3
*
(
maxPeaks
+
1
);
const
auto
heatMapOffset
=
heatMapSize
.
area
();
for
(
auto
pairIndex
=
0
;
pairIndex
<
numberBodyPartPairs
;
pairIndex
++
)
for
(
auto
pairIndex
=
0
u
;
pairIndex
<
numberBodyPartPairs
;
pairIndex
++
)
{
const
auto
bodyPartA
=
bodyPartPairs
[
2
*
pairIndex
];
const
auto
bodyPartB
=
bodyPartPairs
[
2
*
pairIndex
+
1
];
...
...
@@ -46,7 +46,7 @@ namespace op
{
bool
num
=
false
;
const
auto
indexB
=
bodyPartB
;
for
(
auto
j
=
0
;
j
<
subset
.
size
();
j
++
)
for
(
auto
j
=
0
u
;
j
<
subset
.
size
();
j
++
)
{
const
auto
off
=
(
int
)
bodyPartB
*
peaksOffset
+
i
*
3
+
2
;
if
(
subset
[
j
].
first
[
indexB
]
==
off
)
...
...
@@ -87,7 +87,7 @@ namespace op
{
bool
num
=
false
;
const
auto
indexA
=
bodyPartA
;
for
(
auto
j
=
0
;
j
<
subset
.
size
();
j
++
)
for
(
auto
j
=
0
u
;
j
<
subset
.
size
();
j
++
)
{
const
auto
off
=
(
int
)
bodyPartA
*
peaksOffset
+
i
*
3
+
2
;
if
(
subset
[
j
].
first
[
indexA
]
==
off
)
...
...
@@ -177,7 +177,7 @@ namespace op
std
::
vector
<
int
>
occurA
(
nA
,
0
);
std
::
vector
<
int
>
occurB
(
nB
,
0
);
auto
counter
=
0
;
for
(
auto
row
=
0
;
row
<
temp
.
size
();
row
++
)
for
(
auto
row
=
0
u
;
row
<
temp
.
size
();
row
++
)
{
const
auto
score
=
std
::
get
<
0
>
(
temp
[
row
]);
const
auto
x
=
std
::
get
<
1
>
(
temp
[
row
]);
...
...
@@ -236,13 +236,13 @@ namespace op
if
(
!
connectionK
.
empty
())
{
// A is already in the subset, find its connection B
for
(
auto
i
=
0
;
i
<
connectionK
.
size
();
i
++
)
for
(
auto
i
=
0
u
;
i
<
connectionK
.
size
();
i
++
)
{
const
auto
indexA
=
std
::
get
<
0
>
(
connectionK
[
i
]);
const
auto
indexB
=
std
::
get
<
1
>
(
connectionK
[
i
]);
const
auto
score
=
std
::
get
<
2
>
(
connectionK
[
i
]);
auto
num
=
0
;
for
(
auto
j
=
0
;
j
<
subset
.
size
();
j
++
)
for
(
auto
j
=
0
u
;
j
<
subset
.
size
();
j
++
)
{
if
(
subset
[
j
].
first
[
bodyPartA
]
==
indexA
)
{
...
...
@@ -275,7 +275,7 @@ namespace op
auto
numberPeople
=
0
;
std
::
vector
<
int
>
validSubsetIndexes
;
validSubsetIndexes
.
reserve
(
fastMin
((
size_t
)
POSE_MAX_PEOPLE
,
subset
.
size
()));
for
(
auto
index
=
0
;
index
<
subset
.
size
()
;
index
++
)
for
(
auto
index
=
0
u
;
index
<
subset
.
size
()
;
index
++
)
{
const
auto
subsetCounter
=
subset
[
index
].
first
[
subsetCounterIndex
];
const
auto
subsetScore
=
subset
[
index
].
second
;
...
...
@@ -295,7 +295,7 @@ namespace op
poseKeypoints
.
reset
({
numberPeople
,
(
int
)
numberBodyParts
,
3
});
else
poseKeypoints
.
reset
();
for
(
auto
person
=
0
;
person
<
validSubsetIndexes
.
size
()
;
person
++
)
for
(
auto
person
=
0
u
;
person
<
validSubsetIndexes
.
size
()
;
person
++
)
{
const
auto
&
subsetI
=
subset
[
validSubsetIndexes
[
person
]].
first
;
for
(
auto
bodyPart
=
0u
;
bodyPart
<
numberBodyParts
;
bodyPart
++
)
...
...
src/openpose/pose/poseRenderer.cpp
浏览文件 @
25d021e7
...
...
@@ -19,7 +19,7 @@ namespace op
const
auto
&
bodyPartPairs
=
POSE_BODY_PART_PAIRS
[(
int
)
poseModel
];
const
auto
&
mapIdx
=
POSE_MAP_IDX
[(
int
)
poseModel
];
for
(
auto
bodyPart
=
0
;
bodyPart
<
bodyPartPairs
.
size
();
bodyPart
+=
2
)
for
(
auto
bodyPart
=
0
u
;
bodyPart
<
bodyPartPairs
.
size
();
bodyPart
+=
2
)
{
const
auto
bodyPartPairsA
=
bodyPartPairs
.
at
(
bodyPart
);
const
auto
bodyPartPairsB
=
bodyPartPairs
.
at
(
bodyPart
+
1
);
...
...
src/openpose/utilities/keypoint.cpp
浏览文件 @
25d021e7
...
...
@@ -30,7 +30,7 @@ namespace op
// Security checks
if
(
keypointsA
.
getNumberDimensions
()
!=
keypointsB
.
getNumberDimensions
())
error
(
"keypointsA.getNumberDimensions() != keypointsB.getNumberDimensions()."
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
for
(
auto
dimension
=
1
;
dimension
<
keypointsA
.
getNumberDimensions
()
;
dimension
++
)
for
(
auto
dimension
=
1
u
;
dimension
<
keypointsA
.
getNumberDimensions
()
;
dimension
++
)
if
(
keypointsA
.
getSize
(
dimension
)
!=
keypointsB
.
getSize
(
dimension
))
error
(
"keypointsA.getSize() != keypointsB.getSize()."
,
__LINE__
,
__FUNCTION__
,
__FILE__
);
// For each body part
...
...
@@ -172,7 +172,7 @@ namespace op
const
auto
radius
=
thicknessRatio
/
2
;
// Draw lines
for
(
auto
pair
=
0
;
pair
<
pairs
.
size
()
;
pair
+=
2
)
for
(
auto
pair
=
0
u
;
pair
<
pairs
.
size
()
;
pair
+=
2
)
{
const
auto
index1
=
(
person
*
numberKeypoints
+
pairs
[
pair
])
*
keypoints
.
getSize
(
2
);
const
auto
index2
=
(
person
*
numberKeypoints
+
pairs
[
pair
+
1
])
*
keypoints
.
getSize
(
2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录