From 981c23fc7398a3b16ca922f6c1d250b7b097a6d1 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Mon, 17 Jun 2019 21:31:41 -0700 Subject: [PATCH] Project import generated by Copybara. PiperOrigin-RevId: 253721185 --- mediapipe/docs/install.md | 54 +++++++++++++++---- .../framework/profiler/graph_profiler_test.cc | 9 ++-- 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/mediapipe/docs/install.md b/mediapipe/docs/install.md index 63177b20a..156fdb6ea 100644 --- a/mediapipe/docs/install.md +++ b/mediapipe/docs/install.md @@ -55,7 +55,7 @@ Required libraries Option 1. Use package manager tool to install the pre-compiled OpenCV libraries. - Note that Debian 9 and Ubuntu 16.04 provide OpenCV 2.4.9. You may want to + Note: Debian 9 and Ubuntu 16.04 provide OpenCV 2.4.9. You may want to take option 2 or 3 to install OpenCV 3 or above. ```bash @@ -70,11 +70,11 @@ Required libraries [documentation](https://docs.opencv.org/3.4.6/d7/d9f/tutorial_linux_install.html) to manually build OpenCV from source code. - You may need to modify [`WORKSAPCE`] and [`opencv_linux.BUILD`] to point - MediaPipe to your own OpenCV libraries. For example, if OpenCV 4 is + Note: You may need to modify [`WORKSAPCE`] and [`opencv_linux.BUILD`] to point + MediaPipe to your own OpenCV libraries, e.g., if OpenCV 4 is installed in "/usr/local/", you need to update the "linux_opencv" new_local_repository rule in [`WORKSAPCE`] and "opencv" cc_library rule in - [`opencv_linux.BUILD`] to be: + [`opencv_linux.BUILD`] like the following: ```bash new_local_repository( @@ -145,7 +145,7 @@ Required libraries Option 1. Use package manager tool to install the pre-compiled version. - Note that yum installs OpenCV 2.4.5, which may have an opencv/gstreamer + Note: yum installs OpenCV 2.4.5, which may have an opencv/gstreamer [issue](https://github.com/opencv/opencv/issues/4592). ```bash @@ -154,11 +154,11 @@ Required libraries Option 2. Build OpenCV from source code. - You may need to modify [`WORKSAPCE`] and [`opencv_linux.BUILD`] to point - MediaPipe to your own OpenCV libraries. For example, if OpenCV 4 is + Note: You may need to modify [`WORKSAPCE`] and [`opencv_linux.BUILD`] to point + MediaPipe to your own OpenCV libraries, e.g., if OpenCV 4 is installed in "/usr/local/", you need to update the "linux_opencv" new_local_repository rule in [`WORKSAPCE`] and "opencv" cc_library rule in - [`opencv_linux.BUILD`] to be: + [`opencv_linux.BUILD`] like the following: ```bash new_local_repository( @@ -234,12 +234,48 @@ Required libraries 3. Install OpenCV - Use package manager tool to install the pre-compiled OpenCV libraries. + Option 1. Use HomeBrew package manager tool to install the pre-compiled + OpenCV libraries. ```bash $ brew install opencv ``` + Option 2. Use MacPorts package manager tool to install the OpenCV libraries. + + ```bash + $ port install opencv + ``` + + Note: when using MacPorts, please edit the [`WORKSAPCE`] and + [`opencv_linux.BUILD`] files like the following: + + ```bash + new_local_repository( + name = "macos_opencv", + build_file = "@//third_party:opencv_macos.BUILD", + path = "/opt", + ) + + cc_library( + name = "opencv", + srcs = glob( + [ + "local/lib/libopencv_core.dylib", + "local/lib/libopencv_highgui.dylib", + "local/lib/libopencv_imgcodecs.dylib", + "local/lib/libopencv_imgproc.dylib", + "local/lib/libopencv_video.dylib", + "local/lib/libopencv_videoio.dylib", + ], + ), + hdrs = glob(["local/include/opencv2/**/*.h*"]), + includes = ["local/include/"], + linkstatic = 1, + visibility = ["//visibility:public"], + ) + ``` + 4. Run the hello world desktop example ```bash diff --git a/mediapipe/framework/profiler/graph_profiler_test.cc b/mediapipe/framework/profiler/graph_profiler_test.cc index bef6044e2..90b05f242 100644 --- a/mediapipe/framework/profiler/graph_profiler_test.cc +++ b/mediapipe/framework/profiler/graph_profiler_test.cc @@ -15,6 +15,7 @@ #include "mediapipe/framework/profiler/graph_profiler.h" #include "absl/synchronization/mutex.h" +#include "absl/time/time.h" #include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/mediapipe_profiling.h" #include "mediapipe/framework/port/core_proto_inc.h" @@ -674,7 +675,7 @@ TEST_F(GraphProfilerTestPeer, SetOpenRuntimeWithStreamLatency) { source_context.AddOutputs( {{}, {MakePacket("15").At(Timestamp(100))}}); - simulation_clock->SleepUntil(base::FromUnixMicros(1000)); + simulation_clock->SleepUntil(absl::FromUnixMicros(1000)); { GraphProfiler::Scope profiler_scope(GraphTrace::OPEN, source_context.get(), &profiler_); @@ -775,7 +776,7 @@ TEST_F(GraphProfilerTestPeer, SetCloseRuntimeWithStreamLatency) { {{MakePacket("15").At(Timestamp::PostStream())}}); CalculatorContextManager().PushInputTimestampToContext( source_context.get(), Timestamp::PostStream()); - simulation_clock->SleepUntil(base::FromUnixMicros(1000)); + simulation_clock->SleepUntil(absl::FromUnixMicros(1000)); { GraphProfiler::Scope profiler_scope(GraphTrace::CLOSE, source_context.get(), &profiler_); @@ -973,7 +974,7 @@ TEST_F(GraphProfilerTestPeer, AddProcessSampleWithStreamLatency) { int64 when_source_started = 1000; int64 when_source_finished = when_source_started + 150; - simulation_clock->SleepUntil(base::FromUnixMicros(when_source_started)); + simulation_clock->SleepUntil(absl::FromUnixMicros(when_source_started)); { GraphProfiler::Scope profiler_scope(GraphTrace::PROCESS, source_context.get(), &profiler_); @@ -1006,7 +1007,7 @@ TEST_F(GraphProfilerTestPeer, AddProcessSampleWithStreamLatency) { consumer_context.AddInputs( {Packet(), MakePacket("15").At(Timestamp(100))}); - simulation_clock->SleepUntil(base::FromUnixMicros(2000)); + simulation_clock->SleepUntil(absl::FromUnixMicros(2000)); { GraphProfiler::Scope profiler_scope(GraphTrace::PROCESS, consumer_context.get(), &profiler_);