Skip to content
Permalink
Browse files

Project import generated by Copybara.

GitOrigin-RevId: d91373b4d4d10abef49cab410caa6aadf0875049
  • Loading branch information
MediaPipe Team mgyong
MediaPipe Team authored and mgyong committed Dec 6, 2019
1 parent 137867d commit d16cc3be5bbf8ef78edbc963f2ca7f397e2d5887
Showing with 41,548 additions and 31 deletions.
  1. +3 −0 .bazelrc
  2. +2 −0 Dockerfile
  3. +2 −1 README.md
  4. +22 −0 WORKSPACE
  5. +4 −0 mediapipe/MediaPipe.tulsiproj/Configs/MediaPipe.tulsigen
  6. +1 −0 mediapipe/MediaPipe.tulsiproj/project.tulsiconf
  7. +1 −0 mediapipe/calculators/core/BUILD
  8. +40 −3 mediapipe/calculators/core/add_header_calculator.cc
  9. +61 −1 mediapipe/calculators/core/add_header_calculator_test.cc
  10. +20 −15 mediapipe/calculators/core/packet_resampler_calculator.cc
  11. +5 −2 mediapipe/calculators/image/image_cropping_calculator.cc
  12. +28 −0 mediapipe/calculators/util/BUILD
  13. +110 −0 mediapipe/calculators/util/detection_unique_id_calculator.cc
  14. +13 −3 mediapipe/calculators/util/detections_to_render_data_calculator.cc
  15. +3 −0 mediapipe/calculators/util/detections_to_render_data_calculator.proto
  16. +110 −0 mediapipe/calculators/util/detections_to_timed_box_list_calculator.cc
  17. +210 −0 mediapipe/calculators/video/BUILD
  18. +1,271 −0 mediapipe/calculators/video/box_tracker_calculator.cc
  19. +55 −0 mediapipe/calculators/video/box_tracker_calculator.proto
  20. +281 −0 mediapipe/calculators/video/flow_packager_calculator.cc
  21. +36 −0 mediapipe/calculators/video/flow_packager_calculator.proto
  22. +988 −0 mediapipe/calculators/video/motion_analysis_calculator.cc
  23. +111 −0 mediapipe/calculators/video/motion_analysis_calculator.proto
  24. BIN mediapipe/calculators/video/testdata/lenna.png
  25. +134 −0 mediapipe/calculators/video/testdata/parallel_tracker_graph.pbtxt
  26. +122 −0 mediapipe/calculators/video/testdata/tracker_graph.pbtxt
  27. +319 −0 mediapipe/calculators/video/tracked_detection_manager_calculator.cc
  28. +709 −0 mediapipe/calculators/video/tracking_graph_test.cc
  29. +5 −0 mediapipe/docs/examples.md
  30. BIN mediapipe/docs/images/mobile/box_tracking_subgraph.png
  31. BIN mediapipe/docs/images/mobile/object_detection_gpu_subgraph.png
  32. BIN mediapipe/docs/images/mobile/object_tracking_android_gpu.gif
  33. BIN mediapipe/docs/images/mobile/object_tracking_android_gpu_small.gif
  34. BIN mediapipe/docs/images/mobile/object_tracking_mobile_gpu.png
  35. BIN mediapipe/docs/images/mobile/object_tracking_renderer_gpu_subgraph.png
  36. BIN mediapipe/docs/images/mobile/object_tracking_subgraph.png
  37. +2 −0 mediapipe/docs/install.md
  38. +475 −0 mediapipe/docs/object_tracking_mobile_gpu.md
  39. +33 −0 mediapipe/examples/android/src/java/com/google/mediapipe/apps/objecttrackinggpu/AndroidManifest.xml
  40. +81 −0 mediapipe/examples/android/src/java/com/google/mediapipe/apps/objecttrackinggpu/BUILD
  41. +167 −0 mediapipe/examples/android/src/java/com/google/mediapipe/apps/objecttrackinggpu/MainActivity.java
  42. +20 −0 ...xamples/android/src/java/com/google/mediapipe/apps/objecttrackinggpu/res/layout/activity_main.xml
  43. +6 −0 ...apipe/examples/android/src/java/com/google/mediapipe/apps/objecttrackinggpu/res/values/colors.xml
  44. +4 −0 ...pipe/examples/android/src/java/com/google/mediapipe/apps/objecttrackinggpu/res/values/strings.xml
  45. +11 −0 ...apipe/examples/android/src/java/com/google/mediapipe/apps/objecttrackinggpu/res/values/styles.xml
  46. +3 −3 mediapipe/examples/desktop/media_sequence/kinetics_dataset.py
  47. +85 −0 mediapipe/framework/calculator_graph_event_loop_test.cc
  48. +18 −3 mediapipe/framework/formats/BUILD
  49. +1 −0 mediapipe/framework/port/BUILD
  50. +44 −0 mediapipe/framework/port/logging.h
  51. +176 −0 mediapipe/graphs/object_detection/object_detection_desktop_lstd_tflite_graph.pbtxt
  52. +39 −0 mediapipe/graphs/tracking/BUILD
  53. +46 −0 mediapipe/graphs/tracking/object_detection_tracking_mobile_gpu.pbtxt
  54. +76 −0 mediapipe/graphs/tracking/subgraphs/BUILD
  55. +126 −0 mediapipe/graphs/tracking/subgraphs/box_tracking.pbtxt
  56. +128 −0 mediapipe/graphs/tracking/subgraphs/object_detection_gpu.pbtxt
  57. +56 −0 mediapipe/graphs/tracking/subgraphs/object_tracking.pbtxt
  58. +29 −0 mediapipe/graphs/tracking/subgraphs/renderer_gpu.pbtxt
  59. +12 −0 mediapipe/java/com/google/mediapipe/framework/MediaPipeRunner.java
  60. +742 −0 mediapipe/util/tracking/BUILD
  61. +2 −0 mediapipe/util/tracking/OWNERS
  62. +1,062 −0 mediapipe/util/tracking/box_tracker.cc
  63. +372 −0 mediapipe/util/tracking/box_tracker.h
  64. +87 −0 mediapipe/util/tracking/box_tracker.proto
  65. +117 −0 mediapipe/util/tracking/box_tracker_test.cc
  66. +408 −0 mediapipe/util/tracking/camera_motion.cc
  67. +336 −0 mediapipe/util/tracking/camera_motion.h
  68. +198 −0 mediapipe/util/tracking/camera_motion.proto
  69. +1,023 −0 mediapipe/util/tracking/flow_packager.cc
  70. +168 −0 mediapipe/util/tracking/flow_packager.h
  71. +319 −0 mediapipe/util/tracking/flow_packager.proto
  72. +93 −0 mediapipe/util/tracking/frame_selection.proto
  73. +27 −0 mediapipe/util/tracking/frame_selection_solution_evaluator.proto
  74. +116 −0 mediapipe/util/tracking/image_util.cc
  75. +192 −0 mediapipe/util/tracking/image_util.h
  76. +93 −0 mediapipe/util/tracking/image_util_test.cc
  77. +22 −0 mediapipe/util/tracking/measure_time.cc
  78. +169 −0 mediapipe/util/tracking/measure_time.h
  79. +850 −0 mediapipe/util/tracking/motion_analysis.cc
  80. +229 −0 mediapipe/util/tracking/motion_analysis.h
  81. +154 −0 mediapipe/util/tracking/motion_analysis.proto
  82. +6,009 −0 mediapipe/util/tracking/motion_estimation.cc
  83. +758 −0 mediapipe/util/tracking/motion_estimation.h
  84. +670 −0 mediapipe/util/tracking/motion_estimation.proto
  85. +924 −0 mediapipe/util/tracking/motion_models.cc
  86. +1,849 −0 mediapipe/util/tracking/motion_models.h
  87. +122 −0 mediapipe/util/tracking/motion_models.proto
  88. +57 −0 mediapipe/util/tracking/motion_models_cv.cc
  89. +63 −0 mediapipe/util/tracking/motion_models_cv.h
  90. +335 −0 mediapipe/util/tracking/motion_models_test.cc
  91. +700 −0 mediapipe/util/tracking/motion_saliency.cc
  92. +150 −0 mediapipe/util/tracking/motion_saliency.h
  93. +71 −0 mediapipe/util/tracking/motion_saliency.proto
  94. +36 −0 mediapipe/util/tracking/parallel_invoker.cc
  95. +507 −0 mediapipe/util/tracking/parallel_invoker.h
  96. +28 −0 mediapipe/util/tracking/parallel_invoker_forbid_mixed.cc
  97. +60 −0 mediapipe/util/tracking/parallel_invoker_test.cc
  98. +1,296 −0 mediapipe/util/tracking/push_pull_filtering.h
  99. +39 −0 mediapipe/util/tracking/push_pull_filtering.proto
  100. +799 −0 mediapipe/util/tracking/region_flow.cc
  101. +636 −0 mediapipe/util/tracking/region_flow.h
  102. +295 −0 mediapipe/util/tracking/region_flow.proto
  103. +3,560 −0 mediapipe/util/tracking/region_flow_computation.cc
  104. +463 −0 mediapipe/util/tracking/region_flow_computation.h
  105. +576 −0 mediapipe/util/tracking/region_flow_computation.proto
  106. +304 −0 mediapipe/util/tracking/region_flow_computation_test.cc
  107. +196 −0 mediapipe/util/tracking/region_flow_visualization.cc
  108. +78 −0 mediapipe/util/tracking/region_flow_visualization.h
  109. +149 −0 mediapipe/util/tracking/streaming_buffer.cc
  110. +519 −0 mediapipe/util/tracking/streaming_buffer.h
  111. BIN mediapipe/util/tracking/testdata/box_tracker/chunk_0000
  112. BIN mediapipe/util/tracking/testdata/box_tracker/chunk_0001
  113. BIN mediapipe/util/tracking/testdata/box_tracker/chunk_0002
  114. BIN mediapipe/util/tracking/testdata/box_tracker/chunk_0003
  115. BIN mediapipe/util/tracking/testdata/box_tracker/chunk_0004
  116. BIN mediapipe/util/tracking/testdata/box_tracker/chunk_0005
  117. BIN mediapipe/util/tracking/testdata/box_tracker/chunk_0006
  118. BIN mediapipe/util/tracking/testdata/stabilize_test.png
  119. +377 −0 mediapipe/util/tracking/tone_estimation.cc
  120. +409 −0 mediapipe/util/tracking/tone_estimation.h
  121. +196 −0 mediapipe/util/tracking/tone_estimation.proto
  122. +144 −0 mediapipe/util/tracking/tone_models.cc
  123. +628 −0 mediapipe/util/tracking/tone_models.h
  124. +64 −0 mediapipe/util/tracking/tone_models.proto
  125. +144 −0 mediapipe/util/tracking/tracked_detection.cc
  126. +127 −0 mediapipe/util/tracking/tracked_detection.h
  127. +191 −0 mediapipe/util/tracking/tracked_detection_manager.cc
  128. +82 −0 mediapipe/util/tracking/tracked_detection_manager.h
  129. +109 −0 mediapipe/util/tracking/tracked_detection_test.cc
  130. +3,386 −0 mediapipe/util/tracking/tracking.cc
  131. +643 −0 mediapipe/util/tracking/tracking.h
  132. +415 −0 mediapipe/util/tracking/tracking.proto
  133. +224 −0 mediapipe/util/tracking/tracking_visualization_utilities.cc
  134. +43 −0 mediapipe/util/tracking/tracking_visualization_utilities.h
  135. +14 −0 third_party/ceres_solver_9bf9588988236279e1262f75d7f4d85711dfa172.diff
  136. +1 −0 third_party/opencv_linux.BUILD
  137. +19 −0 third_party/org_tensorflow_e3a7bdbebb99352351a19e2e403136166aa52934.diff
