opencv - 在没有 GPU 的情况下编译 OpenCV?

标签 opencv cmake gpu

我刚从 OpenCV/build 运行 cmake -D CMAKE_BUILD_TYPE=RELEASE ..,得到我的输出:

--   OpenCV modules:
--     To be built:                 core imgproc flann highgui features2d calib3d ml video
                                    objdetect contrib nonfree gpu legacy photo python
                                    stitching ts videostab
--     Disabled:                    -
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera java world

问题是,使用gpu 编译失败,可能是因为我的机器没有? (这是一个 EC2 实例)。

make 失败并出现奇怪的错误:

Scanning dependencies of target opencv_test_gpu
[ 72%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_gpumat.cpp.o
[ 72%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/utility.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_filters.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_copy_make_border.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/main.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_threshold.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_video.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_core.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
make[2]: *** [modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_core.cpp.o] Error 4
make[1]: *** [modules/gpu/CMakeFiles/opencv_test_gpu.dir/all] Error 2
make: *** [all] Error 2

我试过使用标志 -DOPENCV_MODULES_DISABLED_USER="gpu" 但它会产生奇怪的输出,其中 gpu 被列为 to be built < em>和 已禁用

--   OpenCV modules:
--     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree gpu legacy photo python stitching ts videostab
--     Disabled:                    gpu
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera java world

如何在没有 gpu 的情况下进行编译?

最佳答案

要禁止构建特定模块,请使用

-D BUILD_opencv_{modulename}=OFF

在这种情况下,使用

-D BUILD_opencv_gpu=OFF

关于opencv - 在没有 GPU 的情况下编译 OpenCV?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15161278/

相关文章:

c++ - Cmake 找到 hdf5 但尝试链接到 Windows 上的 dll

c++ - 我该如何解决CUDA编程中的 fatal error C1070:文件中的#if/#endif对不匹配?

c++ - 如何切换范围为 [0,1] 的矩阵中的元素?

image - 使用阈值进行分割

python - OpenCV:去除背景噪音并增加信号强度

c++ - 通过更改代码格式计算结构 vector 中包含的双变量的平均值的不同结果?

c++ - 如何在 Windows 上使用 CMake 和 Eclipse CDT 创建 GTK3 应用程序

c# - 尝试使用来自 bp-kelley/rdkit-csharp 的 build.bat 为 RDKit 构建 C# 包装器

gpgpu - CPU和GPU之间的指令传输

gpu - 如何使用 Slurm 访问集群中不同节点上的 GPU?