OpenCV on Carma Kit (Tegra3 with Cuda) with GPU support

Hi,

I’m trying to cross-compile OpenCV with CUDA support to activate gpu module, but I think that something is missing.

CMake configuration goes right, until it fails searching for libnvcuvid.so.
Since it is a library that on desktop Ubuntu systems is installed with developer driver, I searched for that file on Carma Kit filesystem, but I could not find it.

Do you know if the developer driver is installed on CarmaKit board?

Thank you
Walter

The current OpenCV GIT repository has changes for CARMA:

git clone git://code.opencv.org/opencv.git
cd opencv

Most notably, OpenCV has a toolchain file for cross compiling:

cmake -DCMAKE_TOOLCHAIN_FILE=/modules/gpu/misc/carma.toolchain.cmake

note: the latest cmake is required when building OpenCV with CUDA, and cmake should be obtained from their website, the Ubuntu distribution version of cmake may not work for OpenCV with CUDA enabled.

ARM CUDA toolkit will need to be installed on the host.

there is a flag “WITH_NVCUVID” to disable the nvcuvid dependency.

Thank you for your reply.
I’m going to get latest trunk and to test the cross-compilation.

As host I’m using a Virtual Machine based on Ubuntu 11.04 32bit, according to a guide provided by Seco with CarmaKit.
Do you think that this is the best cobiguration to cross-compile?

Hi mfatica,

I followed the instructions for cross-compiling OpenCV with CUDA per http://code.opencv.org/projects/opencv/wiki/CARMA_platform_compilation_and_testing . About 21% through the build I get an error @ the cuda_compil_generated_matrix_operations.cu.o NVCC build state.

nvcc fatal : redefinition of argument ‘compiler-bindir’

I’ll probably start looking for the redefinition this weekend but I was wondering if anyone has had the same issue… I’m using a Natty distro and 64bit system (w/ ia32 libs installed).

That’s all for now, any help is appreciated.

Thanks.

Figured it out. I was using CCMake to try some different things and it was monkeying with some of the variables.

Also, if anyone reads this I would be curious as to if anyone has nvcc reject some architectures (21 & 35)

I had to use the following flags because nvcc wasn’t happy with anything else:

-DCUDA_ARCH_BIN:STRING=“2.0 3.0” -DCUDA_ARCH_PTX:STRING=“”

I’m pretty happy that people worked to get OpenCV compatible with the CARMA system so thank you very much to those that worked on the changes and documentation.

I have completed compiling opencv for Carma board with Cuda enable.

However when I tried to run a simple code, i always got segmentation errors. But if i just commented out gpu functions, the program run well.

Do you have any ideas about this issue?? Thanks Below is my sample code:

int main (int argc, char* argv)

{ try { gpu::getCudaEnabledDeviceCount(); Mat src_host = imread(“sample.bmp”, IMREAD_GRAYSCALE); gpu::GpuMat src,dst;

src.upload(src_host);

//gpu::transpose(src,dst);
//gpu::Canny(src,dst,100,100,3,false);
//gpu::cvtColor(src, dst, CV_YUV2RGB);

gpu::blur(src,dst,Size(3,3));
//gpu::cvtColor(src,dst,CV_BGR2GRAY);

Mat result_host(src);
imwrite("output.bmp",result_host);
waitKey();

}
catch(const cv::Exception& ex)
{
cout <<“Exception happened\n”;
system(“pause”);
}

return 0;
}

Problem solved. Please refer to my blog if you face the same problem.
http://multicoresamples.blogspot.com/