@@ -19,6 +19,9 @@ build --incompatible_depset_is_not_iterable=false
# Sets the default Apple platform to macOS.
build --apple_platform_type=macos

# Allow debugging with XCODE
build --apple_generate_dsym

# Android configs.
build:android --crosstool_top=//external:android/crosstool
build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
@@ -35,6 +35,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libopencv-highgui-dev \
libopencv-imgproc-dev \
libopencv-video-dev \
libopencv-calib3d-dev \
libopencv-features2d-dev \
software-properties-common && \
add-apt-repository -y ppa:openjdk-r/ppa && \
apt-get update && apt-get install -y openjdk-8-jdk && \
@@ -14,12 +14,13 @@
* [Face Detection](mediapipe/docs/face_detection_mobile_gpu.md)
* [Hair Segmentation](mediapipe/docs/hair_segmentation_mobile_gpu.md)
* [Object Detection](mediapipe/docs/object_detection_mobile_gpu.md)
* [Object Detection and Tracking](mediapipe/docs/object_tracking_mobile_gpu.md)

![hand_tracking](mediapipe/docs/images/mobile/hand_tracking_3d_android_gpu_small.gif)
![multi-hand_tracking](mediapipe/docs/images/mobile/multi_hand_tracking_android_gpu_small.gif)
![face_detection](mediapipe/docs/images/mobile/face_detection_android_gpu_small.gif)
![hair_segmentation](mediapipe/docs/images/mobile/hair_segmentation_android_gpu_small.gif)
![object_detection](mediapipe/docs/images/mobile/object_detection_android_gpu_small.gif)
![object_tracking](mediapipe/docs/images/mobile/object_tracking_android_gpu_small.gif)

