Ask Your Question

Best way to add new projects/files using Opencv and OCL

asked 2013-09-24 12:09:15 -0500

mainul gravatar image

updated 2013-09-24 13:33:25 -0500

berak gravatar image


I have written some custom codes for facedetection that uses Opencv's libraries and opencl function. I copied my files in the sample folders and tried to compile but I got several errors. Most of them occurs because it cannot link the OpenCV files and OPencl files. So, I manually put the full path of the files in the headers of my files as well as Opencv's files. For example, I got an error that cl_mem is not declared in the scope. To overcome this I had to put the full path of CL.h to all the dependent files. This process worked and the program compiled successfully.

But I think this is not a good approach to manually put the path of dependent files in the header. The samples provided by opencv can easily link all the necessary files. So, there must be way that will automatically link any new files with opencv and opencl's dependent files.

So, I need your suggestion regarding the best way of adding new projrcts/files so that they can automatically link all the OpenCL and OpenCV files.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-09-24 13:32:32 -0500

berak gravatar image

did you try to generate your project / makefile using cmake ?

edit / save the txt below to CMakeLists.txt in your code folder and run cmake there in the same way you did for building opencv.

cmake_minimum_required (VERSION 2.8) 


PROJECT(MyProject) # change this! (project_name)
    main.cpp       # change this! (src files)
edit flag offensive delete link more


Thanks for your answer. I did it in another way. I will do that in your way too. On a different note I have one question. I am running codes on an arm architecture. It stops while calling kernel and got timeout. I would like to know which function is getting the error. So I want to have some printf statements inside the initialization file. I added some lines and recompile opencv but when running the program nothing printed from initialization file. Do you know how I can make initialization file print something?

mainul gravatar imagemainul ( 2013-09-26 12:52:42 -0500 )edit

oh, sorry, totally over my head ;(

berak gravatar imageberak ( 2013-09-26 13:10:13 -0500 )edit

Question Tools


Asked: 2013-09-24 12:09:15 -0500

Seen: 146 times

Last updated: Sep 24 '13