fix opencv path and } error

This commit is contained in:
vladimir.borisov 2022-07-28 04:12:17 +04:00
parent 331c01b918
commit ee0076ac16
5 changed files with 57 additions and 37 deletions

View File

@ -205,13 +205,13 @@ new_local_repository(
# For local MacOS builds, the path should point to an opencv@3 installation.
# If you edit the path here, you will also need to update the corresponding
# prefix in "opencv_macos.BUILD".
path = "/opt/homebrew/Cellar/",
path = "/usr/local",
)
new_local_repository(
name = "macos_ffmpeg",
build_file = "@//third_party:ffmpeg_macos.BUILD",
path = "/opt/homebrew/Cellar/ffmpeg",
path = "/usr/local/opt/ffmpeg",
)
new_local_repository(

View File

@ -190,16 +190,17 @@ namespace mediapipe
cc->Inputs().HasTag(kFaceBoxTag) &&
!cc->Inputs().Tag(kFaceBoxTag).IsEmpty())
{
const std::vector<std::unordered_map<std::string, cv::Mat>> &mask_vec =
cc->Inputs().Tag(kMaskTag).Get<std::vector<std::unordered_map<std::string, cv::Mat>>>();
const std::vector<std::unordered_map<std::string, cv::Mat>> &mask_vec =
cc->Inputs().Tag(kMaskTag).Get<std::vector<std::unordered_map<std::string, cv::Mat>>>();
const std::vector<std::tuple<double, double, double, double>> &face_boxes =
cc->Inputs().Tag(kFaceBoxTag).Get<std::vector<std::tuple<double, double, double, double>>>();
const std::vector<std::tuple<double, double, double, double>> &face_boxes =
cc->Inputs().Tag(kFaceBoxTag).Get<std::vector<std::tuple<double, double, double, double>>>();
if (mask_vec.size() > 0 && face_boxes.size() > 0)
{
for (int i = 0; i < mask_vec.size(); i++)
MP_RETURN_IF_ERROR(SmoothFace(cc, mask_vec[i], face_boxes[i]));
if (mask_vec.size() > 0 && face_boxes.size() > 0)
{
for (int i = 0; i < mask_vec.size(); i++)
MP_RETURN_IF_ERROR(SmoothFace(cc, mask_vec[i], face_boxes[i]));
}
}
// Copy the rendered image to output.
uchar *image_mat_ptr = image_mat->data;

View File

@ -38,6 +38,17 @@ cc_library(
],
)
mediapipe_simple_subgraph(
name = "face_renderer_gpu",
graph = "face_renderer_gpu.pbtxt",
register_as = "FaceRendererGpu",
deps = [
":renderer_calculators",
],
)
mediapipe_simple_subgraph(
name = "face_renderer_cpu",
graph = "face_renderer_cpu.pbtxt",

View File

@ -1,33 +1,41 @@
# Description:
# OpenCV libraries for video/image processing on MacOS
# OpenCV libraries for video/image processing on Linux
licenses(["notice"]) # BSD license
exports_files(["LICENSE"])
load("@bazel_skylib//lib:paths.bzl", "paths")
# The path to OpenCV is a combination of the path set for "macos_opencv"
# in the WORKSPACE file and the prefix here.
PREFIX = "opencv@3/3.4.16_3/"
# The following build rule assumes that OpenCV is installed by
# 'apt-get install libopencv-core-dev libopencv-highgui-dev \'
# ' libopencv-calib3d-dev libopencv-features2d-dev \'
# ' libopencv-imgproc-dev libopencv-video-dev'
# on Debian Buster/Ubuntu 18.04.
# If you install OpenCV separately, please modify the build rule accordingly.
cc_library(
name = "opencv",
srcs = glob(
[
paths.join(PREFIX, "lib/libopencv_core.dylib"),
paths.join(PREFIX, "lib/libopencv_calib3d.dylib"),
paths.join(PREFIX, "lib/libopencv_features2d.dylib"),
paths.join(PREFIX, "lib/libopencv_highgui.dylib"),
paths.join(PREFIX, "lib/libopencv_imgcodecs.dylib"),
paths.join(PREFIX, "lib/libopencv_imgproc.dylib"),
paths.join(PREFIX, "lib/libopencv_video.dylib"),
paths.join(PREFIX, "lib/libopencv_videoio.dylib"),
],
),
hdrs = glob([paths.join(PREFIX, "include/opencv2/**/*.h*")]),
includes = [paths.join(PREFIX, "include/")],
linkstatic = 1,
hdrs = glob([
# For OpenCV 4.x
#"include/aarch64-linux-gnu/opencv4/opencv2/cvconfig.h",
#"include/arm-linux-gnueabihf/opencv4/opencv2/cvconfig.h",
#"include/x86_64-linux-gnu/opencv4/opencv2/cvconfig.h",
#"include/opencv4/opencv2/**/*.h*",
]),
includes = [
# For OpenCV 4.x
#"include/aarch64-linux-gnu/opencv4/",
#"include/arm-linux-gnueabihf/opencv4/",
#"include/x86_64-linux-gnu/opencv4/",
#"include/opencv4/",
],
linkopts = [
"-l:libopencv_core.so",
"-l:libopencv_calib3d.so",
"-l:libopencv_features2d.so",
"-l:libopencv_highgui.so",
"-l:libopencv_imgcodecs.so",
"-l:libopencv_imgproc.so",
"-l:libopencv_video.so",
"-l:libopencv_videoio.so",
],
visibility = ["//visibility:public"],
)

View File

@ -9,7 +9,7 @@ load("@bazel_skylib//lib:paths.bzl", "paths")
# The path to OpenCV is a combination of the path set for "macos_opencv"
# in the WORKSPACE file and the prefix here.
PREFIX = "opencv@3/3.4.16_3/"
PREFIX = "opt/opencv@3"
cc_library(
name = "opencv",