我是靠谱客的博主 闪闪外套,最近开发中收集的这篇文章主要介绍cnn-crf-stereo测试-----stereo-net安装编译方法,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

打开stereo文件夹

sudo mkdir build
cd build

打开build文件夹

sudo cmake ../../stereo

出现错误

CMake Error at /home/jennifer/stereoCode/cnn-crf-stereo/dependencies/imageutilities/ImageUtilitiesConfig.cmake:157 (find_package):
  Found package configuration file:

    /usr/local/opencv310/cmake/OpenCVConfig.cmake

  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
  NOT FOUND.
Call Stack (most recent call first):
  CMakeLists.txt:38 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/jennifer/stereoCode/cnn-crf-stereo/stereo/build/CMakeFiles/CMakeOutput.log".
See also "/home/jennifer/stereoCode/cnn-crf-stereo/stereo/build/CMakeFiles/CMakeError.log".

原因是没有指定opencv的路径,打开stereo文件夹中的CMakeLists.txt文件,加入:

set(OpenCV_DIR "/usr/local/opencv310/build")
顺利进行
link dirs /home/jennifer/stereoCode/cnn-crf-stereo/dependencies/imageutilities/lib/libiumath.so;/usr/local/cuda/lib64/libcufft.so;/usr/local/lib/libHalf.so;/usr/local/lib/libIex.so;/usr/local/lib/libIlmImf.so;/usr/local/lib/libIlmThread.so;/usr/local/lib/libImath.so;opencv_core;opencv_highgui;opencv_videoio;opencv_core;opencv_imgcodecs;opencv_imgproc;opencv_highgui;opencv_core;opencv_highgui;opencv_videoio;opencv_core;opencv_imgcodecs;opencv_imgproc;opencv_highgui;/home/jennifer/stereoCode/cnn-crf-stereo/stereo/../dependencies/slackprop/lib/libslack_prop.so;cnpy
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jennifer/stereoCode/cnn-crf-stereo/stereo/build
Cmake顺利,但是sudo make -j4出现错误:

