gpt4 book ai didi

c++ - OpenCV 3.0 错误包含 ocl.hpp

转载 作者:太空宇宙 更新时间:2023-11-03 23:18:55 25 4
gpt4 key购买 nike

我在 ubuntu 14.04 中使用 opencv 3.0.0。我安装了 AMD Catalyst 视频驱动程序以将 OpenCV 与 OpenCL 结合使用。

/etc/OpenCL/vendor 有“amdocl32.icd amdocl64”.icd 和“libamdocl32.so”和“libamdocl64.so”。

在 opencv cmake 文件中,OpenCV 显示为:

--   OpenCV modules:
-- To be built: hal core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz
-- OpenCL:
-- Version: dynamic
-- Include path: /home/eduardo/Install-OpenCV/Ubuntu/OpenCV/opencv-3.0.0/3rdparty/include/opencl/1.2
-- Use AMDFFT: NO
-- Use AMDBLAS: NO
-- Use OpenCL: YES

当我在我的项目中包含 ocl.hpp 文件时 (#include)。编译器返回他的信息:

In file included from main.cpp:11:0:
/usr/include/opencv2/ocl/ocl.hpp: In member function ‘cv::ocl::Hamming::ResultType cv::ocl::Hamming::operator()(const unsigned char*, const unsigned char*, int) const’:
/usr/include/opencv2/ocl/ocl.hpp:1170:46: error: ‘normHamming’ was not declared in this scope
return normHamming(a, b, size);
^
/usr/include/opencv2/ocl/ocl.hpp:1170:46: note: suggested alternative:
In file included from /usr/local/include/opencv2/core/base.hpp:56:0,
from /usr/local/include/opencv2/core.hpp:54,
from /usr/local/include/opencv2/core/core.hpp:48,
from /usr/include/opencv2/ocl/ocl.hpp:50,
from main.cpp:11:
/usr/local/include/opencv2/hal.hpp:70:5: note: ‘cv::hal::normHamming’
int normHamming(const uchar* a, const uchar* b, int n, int cellSize);
^
In file included from main.cpp:11:0:
/usr/include/opencv2/ocl/ocl.hpp: At global scope:
/usr/include/opencv2/ocl/ocl.hpp:1932:9: error: expected class-name before ‘{’ token
{
^
/usr/include/opencv2/ocl/ocl.hpp:1950:9: error: expected class-name before ‘{’ token
{
^
/usr/include/opencv2/ocl/ocl.hpp:1956:23: error: ‘CvSVMParams’ has not been declared
CvSVMParams params=CvSVMParams());
^
/usr/include/opencv2/ocl/ocl.hpp:1956:54: error: ‘CvSVMParams’ was not declared in this scope
CvSVMParams params=CvSVMParams());
^
make: *** [main.o] Error 1`

我需要在 GPU 上测试腐 eclipse 和扩张过滤器。

有人知道为什么会这样吗?

最佳答案

你不应该包括 ocl.hpp进入基于OpenCV 3.0 的项目以使用ocl::function_name符号。

编辑another ocl.hppOpenCV 3.0 中 - 它的含义与在 2.4 分支中完全不同:在后一种情况下,有所有 opencl 收费的函数定义,并且在OpenCV 3.0 是平台、上下文和设备相关的信息或调整。它可以包含在这个命令中:

#include <opencv2/core/ocl.hpp>

你的 ocl.hpp取自 /usr/include/ - 似乎您的系统中还安装了一些 OpenCV 2.4.x 开发包 - 这是一个不同的分支,为了更好地清除,请删除所有 libopencv*-dev包。如果您只想使用 3.0 版本,它将帮助您(将删除不明确的 header )。

你应该运行 make installcmake <your opencv 3.0 source dir> 之后和 make - 它会将所有必要的东西安装到您的系统中。默认情况下,所有标题都在 /usr/local/include 中文件夹。

关于c++ - OpenCV 3.0 错误包含 ocl.hpp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34422276/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com