Project import generated by Copybara.

GitOrigin-RevId: 72933af9ce469acd89cbf41898dcc06c65df7c8a
This commit is contained in:
MediaPipe Team 2020-01-11 11:08:37 -08:00 committed by jqtang
parent a2823541e6
commit bf5185f122
3 changed files with 16 additions and 8 deletions

View File

@ -24,13 +24,11 @@ bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/a
```bash
GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/autoflip/run_autoflip \
--calculator_graph_config_file=mediapipe/examples/desktop/autoflip/autoflip_graph.pbtxt \
--input_side_packets=input_video_path=/absolute/path/to/the/local/video/file,\
output_video_path=/absolute/path/to/save/the/output/video/file,\
aspect_ratio=9:16
--input_side_packets=input_video_path=/absolute/path/to/the/local/video/file,output_video_path=/absolute/path/to/save/the/output/video/file,aspect_ratio=1:1
```
Use the `aspect_ratio` flag to provide the output aspect ratio. The format
should be `weight:height`, where the `weight` and `height` are two positive
should be `width:height`, where the `width` and `height` are two positive
integers. AutoFlip supports both landscape-to-portrait and portrait-to-landscape
conversions. The pipeline internally compares the target aspect ratio against
the original one, and determines the correct conversion automatically.
@ -278,7 +276,7 @@ the required features cannot be all covered (for example, when they are too
spread out in the video), AutoFlip will apply a padding effect to cover as much
salient content as possible. See an illustration below.
![graph is_required](images/autoflip_is_required.gif){width="600"}
![graph is_required](images/autoflip_is_required.gif)
### Stable vs Tracking Camera Motion

View File

@ -17,9 +17,7 @@
GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/autoflip/run_autoflip \
--calculator_graph_config_file=mediapipe/examples/desktop/autoflip/autoflip_graph.pbtxt \
--input_side_packets=input_video_path=/absolute/path/to/the/local/video/file,\
output_video_path=/absolute/path/to/save/the/output/video/file,\
aspect_ratio=width:height
--input_side_packets=input_video_path=/absolute/path/to/the/local/video/file,output_video_path=/absolute/path/to/save/the/output/video/file,aspect_ratio=width:height
```
3. View the cropped video.

View File

@ -217,6 +217,18 @@ float TimestampsToRate(int64 first_timestamp, int64 second_timestamp) {
sequence);
}
}
if (GetPointSize(prefix, *sequence) > 0) {
std::string x_key = merge_prefix(prefix, kRegionPointXKey);
auto* region_feature_list = MutableFeatureList(x_key, sequence);
RET_CHECK_EQ(num_bboxes, region_feature_list->feature_size())
<< "Expected number of BBox timestamps and boxes to match.";
ClearBBoxNumRegions(prefix, sequence);
for (int i = 0; i < num_bboxes; ++i) {
AddBBoxNumRegions(
prefix, region_feature_list->feature(i).float_list().value_size(),
sequence);
}
}
// Collect which timestamps currently match to which indices in timestamps.
// skip empty timestamps.
// Requires sorted indices.