## Installation
Follow these [instructions](mediapipe/docs/install.md).
@@ -116,15 +116,36 @@ http_archive(
"https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT,
"https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT,
],
# Patch https://github.com/tensorflow/tensorflow/commit/e3a7bdbebb99352351a19e2e403136166aa52934
patches = [
"@//third_party:org_tensorflow_e3a7bdbebb99352351a19e2e403136166aa52934.diff"
],
patch_args = [
"-p1",
],
strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT,
sha256 = _TENSORFLOW_SHA256,
)

load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
tf_workspace(tf_repo_name = "org_tensorflow")

http_archive(
name = "ceres_solver",
url = "https://github.com/ceres-solver/ceres-solver/archive/1.14.0.zip",
patches = [
"@//third_party:ceres_solver_9bf9588988236279e1262f75d7f4d85711dfa172.diff"
],
patch_args = [
"-p1",
],
strip_prefix = "ceres-solver-1.14.0",
sha256 = "5ba6d0db4e784621fda44a50c58bb23b0892684692f0c623e2063f9c19f192f1"
)

# Please run
# $ sudo apt-get install libopencv-core-dev libopencv-highgui-dev \
# libopencv-calib3d-dev libopencv-features2d-dev \
# libopencv-imgproc-dev libopencv-video-dev
new_local_repository(
name = "linux_opencv",
@@ -292,3 +313,4 @@ http_archive(
strip_prefix = "google-toolbox-for-mac-2.2.1",
build_file = "@//third_party:google_toolbox_for_mac.BUILD",
)

@@ -9,6 +9,7 @@
"mediapipe/examples/ios/facedetectiongpu/BUILD",
"mediapipe/examples/ios/handdetectiongpu/BUILD",
"mediapipe/examples/ios/handtrackinggpu/BUILD",
"mediapipe/examples/ios/multihandtrackinggpu/BUILD",
"mediapipe/examples/ios/objectdetectioncpu/BUILD",
"mediapipe/examples/ios/objectdetectiongpu/BUILD"
],
@@ -18,6 +19,7 @@
"//mediapipe/examples/ios/facedetectiongpu:FaceDetectionGpuApp",
"//mediapipe/examples/ios/handdetectiongpu:HandDetectionGpuApp",
"//mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp",
"//mediapipe/examples/ios/multihandtrackinggpu:MultiHandTrackingGpuApp",
"//mediapipe/examples/ios/objectdetectioncpu:ObjectDetectionCpuApp",
"//mediapipe/examples/ios/objectdetectiongpu:ObjectDetectionGpuApp",
"//mediapipe/objc:mediapipe_framework_ios"
@@ -84,6 +86,8 @@
"mediapipe/examples/ios/handdetectiongpu/Base.lproj",
"mediapipe/examples/ios/handtrackinggpu",
"mediapipe/examples/ios/handtrackinggpu/Base.lproj",
"mediapipe/examples/ios/multihandtrackinggpu",
"mediapipe/examples/ios/multihandtrackinggpu/Base.lproj",
"mediapipe/examples/ios/objectdetectioncpu",
"mediapipe/examples/ios/objectdetectioncpu/Base.lproj",
"mediapipe/examples/ios/objectdetectiongpu",
@@ -16,6 +16,7 @@
"mediapipe/examples/ios/facedetectiongpu",
"mediapipe/examples/ios/handdetectiongpu",
"mediapipe/examples/ios/handtrackinggpu",
"mediapipe/examples/ios/multihandtrackinggpu",
"mediapipe/examples/ios/objectdetectioncpu",
"mediapipe/examples/ios/objectdetectiongpu"
],
@@ -165,6 +165,7 @@ cc_library(
deps = [
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:status",
],
alwayslink = 1,
)
@@ -13,29 +13,66 @@
// limitations under the License.