CMakeFiles/stereo_img.dir/stereo_img.cpp.o:在函数‘main’中:
/home/jennifer/stereoCode/cnn-crf-stereo/stereo/stereo_img.cpp:139:对‘iu::imread_32f_C4(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)’未定义的引用
/home/jennifer/stereoCode/cnn-crf-stereo/stereo/stereo_img.cpp:140:对‘iu::imread_32f_C4(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)’未定义的引用
libstereo.so:对‘iu::copy(iu::LinearHostMemory<float, 1u> const*, iu::LinearDeviceMemory<float, 1u>*)’未定义的引用
libstereo.so:对‘iu::copy(iu::ImageCpu<float, iuprivate::ImageAllocatorCpu<float> > const*, iu::ImageGpu<float, iuprivate::ImageAllocatorGpu<float> >*)’未定义的引用
libstereo.so:对‘iu::copy(iu::LinearDeviceMemory<float, 1u> const*, iu::LinearHostMemory<float, 1u>*)’未定义的引用
libstereo.so:对‘iu::filterGauss(iu::ImageGpu<float, iuprivate::ImageAllocatorGpu<float> > const*, iu::ImageGpu<float, iuprivate::ImageAllocatorGpu<float> >*, float, int, iu::ImageGpu<float, iuprivate::ImageAllocatorGpu<float> >*)’未定义的引用
libstereo.so:对‘iu::copy(iu::ImageGpu<float, iuprivate::ImageAllocatorGpu<float> > const*, iu::ImageCpu<float, iuprivate::ImageAllocatorCpu<float> >*)’未定义的引用
libstereo.so:对‘iu::copy(iu::ImageCpu<float4, iuprivate::ImageAllocatorCpu<float4> > const*, iu::ImageGpu<float4, iuprivate::ImageAllocatorGpu<float4> >*)’未定义的引用
libstereo.so:对‘iu::copy(iu::ImageGpu<int, iuprivate::ImageAllocatorGpu<int> > const*, iu::ImageCpu<int, iuprivate::ImageAllocatorCpu<int> >*)’未定义的引用
libstereo.so:对‘iu::copy(iu::ImageGpu<float, iuprivate::ImageAllocatorGpu<float> > const*, iu::ImageGpu<float, iuprivate::ImageAllocatorGpu<float> >*)’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/stereo_img.dir/build.make:124: recipe for target 'stereo_img' failed
make[2]: *** [stereo_img] Error 1
CMakeFiles/Makefile2:142: recipe for target 'CMakeFiles/stereo_img.dir/all' failed
make[1]: *** [CMakeFiles/stereo_img.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

原因在于缺失关于iuio的链接,因此修改CmakeLists.TXt文件:

SET(EXTERN_LIBS ${EXTERN_LIBS} ${ImageUtilities_DIR}/lib/libiuio.so)

cuda_include_directories(${IMAGEUTILITIES_INCLUDE_DIR})
include_directories(${IMAGEUTILITIES_INCLUDE_DIR})
SET(EXTERN_LIBS ${EXTERN_LIBS} ${IMAGEUTILITIES_LIBRARIES})
SET(EXTERN_LIBS ${EXTERN_LIBS} ${ImageUtilities_DIR}/lib/libiuio.so)
include(../cmake/compiler_settings.cmake.txt)

顺利进行make

jennifer@Jennifer:~/stereoCode/cnn-crf-stereo/build$ sudo make -j4
[  5%] Building NVCC (Device) object CMakeFiles/cudnn_stereo.dir/operators/cudnn_stereo_generated_stereocorrelation.cu.o
[ 10%] Building NVCC (Device) object CMakeFiles/cudnn_stereo.dir/cudnn_stereo_generated_utils.cu.o
[ 15%] Building CXX object CMakeFiles/cudnn_stereo.dir/stereonet.cpp.o
[ 21%] Building CXX object CMakeFiles/cudnn_stereo.dir/operators/operator.cpp.o
[ 26%] Building CXX object CMakeFiles/cudnn_stereo.dir/colorstereonet.cpp.o
[ 31%] Building CXX object CMakeFiles/cudnn_stereo.dir/utils.cpp.o
[ 36%] Building CXX object CMakeFiles/cudnn_stereo.dir/operators/bias.cpp.o
[ 42%] Building CXX object CMakeFiles/cudnn_stereo.dir/operators/activation.cpp.o
[ 47%] Building CXX object CMakeFiles/cudnn_stereo.dir/operators/softmax.cpp.o
[ 52%] Building CXX object CMakeFiles/cudnn_stereo.dir/operators/convolution.cpp.o
[ 57%] Building CXX object CMakeFiles/cudnn_stereo.dir/operators/stereocorrelation.cpp.o
[ 63%] Building CXX object CMakeFiles/cudnn_stereo.dir/operators/slackprop.cpp.o
[ 68%] Linking CXX shared library libcudnn_stereo.so
[ 68%] Built target cudnn_stereo
[ 73%] Building NVCC (Device) object CMakeFiles/stereo.dir/stereo_generated_stereo.cu.o
[ 78%] Building CXX object CMakeFiles/stereo.dir/tools.cpp.o
[ 84%] Building CXX object CMakeFiles/stereo.dir/stereo.cpp.o
/home/jennifer/stereoCode/cnn-crf-stereo/stereo/tools.cpp: In function ‘void saveMatPython2(std::__cxx11::string, iu::LinearDeviceMemory_32f_C1*, int, int, int)’:
/home/jennifer/stereoCode/cnn-crf-stereo/stereo/tools.cpp:90:53: warning: narrowing conversion of ‘height’ from ‘int’ to ‘unsigned int’ inside { } [-Wnarrowing]
     const unsigned int shape[] = {height,width,depth};
                                                     ^
/home/jennifer/stereoCode/cnn-crf-stereo/stereo/tools.cpp:90:53: warning: narrowing conversion of ‘width’ from ‘int’ to ‘unsigned int’ inside { } [-Wnarrowing]
/home/jennifer/stereoCode/cnn-crf-stereo/stereo/tools.cpp:90:53: warning: narrowing conversion of ‘depth’ from ‘int’ to ‘unsigned int’ inside { } [-Wnarrowing]
[ 89%] Linking CXX shared library libstereo.so
[ 89%] Built target stereo
[ 94%] Building CXX object CMakeFiles/stereo_img.dir/stereo_img.cpp.o
SET(EXTERN_LIBS ${EXTERN_LIBS} ${ImageUtilities_DIR}/lib/libiuio.so)[100%] Linking CXX executable stereo_img
[100%] Built target stereo_img

在build文件夹中生成可执行文件stereo_img, 运行可执行文件 ,计算视差图

jennifer@Jennifer:/media/jennifer/SOFTWARE/gitCode/cnn-crf-stereo/build$ ./stereo_img --im0 ../data/im0.png --im1 ../data/im1.png

terminate called after throwing an instance of 'IuCudaException'
  what():  IuException: CUDA Error: unknown error
      where: /home/jennifer/stereoCode/cnn-crf-stereo/dependencies/imageutilities/include/iu/iucore/image_allocator_gpu.h | alloc:21
已放弃 (核心已转储)
jennifer@Jennifer:/media/jennifer/SOFTWARE/gitCode/cnn-crf-stereo/build$ sudo ./stereo_img --im0 ../data/im0.png --im1 ../data/im1.png
[sudo] jennifer 的密码:
jennifer@Jennifer:/media/jennifer/SOFTWARE/gitCode/cnn-crf-stereo/build$

最后

以上就是闪闪外套为你收集整理的cnn-crf-stereo测试-----stereo-net安装编译方法的全部内容,希望文章能够帮你解决cnn-crf-stereo测试-----stereo-net安装编译方法所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(45)

评论列表共有 0 条评论

立即
投稿
返回
顶部