opencv 在 gtk 上安装失败

opencv 在 gtk 上安装失败

我正在尝试安装 opencv3.2。按照教程这里。我在这里得到了要点:

$ cmake -D CMAKE_BUILD_TYPE=RELEASE       -D CMAKE_INSTALL_PREFIX=/usr/local       -D INSTALL_C_EXAMPLES=ON       -D INSTALL_PYTHON_EXAMPLES=ON       -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_OPENGL=ON       -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules       -D BUILD_EXAMPLES=ON ..
-- Detected version of GNU GCC: 49 (409)
-- FP16: Feature disabled
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") 
-- Could NOT find Jasper (missing:  JASPER_LIBRARIES JASPER_INCLUDE_DIR) 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- Checking for module 'gstreamer-base-1.0'
--   No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
--   No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'
--   No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
--   No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
--   No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
--   No package 'gstreamer-pbutils-0.10' found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- Found TBB: /usr/lib/x86_64-linux-gnu/libtbb.so
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /home/thijser/opencv/build/3rdparty/ippicv/ippicv_lnx
-- CUDA detected: 8.0
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
-- Found OpenBLAS libraries: /opt/OpenBLAS/lib/libopenblas.so
-- Found OpenBLAS include: /usr/include
-- LAPACK(OpenBLAS): LAPACK_LIBRARIES: /opt/OpenBLAS/lib/libopenblas.so
CMake Warning at cmake/OpenCVFindLAPACK.cmake:29 (message):
  LAPACK(OpenBLAS): CBLAS/LAPACK headers are not found in '/usr/include'
Call Stack (most recent call first):
  cmake/OpenCVFindLAPACK.cmake:89 (ocv_lapack_check)
  CMakeLists.txt:559 (include)


-- Could NOT find Atlas (missing:  Atlas_CLAPACK_INCLUDE_DIR) 
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- LAPACK(OpenBLAS): LAPACK_LIBRARIES: /usr/lib/liblapack.so;/usr/lib/libf77blas.so;/usr/lib/libatlas.so
CMake Warning at cmake/OpenCVFindLAPACK.cmake:29 (message):
  LAPACK(OpenBLAS): CBLAS/LAPACK headers are not found in '/usr/include'
Call Stack (most recent call first):
  cmake/OpenCVFindLAPACK.cmake:151 (ocv_lapack_check)
  CMakeLists.txt:559 (include)


-- Found apache ant 1.9.8: /usr/bin/ant
-- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.

-- Found VTK ver. 6.3.0 (usefile: /usr/lib/cmake/vtk-6.3/UseVTK.cmake)
-- Caffe:   NO
-- Protobuf:   YES
-- Glog:   YES
-- freetype2:   YES
-- harfbuzz:    YES
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
-- Assume that non-module dependency is available: freetype (for module opencv_freetype)
-- Assume that non-module dependency is available: harfbuzz (for module opencv_freetype)
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
CMake Error at /home/thijser/opencv_contrib/modules/dnn/CMakeLists.txt:80 (message):
  OPENCV_TEST_DATA_PATH environment variable was not specified


-- Configuring incomplete, errors occurred!
See also "/home/thijser/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/home/thijser/opencv/build/CMakeFiles/CMakeError.log".

因此,这表明主要的错误是

-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.

有人知道该怎么解决吗?或者可能未安装 atlas,但是 sudo apt-get install libatlas-base-dev 显示 atlas 已安装。

打开-D WITH_QT=ON后却出现错误

