Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sq975
openpose
提交
5401f668
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,体验更适合开发者的 AI 搜索 >>
提交
5401f668
编写于
9月 03, 2018
作者:
G
gineshidalgo99
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Distance alpha edited
上级
123cb647
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
43 deletion
+42
-43
src/openpose/pose/bodyPartConnectorBase.cpp
src/openpose/pose/bodyPartConnectorBase.cpp
+42
-43
未找到文件。
src/openpose/pose/bodyPartConnectorBase.cpp
浏览文件 @
5401f668
...
...
@@ -664,64 +664,63 @@ namespace op
// Refined method
const
auto
constant
=
5
;
Point
<
T
>
neckPartDistRefined
{
0
,
0
};
for
(
auto
y
=
intRound
(
rootY
/
scaleFactor
)
-
constant
;
y
<
intRound
(
rootY
/
scaleFactor
)
+
constant
+
1
;
y
++
)
auto
counterRefinements
=
0
;
// We must keep it inside the image size
for
(
auto
y
=
fastMax
(
0
,
intRound
(
rootY
/
scaleFactor
)
-
constant
);
y
<
fastMin
(
heatMapSize
.
y
,
intRound
(
rootY
/
scaleFactor
)
+
constant
+
1
)
;
y
++
)
{
for
(
auto
x
=
intRound
(
rootX
/
scaleFactor
)
-
constant
;
x
<
intRound
(
rootX
/
scaleFactor
)
+
constant
+
1
;
x
++
)
for
(
auto
x
=
fastMax
(
0
,
intRound
(
rootX
/
scaleFactor
)
-
constant
)
;
x
<
fastMin
(
heatMapSize
.
x
,
intRound
(
rootX
/
scaleFactor
)
+
constant
+
1
)
;
x
++
)
{
const
auto
index
=
y
*
heatMapSize
.
x
+
x
;
neckPartDistRefined
.
x
+=
mapX
[
index
];
neckPartDistRefined
.
y
+=
mapY
[
index
];
counterRefinements
++
;
}
}
auto
sqConst
=
(
constant
*
2
+
1
);
sqConst
*=
sqConst
;
neckPartDistRefined
=
Point
<
T
>
{
neckPartDistRefined
.
x
*
sigma
[
index2
]
+
sqConst
*
average
[
index2
],
neckPartDistRefined
.
y
*
sigma
[
index2
+
1
]
+
sqConst
*
average
[
index2
+
1
],
neckPartDistRefined
.
x
*
sigma
[
index2
]
+
counterRefinements
*
average
[
index2
],
neckPartDistRefined
.
y
*
sigma
[
index2
+
1
]
+
counterRefinements
*
average
[
index2
+
1
],
};
neckPartDistRefined
*=
increaseRatio
/
sqConst
;
neckPartDistRefined
*=
increaseRatio
/
counterRefinements
;
const
auto
partX
=
rootX
+
neckPartDistRefined
.
x
;
const
auto
partY
=
rootY
+
neckPartDistRefined
.
y
;
poseKeypoints
[{
p
,
bpOrig
,
0
}]
=
partX
;
poseKeypoints
[{
p
,
bpOrig
,
1
}]
=
partY
;
// Set (temporary) body part score
poseKeypoints
[{
p
,
bpOrig
,
2
}]
=
T
(
0.0501
);
// // Associate estimated keypoint with closest one
// const auto candidateNumberIndex = bpOrig*(maxPeaks+1)*3;
// const auto numberCandidates = intRound(peaksPtr[candidateNumberIndex]);
// int closestIndex = -1;
// T closetValue = std::numeric_limits<T>::max();
// for (auto i = 0 ; i < numberCandidates ; i++)
// {
// const auto candidateXYSIndex = candidateNumberIndex+3*(1+i);
// const auto diffX = partX-scaleFactor*peaksPtr[candidateXYSIndex];
// const auto diffY = partY-scaleFactor*peaksPtr[candidateXYSIndex+1];
// const auto dist = (diffX*diffX + diffY*diffY);
// if (closetValue > dist)
// {
// closetValue = dist;
// closestIndex = candidateXYSIndex;
// }
// }
// if (closestIndex != -1)
// {
// const auto estimatedDist = neckPartDistRefined.x*neckPartDistRefined.x
// + neckPartDistRefined.y*neckPartDistRefined.y;
// const auto x = scaleFactor*peaksPtr[closestIndex];
// const auto y = scaleFactor*peaksPtr[closestIndex+1];
// const auto candidateDist = (rootX-x)*(rootX-x)+(rootY-y)*(rootY-y);
// if (estimatedDist/candidateDist < 1.1 && estimatedDist/candidateDist > 0.9)
// {
// poseKeypoints[{p,bpOrig,0}] = x;
// poseKeypoints[{p,bpOrig,1}] = y;
// // Set body part score
// const auto s = peaksPtr[closestIndex+2];
// // poseKeypoints[{p,bpOrig,2}] = s -;
// poseKeypoints[{p,bpOrig,2}] = s;
// }
// }
// Associate estimated keypoint with closest one
const
auto
xCleaned
=
fastMax
(
0
,
fastMin
(
heatMapSize
.
x
-
1
,
intRound
(
partX
/
scaleFactor
)));
const
auto
yCleaned
=
fastMax
(
0
,
fastMin
(
heatMapSize
.
y
-
1
,
intRound
(
partY
/
scaleFactor
)));
const
auto
partConfidence
=
heatMapPtr
[
bpOrig
*
heatMapOffset
+
yCleaned
*
heatMapSize
.
x
+
xCleaned
];
// If partConfidence is big enough, it means we are close to a keypoint
if
(
partConfidence
>
T
(
0.05
))
{
const
auto
candidateNumberIndex
=
bpOrig
*
(
maxPeaks
+
1
)
*
3
;
const
auto
numberCandidates
=
intRound
(
peaksPtr
[
candidateNumberIndex
]);
int
closestIndex
=
-
1
;
T
closetValue
=
std
::
numeric_limits
<
T
>::
max
();
for
(
auto
i
=
0
;
i
<
numberCandidates
;
i
++
)
{
const
auto
candidateXYSIndex
=
candidateNumberIndex
+
3
*
(
1
+
i
);
const
auto
diffX
=
partX
-
scaleFactor
*
peaksPtr
[
candidateXYSIndex
];
const
auto
diffY
=
partY
-
scaleFactor
*
peaksPtr
[
candidateXYSIndex
+
1
];
const
auto
dist
=
(
diffX
*
diffX
+
diffY
*
diffY
);
if
(
closetValue
>
dist
)
{
closetValue
=
dist
;
closestIndex
=
candidateXYSIndex
;
}
}
if
(
closestIndex
!=
-
1
)
{
poseKeypoints
[{
p
,
bpOrig
,
0
}]
=
scaleFactor
*
peaksPtr
[
closestIndex
];
poseKeypoints
[{
p
,
bpOrig
,
1
}]
=
scaleFactor
*
peaksPtr
[
closestIndex
+
1
];
// Set body part score
poseKeypoints
[{
p
,
bpOrig
,
2
}]
=
peaksPtr
[
closestIndex
+
2
];
}
}
// Set poseScore
poseScores
[
p
]
+=
poseKeypoints
[{
p
,
bpOrig
,
2
}];
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录