1
votes

I am using opencv 3.0.0 in ubuntu 14.04. I install the AMD Catalyst Video Driver to use OpenCV with OpenCL.

The /etc/OpenCL/vendor have "amdocl32.icd amdocl64".icd with "libamdocl32.so" and "libamdocl64.so".

In the opencv cmake file, the OpenCV appears as:

--   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

When I include the ocl.hpp file in my projet (#include ). The compiler return his message:

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`

I need test the erode and dilate filter on GPU.

Do someone know why is this happening?

1

1 Answers

0
votes

You should not include ocl.hpp into projects based on OpenCV 3.0 for using ocl::function_name notation.

EDIT: there is another ocl.hpp in OpenCV 3.0 - its sense is completely different than in 2.4 branch: in the latter case there are all opencl-charged function definitions, and in OpenCV 3.0 it is platform, context and device related information or tuning. It can be included with this command:

#include <opencv2/core/ocl.hpp>

Your ocl.hpp was taken from /usr/include/ - it seems that you also have some OpenCV 2.4.x development packages installed in your system - it's a different branch, for better clearance please remove all libopencv*-dev packages. It will help you (will remove ambiguous headers) if you want to use only 3.0 version.

You should run make install after cmake <your opencv 3.0 source dir> and make - it will install all necessary stuff into your system. By default all headers will be in /usr/local/include folder.