From 98d493f37a2ba1f651aba9fa41e9be110f6ee3cc Mon Sep 17 00:00:00 2001 From: Jiuqiang Tang Date: Thu, 22 Jun 2023 11:24:00 -0700 Subject: [PATCH] Add MatrixData as a packet option for ConstantSidePacketCalculatorOptions. PiperOrigin-RevId: 542616847 --- mediapipe/calculators/core/BUILD | 2 ++ .../calculators/core/constant_side_packet_calculator.cc | 5 +++++ .../calculators/core/constant_side_packet_calculator.proto | 2 ++ 3 files changed, 9 insertions(+) diff --git a/mediapipe/calculators/core/BUILD b/mediapipe/calculators/core/BUILD index a425b7e38..99a63f633 100644 --- a/mediapipe/calculators/core/BUILD +++ b/mediapipe/calculators/core/BUILD @@ -117,6 +117,7 @@ mediapipe_proto_library( "//mediapipe/framework:calculator_proto", "//mediapipe/framework/formats:classification_proto", "//mediapipe/framework/formats:landmark_proto", + "//mediapipe/framework/formats:matrix_data_proto", "//mediapipe/framework/formats:time_series_header_proto", ], ) @@ -1168,6 +1169,7 @@ cc_library( "//mediapipe/framework:collection_item_id", "//mediapipe/framework/formats:classification_cc_proto", "//mediapipe/framework/formats:landmark_cc_proto", + "//mediapipe/framework/formats:matrix_data_cc_proto", "//mediapipe/framework/formats:time_series_header_cc_proto", "//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:ret_check", diff --git a/mediapipe/calculators/core/constant_side_packet_calculator.cc b/mediapipe/calculators/core/constant_side_packet_calculator.cc index 0bcf22ec9..8762c9874 100644 --- a/mediapipe/calculators/core/constant_side_packet_calculator.cc +++ b/mediapipe/calculators/core/constant_side_packet_calculator.cc @@ -19,6 +19,7 @@ #include "mediapipe/framework/collection_item_id.h" #include "mediapipe/framework/formats/classification.pb.h" #include "mediapipe/framework/formats/landmark.pb.h" +#include "mediapipe/framework/formats/matrix_data.pb.h" #include "mediapipe/framework/formats/time_series_header.pb.h" #include "mediapipe/framework/port/canonical_errors.h" #include "mediapipe/framework/port/integral_types.h" @@ -85,6 +86,8 @@ class ConstantSidePacketCalculator : public CalculatorBase { packet.Set(); } else if (packet_options.has_double_value()) { packet.Set(); + } else if (packet_options.has_matrix_data_value()) { + packet.Set(); } else if (packet_options.has_time_series_header_value()) { packet.Set(); } else if (packet_options.has_int64_value()) { @@ -123,6 +126,8 @@ class ConstantSidePacketCalculator : public CalculatorBase { MakePacket(packet_options.landmark_list_value())); } else if (packet_options.has_double_value()) { packet.Set(MakePacket(packet_options.double_value())); + } else if (packet_options.has_matrix_data_value()) { + packet.Set(MakePacket(packet_options.matrix_data_value())); } else if (packet_options.has_time_series_header_value()) { packet.Set(MakePacket( packet_options.time_series_header_value())); diff --git a/mediapipe/calculators/core/constant_side_packet_calculator.proto b/mediapipe/calculators/core/constant_side_packet_calculator.proto index bce827055..0d53175fc 100644 --- a/mediapipe/calculators/core/constant_side_packet_calculator.proto +++ b/mediapipe/calculators/core/constant_side_packet_calculator.proto @@ -19,6 +19,7 @@ package mediapipe; import "mediapipe/framework/calculator.proto"; import "mediapipe/framework/formats/classification.proto"; import "mediapipe/framework/formats/landmark.proto"; +import "mediapipe/framework/formats/matrix_data.proto"; import "mediapipe/framework/formats/time_series_header.proto"; message ConstantSidePacketCalculatorOptions { @@ -38,6 +39,7 @@ message ConstantSidePacketCalculatorOptions { ClassificationList classification_list_value = 6; LandmarkList landmark_list_value = 7; TimeSeriesHeader time_series_header_value = 10; + MatrixData matrix_data_value = 12; } }