Made installation compatible with Ubuntu 22.04 and OpenCV 4 on WSL by making changes in: setup_opencv.sh (need to update libdc1394-22-dev to libdc1394-dev since the former package is now orphaned), and the suggested changes on the installation for openCV 4 given on the official installation page

This commit is contained in:
ahahahahah1 2023-07-06 20:08:49 +05:30
parent 9861b3c8a8
commit 8d5bc39739
3 changed files with 23 additions and 13 deletions

View File

@ -326,7 +326,7 @@ http_archive(
new_local_repository( new_local_repository(
name = "linux_opencv", name = "linux_opencv",
build_file = "@//third_party:opencv_linux.BUILD", build_file = "@//third_party:opencv_linux.BUILD",
path = "/usr", path = "/usr/local",
) )
new_local_repository( new_local_repository(

View File

@ -40,7 +40,7 @@ if [ -z "$1" ]
echo "Installing OpenCV from source" echo "Installing OpenCV from source"
if [[ -x "$(command -v apt)" ]]; then if [[ -x "$(command -v apt)" ]]; then
sudo apt update && sudo apt install build-essential git sudo apt update && sudo apt install build-essential git
sudo apt install cmake ffmpeg libavformat-dev libdc1394-22-dev libgtk2.0-dev \ sudo apt install cmake ffmpeg libavformat-dev libdc1394-dev libgtk2.0-dev \
libjpeg-dev libpng-dev libswscale-dev libtbb2 libtbb-dev \ libjpeg-dev libpng-dev libswscale-dev libtbb2 libtbb-dev \
libtiff-dev libtiff-dev
elif [[ -x "$(command -v dnf)" ]]; then elif [[ -x "$(command -v dnf)" ]]; then

View File

@ -13,29 +13,39 @@ exports_files(["LICENSE"])
# If you install OpenCV separately, please modify the build rule accordingly. # If you install OpenCV separately, please modify the build rule accordingly.
cc_library( cc_library(
name = "opencv", name = "opencv",
hdrs = glob([ srcs = glob(
[
"lib/libopencv_core.so",
"lib/libopencv_highgui.so",
"lib/libopencv_imgcodecs.so",
"lib/libopencv_imgproc.so",
"lib/libopencv_video.so",
"lib/libopencv_videoio.so",
],
),
hdrs = glob(["include/opencv4/**/*.h*"]),
# For OpenCV 4.x # For OpenCV 4.x
#"include/aarch64-linux-gnu/opencv4/opencv2/cvconfig.h", #"include/aarch64-linux-gnu/opencv4/opencv2/cvconfig.h",
#"include/arm-linux-gnueabihf/opencv4/opencv2/cvconfig.h", #"include/arm-linux-gnueabihf/opencv4/opencv2/cvconfig.h",
#"include/x86_64-linux-gnu/opencv4/opencv2/cvconfig.h", #"include/x86_64-linux-gnu/opencv4/opencv2/cvconfig.h",
#"include/opencv4/opencv2/**/*.h*", #"include/opencv4/opencv2/**/*.h*",
]), includes = ["include/opencv4/",
includes = [
# For OpenCV 4.x # For OpenCV 4.x
#"include/aarch64-linux-gnu/opencv4/", #"include/aarch64-linux-gnu/opencv4/",
#"include/arm-linux-gnueabihf/opencv4/", #"include/arm-linux-gnueabihf/opencv4/",
#"include/x86_64-linux-gnu/opencv4/", #"include/x86_64-linux-gnu/opencv4/",
#"include/opencv4/", #"include/opencv4/",
], ],
linkstatic = 1,
linkopts = [ linkopts = [
"-l:libopencv_core.so", #"-l:libopencv_core.so",
"-l:libopencv_calib3d.so", #"-l:libopencv_calib3d.so",
"-l:libopencv_features2d.so", #"-l:libopencv_features2d.so",
"-l:libopencv_highgui.so", #"-l:libopencv_highgui.so",
"-l:libopencv_imgcodecs.so", #"-l:libopencv_imgcodecs.so",
"-l:libopencv_imgproc.so", #"-l:libopencv_imgproc.so",
"-l:libopencv_video.so", #"-l:libopencv_video.so",
"-l:libopencv_videoio.so", #"-l:libopencv_videoio.so",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )