Add coco-wholebody-hand skeleton ()

* update

* update
pull/1988/merge
huangjiyi 2023-06-15 13:53:25 +08:00 committed by GitHub
parent 264de4ddbc
commit 90f17f2e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions
demo/csrc/cpp

View File

@ -18,7 +18,7 @@ DEFINE_int32(flip, 0, "Set to 1 for flipping the input horizontally");
DEFINE_int32(show, 1, "Delay passed to `cv::waitKey` when using `cv::imshow`; -1: disable");
DEFINE_string(skeleton, "coco",
R"(Path to skeleton data or name of predefined skeletons: "coco", "coco-wholebody")");
R"(Path to skeleton data or name of predefined skeletons: "coco", "coco-wholebody", "coco-wholebody-hand")");
DEFINE_string(background, "default",
R"(Output background, "default": original image, "black": black background)");

View File

@ -73,6 +73,25 @@ const Skeleton& gSkeletonCocoWholeBody() {
return inst;
}
const Skeleton& gSkeletonCocoWholeBodyHand() {
static const Skeleton inst{
{
{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},
},
{
{255, 255, 255}, {255, 128, 0}, {255, 153, 255},
{102, 178, 255}, {255, 51, 51}, {0, 255, 0},
},
{1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5,},
{0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5,},
};
return inst;
}
// n_links
// u0, v0, u1, v1, ..., un-1, vn-1
// n_palette
@ -86,6 +105,8 @@ inline Skeleton Skeleton::get(const std::string& path) {
return gSkeletonCoco();
} else if (path == "coco-wholebody") {
return gSkeletonCocoWholeBody();
} else if (path == "coco-wholebody-hand") {
return gSkeletonCocoWholeBodyHand();
}
std::ifstream ifs(path);
if (!ifs.is_open()) {