Project import generated by Copybara.

GitOrigin-RevId: bb059a0721c92e8154d33ce8057b3915a25b3d7d
This commit is contained in:
MediaPipe Team
2021-12-13 15:56:02 -08:00
committed by jqtang
parent cf101e62a9
commit e6c19885c6
96 changed files with 554 additions and 486 deletions
@@ -291,6 +291,7 @@ cc_library(
"//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/container:btree",
],
alwayslink = 1,
)
@@ -390,6 +391,7 @@ cc_test(
"//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/strings",
],
@@ -657,7 +657,10 @@ absl::Status ContentZoomingCalculator::Process(
}
const bool camera_active =
is_animating || pan_state || tilt_state || zoom_state;
if (cc->Outputs().HasTag(kCameraActive)) {
// Waiting for first rect before setting any value of the camera active flag
// so we avoid setting it to false during initialization.
if (cc->Outputs().HasTag(kCameraActive) &&
first_rect_timestamp_ != Timestamp::Unset()) {
cc->Outputs()
.Tag(kCameraActive)
.AddPacket(MakePacket<bool>(camera_active).At(cc->InputTimestamp()));
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/container/btree_set.h"
#include "absl/flags/flag.h"
#include "absl/strings/string_view.h"
#include "mediapipe/examples/desktop/autoflip/calculators/shot_boundary_calculator.pb.h"
@@ -54,7 +55,8 @@ const char kConfig[] = R"(
const int kTestFrameWidth = 640;
const int kTestFrameHeight = 480;
void AddFrames(const int number_of_frames, const std::set<int>& skip_frames,
void AddFrames(const int number_of_frames,
const absl::btree_set<int>& skip_frames,
CalculatorRunner* runner) {
cv::Mat image =
cv::imread(file::JoinPath("./",
@@ -78,7 +80,8 @@ void AddFrames(const int number_of_frames, const std::set<int>& skip_frames,
}
}
void CheckOutput(const int number_of_frames, const std::set<int>& shot_frames,
void CheckOutput(const int number_of_frames,
const absl::btree_set<int>& shot_frames,
const std::vector<Packet>& output_packets) {
ASSERT_EQ(number_of_frames, output_packets.size());
for (int i = 0; i < number_of_frames; i++) {
@@ -18,6 +18,7 @@
#include <utility>
#include <vector>
#include "absl/container/btree_map.h"
#include "mediapipe/examples/desktop/autoflip/autoflip_messages.pb.h"
#include "mediapipe/examples/desktop/autoflip/calculators/signal_fusing_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
@@ -178,8 +179,8 @@ absl::Status SignalFusingCalculator::Close(mediapipe::CalculatorContext* cc) {
absl::Status SignalFusingCalculator::ProcessScene(
mediapipe::CalculatorContext* cc) {
std::map<std::string, int> detection_count;
std::map<std::string, float> multiframe_score;
absl::btree_map<std::string, int> detection_count;
absl::btree_map<std::string, float> multiframe_score;
// Create a unified score for all items with temporal ids.
for (const Frame& frame : scene_frames_) {
for (const auto& detection : frame.input_detections) {