安装额外模块 openCV 后未定义跟踪器
Tracker undefined after installing extra modules openCV
我目前正在尝试让 OpenCV 在 Linux (Ubuntu 16.04)、cmake 3.5.1 上使用 OpenCV 额外模块(尤其是跟踪模块)
我从 https://opencv.org/releases.html and the OpenCV contrib 3.4.5 from https://github.com/opencv/opencv_contrib/releases/tag/3.4.5 下载了 OpenCV 3.4.5 版本
然后,我按照 Linux 的 OpenCV 官方文档中的教程进行操作:https://docs.opencv.org/3.4.5/d7/d9f/tutorial_linux_install.html
我在 openCV 上创建了一个构建目录并使用了命令
cmake -DOPENCV_EXTRA_MODULES_PATH=<openCV contrib/modules> <openCV source directory>
执行此命令后一切正常:
-- OpenCV modules:
-- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy hdf hfs highgui img_hash imgcodecs imgproc java java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv js matlab ovis python3 sfm xfeatures2d
-- Applications: tests perf_tests apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI:
-- GTK+: YES (ver 2.24.30)
-- GThread : YES (ver 2.48.2)
-- GtkGlExt: NO
-- VTK support: YES (ver 5.10.1)
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: build (ver encoder: 0x020e)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.6)
-- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2.2.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
--
-- Video I/O:
-- DC1394: YES (ver 2.2.4)
-- FFMPEG: YES
-- avcodec: YES (ver 56.60.100)
-- avformat: YES (ver 56.40.101)
-- avutil: YES (ver 54.31.100)
-- swscale: YES (ver 3.1.101)
-- avresample: NO
-- GStreamer:
-- base: YES (ver 0.10.36)
-- video: YES (ver 0.10.36)
-- app: YES (ver 0.10.36)
-- riff: YES (ver 0.10.36)
-- pbutils: YES (ver 0.10.36)
-- libv4l/libv4l2: NO
-- v4l/v4l2: linux/videodev2.h
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Lapack: NO
-- Eigen: YES (ver 3.2.92)
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- OpenCL: YES (no extra features)
-- Include path: /home/pgrisart/Documents/opencv-3.4.5/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.12)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
-- numpy: /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.15.1)
-- install path: lib/python2.7/dist-packages/cv2/python-2.7
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: /usr/bin/ant (ver 1.9.6)
-- JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include
-- Java wrappers: YES
-- Java tests: YES
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pgrisart/Documents/opencv-3.4.5/build
然后
make
sudo make install
我没有错误
但是当我使用 opencv2/tracking.hpp 尝试文档中的代码时,我没有它。我只有 opencv2/video/tracking。
如果我 运行 https://docs.opencv.org/3.4.5/d2/d0a/tutorial_introduction_to_tracker.html 上的代码带有 opencv2/video/tracking ,Tracker 是未定义的。
我应该如何重新安装 contrib 模块才能获得 opencv2/tracking.hpp?我尝试了很多版本的openCV,也看了很多教程...
谢谢
- 对于跟踪示例:-DBUILD_EXAMPLES=ON
- 对于高级功能:-DOPENCV_ENABLE_NONFREE=开启
- 你需要测试吗?如果否:-DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF
问题已解决!
我不知道命令行有什么问题,但我按照本教程的界面下载了软件cmake:https://towardsdatascience.com/how-to-install-opencv-and-extra-modules-from-source-using-cmake-and-then-set-it-up-in-your-pycharm-7e6ae25dbac5
我删除了导致问题的 opencv_features2D
然后
make
sudo make install
一切正常 opencv2/tracking.hpp
我目前正在尝试让 OpenCV 在 Linux (Ubuntu 16.04)、cmake 3.5.1 上使用 OpenCV 额外模块(尤其是跟踪模块) 我从 https://opencv.org/releases.html and the OpenCV contrib 3.4.5 from https://github.com/opencv/opencv_contrib/releases/tag/3.4.5 下载了 OpenCV 3.4.5 版本 然后,我按照 Linux 的 OpenCV 官方文档中的教程进行操作:https://docs.opencv.org/3.4.5/d7/d9f/tutorial_linux_install.html
我在 openCV 上创建了一个构建目录并使用了命令
cmake -DOPENCV_EXTRA_MODULES_PATH=<openCV contrib/modules> <openCV source directory>
执行此命令后一切正常:
-- OpenCV modules:
-- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy hdf hfs highgui img_hash imgcodecs imgproc java java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv js matlab ovis python3 sfm xfeatures2d
-- Applications: tests perf_tests apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI:
-- GTK+: YES (ver 2.24.30)
-- GThread : YES (ver 2.48.2)
-- GtkGlExt: NO
-- VTK support: YES (ver 5.10.1)
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: build (ver encoder: 0x020e)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.6)
-- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2.2.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
--
-- Video I/O:
-- DC1394: YES (ver 2.2.4)
-- FFMPEG: YES
-- avcodec: YES (ver 56.60.100)
-- avformat: YES (ver 56.40.101)
-- avutil: YES (ver 54.31.100)
-- swscale: YES (ver 3.1.101)
-- avresample: NO
-- GStreamer:
-- base: YES (ver 0.10.36)
-- video: YES (ver 0.10.36)
-- app: YES (ver 0.10.36)
-- riff: YES (ver 0.10.36)
-- pbutils: YES (ver 0.10.36)
-- libv4l/libv4l2: NO
-- v4l/v4l2: linux/videodev2.h
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Lapack: NO
-- Eigen: YES (ver 3.2.92)
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- OpenCL: YES (no extra features)
-- Include path: /home/pgrisart/Documents/opencv-3.4.5/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.12)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
-- numpy: /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.15.1)
-- install path: lib/python2.7/dist-packages/cv2/python-2.7
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: /usr/bin/ant (ver 1.9.6)
-- JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include
-- Java wrappers: YES
-- Java tests: YES
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pgrisart/Documents/opencv-3.4.5/build
然后
make
sudo make install
我没有错误
但是当我使用 opencv2/tracking.hpp 尝试文档中的代码时,我没有它。我只有 opencv2/video/tracking。 如果我 运行 https://docs.opencv.org/3.4.5/d2/d0a/tutorial_introduction_to_tracker.html 上的代码带有 opencv2/video/tracking ,Tracker 是未定义的。
我应该如何重新安装 contrib 模块才能获得 opencv2/tracking.hpp?我尝试了很多版本的openCV,也看了很多教程...
谢谢
- 对于跟踪示例:-DBUILD_EXAMPLES=ON
- 对于高级功能:-DOPENCV_ENABLE_NONFREE=开启
- 你需要测试吗?如果否:-DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF
问题已解决! 我不知道命令行有什么问题,但我按照本教程的界面下载了软件cmake:https://towardsdatascience.com/how-to-install-opencv-and-extra-modules-from-source-using-cmake-and-then-set-it-up-in-your-pycharm-7e6ae25dbac5 我删除了导致问题的 opencv_features2D
然后
make
sudo make install
一切正常 opencv2/tracking.hpp