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. # 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 # If you edit the path here, you will also need to update the corresponding
# prefix in "opencv_macos.BUILD". # prefix in "opencv_macos.BUILD".
path = "/opt/homebrew/Cellar/", path = "/usr/local",
) )
new_local_repository( new_local_repository(
name = "macos_ffmpeg", name = "macos_ffmpeg",
build_file = "@//third_party:ffmpeg_macos.BUILD", build_file = "@//third_party:ffmpeg_macos.BUILD",
path = "/opt/homebrew/Cellar/ffmpeg", path = "/usr/local/opt/ffmpeg",
) )
new_local_repository( new_local_repository(
@ -415,4 +415,4 @@ load("@libedgetpu//:workspace.bzl", "libedgetpu_dependencies")
libedgetpu_dependencies() libedgetpu_dependencies()
load("@coral_crosstool//:configure.bzl", "cc_crosstool") load("@coral_crosstool//:configure.bzl", "cc_crosstool")
cc_crosstool(name = "crosstool") cc_crosstool(name = "crosstool")

View File

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

View File

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