diff --git a/mediapipe/tasks/cc/components/containers/BUILD b/mediapipe/tasks/cc/components/containers/BUILD index a7307b2ce..816e3c766 100644 --- a/mediapipe/tasks/cc/components/containers/BUILD +++ b/mediapipe/tasks/cc/components/containers/BUILD @@ -16,6 +16,11 @@ package(default_visibility = ["//visibility:public"]) licenses(["notice"]) +cc_library( + name = "keypoint", + hdrs = ["keypoint.h"], +) + cc_library( name = "rect", srcs = ["rect.cc"], @@ -48,6 +53,7 @@ cc_library( hdrs = ["detection_result.h"], deps = [ ":category", + ":keypoint", ":rect", "//mediapipe/framework/formats:detection_cc_proto", "//mediapipe/framework/formats:location_data_cc_proto", diff --git a/mediapipe/tasks/cc/components/containers/detection_result.h b/mediapipe/tasks/cc/components/containers/detection_result.h index 9ea2a547c..cfddfdb00 100644 --- a/mediapipe/tasks/cc/components/containers/detection_result.h +++ b/mediapipe/tasks/cc/components/containers/detection_result.h @@ -22,23 +22,11 @@ limitations under the License. #include "mediapipe/framework/formats/detection.pb.h" #include "mediapipe/tasks/cc/components/containers/category.h" +#include "mediapipe/tasks/cc/components/containers/keypoint.h" #include "mediapipe/tasks/cc/components/containers/rect.h" namespace mediapipe::tasks::components::containers { -// A keypoint, defined by the coordinates (x, y), normalized -// by the image dimensions. -struct NormalizedKeypoint { - // x in normalized image coordinates. - float x; - // y in normalized image coordinates. - float y; - // optional label of the keypoint. - std::optional label; - // optional score of the keypoint. - std::optional score; -}; - // Detection for a single bounding box. struct Detection { // A vector of detected categories. diff --git a/mediapipe/tasks/cc/components/containers/keypoint.h b/mediapipe/tasks/cc/components/containers/keypoint.h new file mode 100644 index 000000000..5341b9c73 --- /dev/null +++ b/mediapipe/tasks/cc/components/containers/keypoint.h @@ -0,0 +1,24 @@ +#ifndef MEDIAPIPE_TASKS_CC_COMPONENTS_CONTAINERS_KEYPOINT_H_ +#define MEDIAPIPE_TASKS_CC_COMPONENTS_CONTAINERS_KEYPOINT_H_ + +#include +#include + +namespace mediapipe::tasks::components::containers { + +// A keypoint, defined by the coordinates (x, y), normalized +// by the image dimensions. +struct NormalizedKeypoint { + // x in normalized image coordinates. + float x; + // y in normalized image coordinates. + float y; + // optional label of the keypoint. + std::optional label; + // optional score of the keypoint. + std::optional score; +}; + +} // namespace mediapipe::tasks::components::containers + +#endif // MEDIAPIPE_TASKS_CC_COMPONENTS_CONTAINERS_KEYPOINT_H_