Move NormalizedKeypoint to a separate header

PiperOrigin-RevId: 511642586
This commit is contained in:
MediaPipe Team 2023-02-22 17:39:43 -08:00 committed by Copybara-Service
parent 2c3c1e664a
commit ff10f3c814
3 changed files with 31 additions and 13 deletions

View File

@ -16,6 +16,11 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"]) licenses(["notice"])
cc_library(
name = "keypoint",
hdrs = ["keypoint.h"],
)
cc_library( cc_library(
name = "rect", name = "rect",
srcs = ["rect.cc"], srcs = ["rect.cc"],
@ -48,6 +53,7 @@ cc_library(
hdrs = ["detection_result.h"], hdrs = ["detection_result.h"],
deps = [ deps = [
":category", ":category",
":keypoint",
":rect", ":rect",
"//mediapipe/framework/formats:detection_cc_proto", "//mediapipe/framework/formats:detection_cc_proto",
"//mediapipe/framework/formats:location_data_cc_proto", "//mediapipe/framework/formats:location_data_cc_proto",

View File

@ -22,23 +22,11 @@ limitations under the License.
#include "mediapipe/framework/formats/detection.pb.h" #include "mediapipe/framework/formats/detection.pb.h"
#include "mediapipe/tasks/cc/components/containers/category.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" #include "mediapipe/tasks/cc/components/containers/rect.h"
namespace mediapipe::tasks::components::containers { 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<std::string> label;
// optional score of the keypoint.
std::optional<float> score;
};
// Detection for a single bounding box. // Detection for a single bounding box.
struct Detection { struct Detection {
// A vector of detected categories. // A vector of detected categories.

View File

@ -0,0 +1,24 @@
#ifndef MEDIAPIPE_TASKS_CC_COMPONENTS_CONTAINERS_KEYPOINT_H_
#define MEDIAPIPE_TASKS_CC_COMPONENTS_CONTAINERS_KEYPOINT_H_
#include <optional>
#include <string>
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<std::string> label;
// optional score of the keypoint.
std::optional<float> score;
};
} // namespace mediapipe::tasks::components::containers
#endif // MEDIAPIPE_TASKS_CC_COMPONENTS_CONTAINERS_KEYPOINT_H_