Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to compile a sample code written using Opencv cpp libraries and CUDA .

Can some one please guide me compiling a sample code, which loads and display an image. Code is written using OpecnCV libraries and certain CUDA properties.

nvcc pkg-config --libs opencv -L. -L/usr/local/cuda/lib -lcuda -lcudart pkg-config --cflags opencv -I. -I/usr/local /cuda/include LoadDisplayImageViaGPU.cu -o LoadDisplayImageViaGPU.out

Above given is the way how I tried to compile. It gave me following errors.

tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text+0x6e): undefined reference to cv::imread(std::string const&, int)' tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text+0xc0): undefined reference tocv::gpu::GpuMat::upload(cv::Mat const&)' tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text+0xc5): undefined reference to cv::gpu::Stream::Null()' tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text+0x118): undefined reference tocv::gpu::threshold(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, double, double, int, cv::gpu::Stream&)' tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text+0x13a): undefined reference to cv::gpu::GpuMat::download(cv::Mat&) const' tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text+0x150): undefined reference tocv::_InputArray::_InputArray(cv::Mat const&)' tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text+0x193): undefined reference to cv::imshow(std::string const&, cv::_InputArray const&)' tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text+0x1bb): undefined reference tocv::waitKey(int)' /tmp/tmpxft_00000a84_00000000-17_LoadDisplayImageViaGPU.o: In function cv::Mat::~Mat()': tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference tocv::fastFree(void*)' /tmp/tmpxft_00000a84_00000000-17_LoadDisplayImageViaGPU.o: In function cv::Mat::release()': tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference tocv::Mat::deallocate()' /tmp/tmpxft_00000a84_00000000-17_LoadDisplayImageViaGPU.o: In function cv::gpu::GpuMat::~GpuMat()': tmpxft_00000a84_00000000-4_LoadDisplayImageViaGPU.cudafe1.cpp:(.text._ZN2cv3gpu6GpuMatD2Ev[_ZN2cv3gpu6GpuMatD5Ev]+0x14): undefined reference tocv::gpu::GpuMat::release()' /tmp/tmpxft_00000a84_00000000-17_LoadDisplayImageViaGPU.o:(.gcc_except_table+0x60): undefined reference to `typeinfo for cv::Exception' collect2: error: ld returned 1 exit status

Can someone please help me