$ cmake -D WITH_QT=ON -D WITH_XINE=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D WITH_QT=ON -D BUILD_EXAMPLES=ON ..
-- Detected version of GNU GCC: 49 (409)
-- FP16: Feature disabled
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") 
-- Could NOT find Jasper (missing:  JASPER_LIBRARIES JASPER_INCLUDE_DIR) 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- Checking for module 'gstreamer-base-1.0'
--   No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
--   No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'
--   No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
--   No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
--   No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
--   No package 'gstreamer-pbutils-0.10' found
-- Checking for module 'libxine'
--   Found libxine, version 1.2.6
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- Found TBB: /usr/lib/x86_64-linux-gnu/libtbb.so
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /home/thijser/opencv/build/3rdparty/ippicv/ippicv_lnx
-- CUDA detected: 8.0
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
-- Found OpenBLAS libraries: /opt/OpenBLAS/lib/libopenblas.so
-- Found OpenBLAS include: /usr/include
-- LAPACK(OpenBLAS): LAPACK_LIBRARIES: /opt/OpenBLAS/lib/libopenblas.so
CMake Warning at cmake/OpenCVFindLAPACK.cmake:29 (message):
  LAPACK(OpenBLAS): CBLAS/LAPACK headers are not found in '/usr/include'
Call Stack (most recent call first):
  cmake/OpenCVFindLAPACK.cmake:89 (ocv_lapack_check)
  CMakeLists.txt:559 (include)


-- Could NOT find Atlas (missing:  Atlas_CLAPACK_INCLUDE_DIR) 
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- LAPACK(OpenBLAS): LAPACK_LIBRARIES: /usr/lib/liblapack.so;/usr/lib/libf77blas.so;/usr/lib/libatlas.so
CMake Warning at cmake/OpenCVFindLAPACK.cmake:29 (message):
  LAPACK(OpenBLAS): CBLAS/LAPACK headers are not found in '/usr/include'
Call Stack (most recent call first):
  cmake/OpenCVFindLAPACK.cmake:151 (ocv_lapack_check)
  CMakeLists.txt:559 (include)


-- Found apache ant 1.9.8: /usr/bin/ant
-- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.

-- Found VTK ver. 6.3.0 (usefile: /usr/lib/cmake/vtk-6.3/UseVTK.cmake)
-- Caffe:   NO
-- Protobuf:   YES
-- Glog:   YES
-- freetype2:   YES
-- harfbuzz:    YES
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
-- Assume that non-module dependency is available: freetype (for module opencv_freetype)
-- Assume that non-module dependency is available: harfbuzz (for module opencv_freetype)
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
CMake Error at /home/thijser/opencv_contrib/modules/dnn/CMakeLists.txt:80 (message):
  OPENCV_TEST_DATA_PATH environment variable was not specified


-- Configuring incomplete, errors occurred!
See also "/home/thijser/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/home/thijser/opencv/build/CMakeFiles/CMakeError.log".

答案1

好吧,经过一番搜索,我找到了答案这里。基本上,通过注释掉 torch 测试数据生成器,我们可以解决这个问题,这意味着您无法测试 torch 导入器是否能正常工作。您可以在以下位置找到数据gedit /home/thijser/opencv_contrib/modules/dnn/CMakeLists.txt

就像这样

# ----------------------------------------------------------------------------
# Generating test data for Torch importer
# ----------------------------------------------------------------------------
#OCV_OPTION(${the_module}_BUILD_TORCH_TESTS "Build Torch tests (installed torch7 with nn module is required)" ON IF BUILD_TESTS AND ${the_module}_BUILD_TORCH_IMPORTER AND HAVE_TORCH_EXE)
#if(${the_module}_BUILD_TORCH_TESTS)
#
#    if(NOT DEFINED ENV{OPENCV_TEST_DATA_PATH})
#        message(FATAL_ERROR "OPENCV_TEST_DATA_PATH environment variable was not specified")
#    endif()
#
 #   if(NOT HAVE_TORCH_EXE)
  #      message(FATAL_ERROR "Torch executable \"th\" not found or nn module not found")
   # endif()

#    add_custom_command( TARGET opencv_test_${name} POST_BUILD
#                        COMMAND th ${CMAKE_CURRENT_SOURCE_DIR}/testdata/dnn/torch/#torch_gen_test_data.lua
 #                       WORKING_DIRECTORY  $ENV{OPENCV_TEST_DATA_PATH}/dnn/torch )
  #  add_definitions(-DENABLE_TORCH_TESTS=1)
#endif()

相关内容