下载或者git clone opencv

https://github.com/opencv/opencv.git

https://github.com/opencv/opencv/archive/refs/tags/4.5.3.zip

下载或者git clone opencv_contrib

https://github.com/opencv/opencv_contrib.git

https://github.com/opencv/opencv_contrib/archive/refs/tags/4.5.3.zip

将opencv_contrib4.5.3放到opencv4.5.3目录下

目录结构
tree -L 1
.
├── 3rdparty
├── apps
├── build
├── cmake
├── CMakeLists.txt
├── CONTRIBUTING.md
├── COPYRIGHT
├── data
├── doc
├── include
├── LICENSE
├── modules
├── opencv_contrib-4.5.3
├── platforms
├── README.md
├── samples
└── SECURITY.md

make build && cd build

cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES=../opencv_contrib/modules ..

make -j4

sudo make install

如果要打开world
cmake -D CMAKE_BUILD_TYPE=Release -D BUILD_opencv_world=ON -D OPENCV_EXTRA_MODULES=../opencv_contrib/modules ..

出现错误:

CMake Error at modules/world/CMakeLists.txt:62 (if):
  if given arguments:
    ";opencv_core;opencv_flann;opencv_imgproc;opencv_ml;opencv_photo;opencv_python_tests;opencv_dnn;opencv_features2d;opencv_imgcodecs;opencv_videoio;opencv_calib3d;opencv_highgui;opencv_objdetect;opencv_stitching;opencv_video;opencv_gapi;opencv_world;opencv_java_bindings_generator;opencv_js_bindings_generator;opencv_objc_bindings_generator;opencv_python_bindings_generator;opencv_ts;" "MATCHES" ";opencv_viz;" "AND" "OPENCV_MODULE_opencv_viz_IS_PART_OF_WORLD" "AND" "VTK_VERSION" "VERSION_GREATER_EQUAL" "8.90.0"

  Unknown arguments specified
Configuring incomplete, errors occurred!

下载编译安装VTK试试
https://www.vtk.org/files/release/9.0/VTK-9.0.3.tar.gz
tar xvf VTK-9.0.3.tar.gz
cd VTK-9.0.3
mkdir build && cd build
cmake ..
make -j4
sudo make install

-- Installing: /usr/local/lib/libvtkDomainsChemistry-9.0.so.9.0.3
-- Installing: /usr/local/lib/libvtkDomainsChemistry-9.0.so.1
-- Set runtime path of "/usr/local/lib/libvtkDomainsChemistry-9.0.so.9.0.3" to ""
-- Installing: /usr/local/lib/libvtkDomainsChemistry-9.0.so
-- Installing: /usr/local/include/vtk-9.0/vtkOpenGLMoleculeMapper.h
-- Installing: /usr/local/include/vtk-9.0/vtkDomainsChemistryOpenGL2Module.h
-- Installing: /usr/local/lib/vtk/hierarchy/VTK/vtkDomainsChemistryOpenGL2-hierarchy.txt
-- Installing: /usr/local/lib/libvtkDomainsChemistryOpenGL2-9.0.so.9.0.3
-- Installing: /usr/local/lib/libvtkDomainsChemistryOpenGL2-9.0.so.1
-- Set runtime path of "/usr/local/lib/libvtkDomainsChemistryOpenGL2-9.0.so.9.0.3" to ""
-- Installing: /usr/local/lib/libvtkDomainsChemistryOpenGL2-9.0.so
本文链接地址:https://const.net.cn/447.html

标签: none

添加新评论