提交 32c2a6f5 编写于 作者: G gineshidalgo99

Improved rendering, visually prettier

上级 066d4d53
...@@ -12,30 +12,27 @@ namespace op ...@@ -12,30 +12,27 @@ namespace op
#define HAND_PAIRS_RENDER_GPU {0,1, 1,2, 2,3, 3,4, 0,5, 5,6, 6,7, 7,8, 0,9, 9,10, 10,11, 11,12, 0,13, 13,14, 14,15, 15,16, 0,17, 17,18, 18,19, 19,20} #define HAND_PAIRS_RENDER_GPU {0,1, 1,2, 2,3, 3,4, 0,5, 5,6, 6,7, 7,8, 0,9, 9,10, 10,11, 11,12, 0,13, 13,14, 14,15, 15,16, 0,17, 17,18, 18,19, 19,20}
const std::vector<unsigned int> HAND_PAIRS_RENDER {HAND_PAIRS_RENDER_GPU}; const std::vector<unsigned int> HAND_PAIRS_RENDER {HAND_PAIRS_RENDER_GPU};
#define HAND_COLORS_RENDER \ #define HAND_COLORS_RENDER \
179.f, 0.f, 0.f, \ 100.f, 100.f, 100.f, \
204.f, 0.f, 0.f, \ 100.f, 0.f, 0.f, \
230.f, 0.f, 0.f, \ 150.f, 0.f, 0.f, \
200.f, 0.f, 0.f, \
255.f, 0.f, 0.f, \ 255.f, 0.f, 0.f, \
143.f, 179.f, 0.f, \ 100.f, 100.f, 0.f, \
163.f, 204.f, 0.f, \ 150.f, 150.f, 0.f, \
184.f, 230.f, 0.f, \ 200.f, 200.f, 0.f, \
204.f, 255.f, 0.f, \ 255.f, 255.f, 0.f, \
0.f, 179.f, 71.f, \ 0.f, 100.f, 50.f, \
0.f, 204.f, 82.f, \ 0.f, 150.f, 75.f, \
0.f, 230.f, 92.f, \ 0.f, 200.f, 100.f, \
0.f, 255.f, 102.f, \ 0.f, 255.f, 125.f, \
0.f, 71.f, 179.f, \ 0.f, 50.f, 100.f, \
0.f, 82.f, 204.f, \ 0.f, 75.f, 150.f, \
0.f, 92.f, 230.f, \ 0.f, 100.f, 200.f, \
0.f, 102.f, 255.f, \ 0.f, 125.f, 255.f, \
143.f, 0.f, 179.f, \ 100.f, 0.f, 100.f, \
163.f, 0.f, 204.f, \ 150.f, 0.f, 150.f, \
184.f, 0.f, 230.f, \ 200.f, 0.f, 200.f, \
204.f, 0.f, 255.f, \ 255.f, 0.f, 255.f
179.f, 179.f, 179.f, \
179.f, 179.f, 179.f, \
179.f, 179.f, 179.f, \
179.f, 179.f, 179.f
// Constant parameters // Constant parameters
const auto HAND_CCN_DECREASE_FACTOR = 8.f; const auto HAND_CCN_DECREASE_FACTOR = 8.f;
......
...@@ -42,6 +42,7 @@ namespace op ...@@ -42,6 +42,7 @@ namespace op
const std::vector<unsigned int> POSE_COCO_PAIRS_RENDER {POSE_COCO_PAIRS_RENDER_GPU}; const std::vector<unsigned int> POSE_COCO_PAIRS_RENDER {POSE_COCO_PAIRS_RENDER_GPU};
const std::vector<unsigned int> POSE_COCO_PAIRS {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0, 0,14, 14,16, 0,15, 15,17, 2,16, 5,17}; const std::vector<unsigned int> POSE_COCO_PAIRS {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0, 0,14, 14,16, 0,15, 15,17, 2,16, 5,17};
#define POSE_COCO_COLORS_RENDER \ #define POSE_COCO_COLORS_RENDER \
255.f, 0.f, 85.f, \
255.f, 0.f, 0.f, \ 255.f, 0.f, 0.f, \
255.f, 85.f, 0.f, \ 255.f, 85.f, 0.f, \
255.f, 170.f, 0.f, \ 255.f, 170.f, 0.f, \
...@@ -55,11 +56,10 @@ namespace op ...@@ -55,11 +56,10 @@ namespace op
0.f, 170.f, 255.f, \ 0.f, 170.f, 255.f, \
0.f, 85.f, 255.f, \ 0.f, 85.f, 255.f, \
0.f, 0.f, 255.f, \ 0.f, 0.f, 255.f, \
85.f, 0.f, 255.f, \ 255.f, 0.f, 170.f, \
170.f, 0.f, 255.f, \ 170.f, 0.f, 255.f, \
255.f, 0.f, 255.f, \ 255.f, 0.f, 255.f, \
255.f, 0.f, 170.f, \ 85.f, 0.f, 255.f
255.f, 0.f, 85.f
// MPI // MPI
const std::map<unsigned int, std::string> POSE_MPI_BODY_PARTS{ const std::map<unsigned int, std::string> POSE_MPI_BODY_PARTS{
{0, "Head"}, {0, "Head"},
...@@ -120,13 +120,17 @@ namespace op ...@@ -120,13 +120,17 @@ namespace op
{15, "LEye"}, {15, "LEye"},
{16, "REar"}, {16, "REar"},
{17, "LEar"}, {17, "LEar"},
{18, "RTest1"},
{19, "LTest1"},
{20, "RTest2"},
{21, "LTest2"},
{22, "Background"}, {22, "Background"},
}; };
const unsigned int POSE_BODY_22_NUMBER_PARTS = 2u; // Equivalent to size of std::map POSE_BODY_22_BODY_PARTS - 1 (removing background) const unsigned int POSE_BODY_22_NUMBER_PARTS = 22u; // Equivalent to size of std::map POSE_BODY_22_BODY_PARTS - 1 (removing background)
const std::vector<unsigned int> POSE_BODY_22_MAP_IDX {35,36, 43,45}; const std::vector<unsigned int> POSE_BODY_22_MAP_IDX {35,36, 43,45, 37,38, 39,40, 45,46, 47,48, 23,24, 25,26, 27,28, 29,30, 31,32, 33,34, 51,52};
#define POSE_BODY_22_PAIRS_RENDER_GPU {1,2, 1,5} #define POSE_BODY_22_PAIRS_RENDER_GPU {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12}
const std::vector<unsigned int> POSE_BODY_22_PAIRS_RENDER {POSE_BODY_22_PAIRS_RENDER_GPU}; const std::vector<unsigned int> POSE_BODY_22_PAIRS_RENDER {POSE_BODY_22_PAIRS_RENDER_GPU};
const std::vector<unsigned int> POSE_BODY_22_PAIRS {1,2}; const std::vector<unsigned int> POSE_BODY_22_PAIRS {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0};
#define POSE_BODY_22_COLORS_RENDER \ #define POSE_BODY_22_COLORS_RENDER \
255.f, 0.f, 0.f, \ 255.f, 0.f, 0.f, \
255.f, 85.f, 0.f, \ 255.f, 85.f, 0.f, \
......
...@@ -103,7 +103,7 @@ namespace op ...@@ -103,7 +103,7 @@ namespace op
const auto minV = 0.f; const auto minV = 0.f;
const auto maxV = 1.f; const auto maxV = 1.f;
if (minV <= judge && judge <= maxV) if (minV <= judge && judge <= maxV)
addColorWeighted(r, g, b, &rgbColorsPtr[(partPair%numberColors)*3], alphaColorToAdd); addColorWeighted(r, g, b, &rgbColorsPtr[(partB%numberColors)*3], alphaColorToAdd); // Before used partPair vs partB
} }
} }
......
...@@ -41,7 +41,7 @@ namespace op ...@@ -41,7 +41,7 @@ namespace op
// Change w.r.t. other // Change w.r.t. other
if (nB != 0) if (nB != 0)
{ {
if (poseModel == PoseModel::COCO_18) if (poseModel == PoseModel::COCO_18 || poseModel == PoseModel::BODY_22)
{ {
for (auto i = 1; i <= nB; i++) for (auto i = 1; i <= nB; i++)
{ {
...@@ -82,7 +82,7 @@ namespace op ...@@ -82,7 +82,7 @@ namespace op
} }
else if (nA != 0) else if (nA != 0)
{ {
if (poseModel == PoseModel::COCO_18) if (poseModel == PoseModel::COCO_18 || poseModel == PoseModel::BODY_22)
{ {
for (auto i = 1; i <= nA; i++) for (auto i = 1; i <= nA; i++)
{ {
......
...@@ -149,7 +149,8 @@ namespace op ...@@ -149,7 +149,8 @@ namespace op
const auto index2 = (person * numberKeypoints + pairs[pair+1]) * keypoints.getSize(2); const auto index2 = (person * numberKeypoints + pairs[pair+1]) * keypoints.getSize(2);
if (keypoints[index1+2] > threshold && keypoints[index2+2] > threshold) if (keypoints[index1+2] > threshold && keypoints[index2+2] > threshold)
{ {
const auto colorIndex = pair/2*3; // const auto colorIndex = pair/2*3;
const auto colorIndex = pairs[pair+1]*3;
const cv::Scalar color{colors[colorIndex % numberColors], const cv::Scalar color{colors[colorIndex % numberColors],
colors[(colorIndex+1) % numberColors], colors[(colorIndex+1) % numberColors],
colors[(colorIndex+2) % numberColors]}; colors[(colorIndex+2) % numberColors]};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册