Project import generated by Copybara.

GitOrigin-RevId: e9b30181bd6a75481835643d6f48c1c05730ff87
This commit is contained in:
MediaPipe Team 2020-08-05 21:13:15 -04:00 committed by chuoling
parent 2f86a459b6
commit 6b0ab0e012
7 changed files with 37 additions and 13 deletions

View File

@ -402,7 +402,6 @@ node {
The diagram below shows how the `PacketClonerCalculator` defines its output The diagram below shows how the `PacketClonerCalculator` defines its output
packets (bottom) based on its series of input packets (top). packets (bottom) based on its series of input packets (top).
| ![Graph using | | ![Graph using PacketClonerCalculator](../images/packet_cloner_calculator.png) |
: PacketClonerCalculator](../images/packet_cloner_calculator.png) : | :---------------------------------------------------------------------------: |
| :--------------------------------------------------------------------------: |
| *Each time it receives a packet on its TICK input stream, the PacketClonerCalculator outputs the most recent packet from each of its input streams. The sequence of output packets (bottom) is determined by the sequence of input packets (top) and their timestamps. The timestamps are shown along the right side of the diagram.* | | *Each time it receives a packet on its TICK input stream, the PacketClonerCalculator outputs the most recent packet from each of its input streams. The sequence of output packets (bottom) is determined by the sequence of input packets (top) and their timestamps. The timestamps are shown along the right side of the diagram.* |

View File

@ -20,7 +20,7 @@ Packets are generally created with `MediaPipe::Adopt()` (from packet.h).
```c++ ```c++
// Create some data. // Create some data.
auto data = gtl::MakeUnique<MyDataClass>("constructor_argument"); auto data = absl::make_unique<MyDataClass>("constructor_argument");
// Create a packet to own the data. // Create a packet to own the data.
Packet p = Adopt(data.release()); Packet p = Adopt(data.release());
// Make a new packet with the same data and a different timestamp. // Make a new packet with the same data and a different timestamp.

View File

@ -76,7 +76,7 @@ to visualize its associated subgraphs, please see
### Face Detection Model ### Face Detection Model
The face detector is the same [bazelFace](https://arxiv.org/abs/1907.05047) The face detector is the same [BlazeFace](https://arxiv.org/abs/1907.05047)
model used in [MediaPipe Face Detection](./face_detection.md). model used in [MediaPipe Face Detection](./face_detection.md).
### Face Landmark Model ### Face Landmark Model

View File

@ -144,11 +144,9 @@ namespace autoflip {
// renderer. // renderer.
for (int i = 0; i < num_scene_frames; i++) { for (int i = 0; i < num_scene_frames; i++) {
const int left = -(scene_frame_xforms[i].at<float>(0, 2)); const int left = -(scene_frame_xforms[i].at<float>(0, 2));
const int right = left + crop_width; const int top =
const int top = top_static_border_size; top_static_border_size - (scene_frame_xforms[i].at<float>(1, 2));
const int bottom = frame_height_ - bottom_static_border_size; crop_from_location->push_back(cv::Rect(left, top, crop_width, crop_height));
crop_from_location->push_back(
cv::Rect(left, top, right - left, bottom - top));
} }
// If no cropped_frames is passed in, return directly. // If no cropped_frames is passed in, return directly.

View File

@ -201,5 +201,29 @@ TEST(SceneCropperTest, CropFramesWorksWithPriorFocusPointFrames) {
} }
} }
// Checks that crop_from_locations gets the correct results.
TEST(SceneCropperTest, CropFromLocation) {
CameraMotionOptions options;
options.mutable_polynomial_path_solver()->set_prior_frame_buffer_size(30);
SceneCropper scene_cropper(options, kSceneWidth, kSceneHeight);
std::vector<cv::Mat> cropped_frames;
std::vector<cv::Rect> crop_from_locations;
const auto& scene_frames = GetDefaultSceneFrames();
MP_EXPECT_OK(scene_cropper.CropFrames(
GetDefaultSceneKeyFrameCropSummary(), GetTimestamps(scene_frames.size()),
GetIsKeyframe(scene_frames.size()), scene_frames,
GetDefaultFocusPointFrames(), GetFocusPointFrames(3), 0, 0, false,
&crop_from_locations, &cropped_frames));
EXPECT_EQ(cropped_frames.size(), kNumSceneFrames);
for (int i = 0; i < kNumSceneFrames; ++i) {
EXPECT_EQ(cropped_frames[i].rows, kCropHeight);
EXPECT_EQ(cropped_frames[i].cols, kCropWidth);
}
for (int i = 0; i < kNumSceneFrames; ++i) {
EXPECT_EQ(crop_from_locations[i].height, kCropHeight);
EXPECT_EQ(crop_from_locations[i].width, kCropWidth);
}
}
} // namespace autoflip } // namespace autoflip
} // namespace mediapipe } // namespace mediapipe

View File

@ -155,7 +155,7 @@ class OutputStreamHandler {
// TODO: Rename the variable to be more descriptive. // TODO: Rename the variable to be more descriptive.
Timestamp task_timestamp_bound_ ABSL_GUARDED_BY(timestamp_mutex_); Timestamp task_timestamp_bound_ ABSL_GUARDED_BY(timestamp_mutex_);
// PropagateionState indicates the current state of the propagation process. // PropagationState indicates the current state of the propagation process.
// There are eight possible transitions: // There are eight possible transitions:
// (a) From kIdle to kPropagatingPackets. // (a) From kIdle to kPropagatingPackets.
// Any thread that makes this transition becomes the propagation thread, and // Any thread that makes this transition becomes the propagation thread, and

View File

@ -141,8 +141,8 @@ GlContext::StatusOrGlContext GlContext::Create(
} }
MP_RETURN_IF_ERROR(status); MP_RETURN_IF_ERROR(status);
LOG(INFO) << "Successfully created a WebGL Context with major version " LOG(INFO) << "Successfully created a WebGL context with major version "
<< gl_major_version_ << " and context " << context_; << gl_major_version_ << " and handle " << context_;
return ::mediapipe::OkStatus(); return ::mediapipe::OkStatus();
} }
@ -158,6 +158,9 @@ void GlContext::DestroyContext() {
EMSCRIPTEN_RESULT res = emscripten_webgl_destroy_context(context_); EMSCRIPTEN_RESULT res = emscripten_webgl_destroy_context(context_);
if (res != EMSCRIPTEN_RESULT_SUCCESS) { if (res != EMSCRIPTEN_RESULT_SUCCESS) {
LOG(ERROR) << "emscripten_webgl_destroy_context() returned error " << res; LOG(ERROR) << "emscripten_webgl_destroy_context() returned error " << res;
} else {
LOG(INFO) << "Successfully destroyed WebGL context with handle "
<< context_;
} }
context_ = 0; context_ = 0;
} }