#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/canonical_errors.h"
#include "mediapipe/framework/port/logging.h"

namespace mediapipe {

// Attach the header from one stream to another stream.
// Attach the header from a stream or side input to another stream.
//
// The header stream (tag HEADER) must not have any packets in it.
//
// Before using this calculator, please think about changing your
// calculator to not need a header or to accept a separate stream with
// a header, that would be more future proof.
//
// Example usage 1:
// node {
// calculator: "AddHeaderCalculator"
// input_stream: "DATA:audio"
// input_stream: "HEADER:audio_header"
// output_stream: "audio_with_header"
// }
//
// Example usage 2:
// node {
// calculator: "AddHeaderCalculator"
// input_stream: "DATA:audio"
// input_side_packet: "HEADER:audio_header"
// output_stream: "audio_with_header"
// }
//
class AddHeaderCalculator : public CalculatorBase {
public:
static ::mediapipe::Status GetContract(CalculatorContract* cc) {
cc->Inputs().Tag("HEADER").SetNone();
bool has_side_input = false;
bool has_header_stream = false;
if (cc->InputSidePackets().HasTag("HEADER")) {
cc->InputSidePackets().Tag("HEADER").SetAny();
has_side_input = true;
}
if (cc->Inputs().HasTag("HEADER")) {
cc->Inputs().Tag("HEADER").SetNone();
has_header_stream = true;
}
if (has_side_input == has_header_stream) {
return mediapipe::InvalidArgumentError(
"Header must be provided via exactly one of side input and input "
"stream");
}
cc->Inputs().Tag("DATA").SetAny();
cc->Outputs().Index(0).SetSameAs(&cc->Inputs().Tag("DATA"));
return ::mediapipe::OkStatus();
}

::mediapipe::Status Open(CalculatorContext* cc) override {
const Packet& header = cc->Inputs().Tag("HEADER").Header();
Packet header;
if (cc->InputSidePackets().HasTag("HEADER")) {
header = cc->InputSidePackets().Tag("HEADER");
}
if (cc->Inputs().HasTag("HEADER")) {
header = cc->Inputs().Tag("HEADER").Header();
}
if (!header.IsEmpty()) {
cc->Outputs().Index(0).SetHeader(header);
}
@@ -14,8 +14,10 @@

#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/calculator_runner.h"
#include "mediapipe/framework/port/canonical_errors.h"
#include "mediapipe/framework/port/gmock.h"
#include "mediapipe/framework/port/gtest.h"
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_matchers.h"
#include "mediapipe/framework/timestamp.h"
#include "mediapipe/framework/tool/validate_type.h"
@@ -24,7 +26,7 @@ namespace mediapipe {

class AddHeaderCalculatorTest : public ::testing::Test {};

TEST_F(AddHeaderCalculatorTest, Works) {
TEST_F(AddHeaderCalculatorTest, HeaderStream) {
CalculatorGraphConfig::Node node;
node.set_calculator("AddHeaderCalculator");
node.add_input_stream("HEADER:header_stream");
@@ -96,4 +98,62 @@ TEST_F(AddHeaderCalculatorTest, NoPacketsOnHeaderStream) {
ASSERT_FALSE(runner.Run().ok());
}

TEST_F(AddHeaderCalculatorTest, InputSidePacket) {
CalculatorGraphConfig::Node node;
node.set_calculator("AddHeaderCalculator");
node.add_input_stream("DATA:data_stream");
node.add_output_stream("merged_stream");
node.add_input_side_packet("HEADER:header");

CalculatorRunner runner(node);

// Set header and add 5 packets.
runner.MutableSidePackets()->Tag("HEADER") =
Adopt(new std::string("my_header"));
for (int i = 0; i < 5; ++i) {
Packet packet = Adopt(new int(i)).At(Timestamp(i * 1000));
runner.MutableInputs()->Tag("DATA").packets.push_back(packet);
}

// Run calculator.
MP_ASSERT_OK(runner.Run());

ASSERT_EQ(1, runner.Outputs().NumEntries());

// Test output.
EXPECT_EQ(std::string("my_header"),
runner.Outputs().Index(0).header.Get<std::string>());
const std::vector<Packet>& output_packets = runner.Outputs().Index(0).packets;
ASSERT_EQ(5, output_packets.size());
for (int i = 0; i < 5; ++i) {
const int val = output_packets[i].Get<int>();
EXPECT_EQ(i, val);
EXPECT_EQ(Timestamp(i * 1000), output_packets[i].Timestamp());
}
}

TEST_F(AddHeaderCalculatorTest, UsingBothSideInputAndStream) {
CalculatorGraphConfig::Node node;
node.set_calculator("AddHeaderCalculator");
node.add_input_stream("HEADER:header_stream");
node.add_input_stream("DATA:data_stream");
node.add_output_stream("merged_stream");
node.add_input_side_packet("HEADER:header");

CalculatorRunner runner(node);

// Set both headers and add 5 packets.
runner.MutableSidePackets()->Tag("HEADER") =
Adopt(new std::string("my_header"));
runner.MutableSidePackets()->Tag("HEADER") =
Adopt(new std::string("my_header"));
for (int i = 0; i < 5; ++i) {
Packet packet = Adopt(new int(i)).At(Timestamp(i * 1000));
runner.MutableInputs()->Tag("DATA").packets.push_back(packet);
}

// Run should fail because header can only be provided one way.
EXPECT_EQ(runner.Run().code(), ::mediapipe::InvalidArgumentError("").code());
}

} // namespace mediapipe
@@ -330,22 +330,27 @@ ::mediapipe::Status PacketResamplerCalculator::ProcessWithJitter(
return ::mediapipe::OkStatus();
}

LOG_IF(WARNING, frame_time_usec_ <
(cc->InputTimestamp() - last_packet_.Timestamp()).Value())
<< "Adding jitter is meaningless when upsampling.";

const int64 curr_diff =
(next_output_timestamp_ - cc->InputTimestamp()).Value();
const int64 last_diff =
(next_output_timestamp_ - last_packet_.Timestamp()).Value();
if (curr_diff * last_diff > 0) {
return ::mediapipe::OkStatus();
if (frame_time_usec_ <
(cc->InputTimestamp() - last_packet_.Timestamp()).Value()) {
LOG_FIRST_N(WARNING, 2)
<< "Adding jitter is not very useful when upsampling.";
}

while (true) {
const int64 last_diff =
(next_output_timestamp_ - last_packet_.Timestamp()).Value();
RET_CHECK_GT(last_diff, 0.0);
const int64 curr_diff =
(next_output_timestamp_ - cc->InputTimestamp()).Value();
if (curr_diff > 0.0) {
break;
}
OutputWithinLimits(cc, (std::abs(curr_diff) > last_diff
? last_packet_
: cc->Inputs().Get(input_data_id_).Value())
.At(next_output_timestamp_));
UpdateNextOutputTimestampWithJitter();
}
OutputWithinLimits(cc, (std::abs(curr_diff) > std::abs(last_diff)
? last_packet_
: cc->Inputs().Get(input_data_id_).Value())
.At(next_output_timestamp_));
UpdateNextOutputTimestampWithJitter();
return ::mediapipe::OkStatus();
}

@@ -501,8 +501,11 @@ void ImageCroppingCalculator::GetOutputDimensions(CalculatorContext* cc,
row_max = std::max(row_max, transformed_points_[i * 2 + 1]);
}

*dst_width = std::round((col_max - col_min) * src_width);
*dst_height = std::round((row_max - row_min) * src_height);
int width = static_cast<int>(std::round((col_max - col_min) * src_width));
int height = static_cast<int>(std::round((row_max - row_min) * src_height));
// Minimum output dimension 1x1 prevents creation of textures with 0x0.
*dst_width = std::max(1, width);
*dst_height = std::max(1, height);
}

} // namespace mediapipe
@@ -983,3 +983,31 @@ cc_test(
"//mediapipe/framework/port:parse_text_proto",
],
)

cc_library(
name = "detections_to_timed_box_list_calculator",
srcs = ["detections_to_timed_box_list_calculator.cc"],
visibility = ["//visibility:public"],
deps = [
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/formats:detection_cc_proto",
"//mediapipe/framework/formats:location_data_cc_proto",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"//mediapipe/util/tracking:box_tracker",
],
alwayslink = 1,
)

cc_library(
name = "detection_unique_id_calculator",
srcs = ["detection_unique_id_calculator.cc"],
visibility = ["//visibility:public"],
deps = [
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/formats:detection_cc_proto",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
],
alwayslink = 1,
)

0 comments on commit d16cc3b

Please sign in to comment.
You can’t perform that action at this time.