Ask Your Question

pengx's profile - activity

2014-02-25 22:10:22 -0500 answered a question Load cascade classifier from memory?

I have put an valid implementation about this on github. see

2013-04-12 15:05:51 -0500 received badge  Nice Answer (source)
2013-04-11 22:44:03 -0500 received badge  Critic (source)
2013-04-09 22:14:36 -0500 commented question Executable never terminates when using OpenCL functions

I guess this may be due to memory leak bug of the ocl module.

2013-04-03 02:37:23 -0500 answered a question OCL error - cl_khr_fp64

Hi, this is a known bug and it should have been fixed now. Can you try it again?

2013-03-25 03:59:46 -0500 received badge  Good Answer (source)
2013-03-24 06:47:08 -0500 received badge  Nice Answer (source)
2012-08-20 00:44:43 -0500 received badge  Editor (source)
2012-08-20 00:42:54 -0500 answered a question findChessBoardCorners work on some images but fail in others

I think findChessBoardCorners function is dedicated for camera calibration and not suitable for finding cross corners on cylindrical chess pattern.

In the document description it says:

Note: The function requires white space (like a square-thick border, the wider the better) around the board to make the detection more robust in various environments. Otherwise, if there is no border and the background is dark, the outer black squares cannot be segmented properly and so the square grouping and ordering algorithm fails.

Maybe you need to think about another method for your problem.

2012-08-20 00:28:49 -0500 commented answer Opencl support (bm,sgbm etc)

I just pulled the latest trunk repository and built with mingw-32. I tried to run the ocl test cases, but there were no problem at all.

2012-08-19 20:34:25 -0500 answered a question how to download from code.opencv
2012-08-19 03:05:30 -0500 commented answer Opencl support (bm,sgbm etc)

I am using 64 bit Win 7 as well but developing with Visual Studio 2010 at 32 bit. Can you try visual studio compiler instead of MinGW to see if it works?

2012-08-18 22:30:19 -0500 received badge  Supporter (source)
2012-08-18 22:27:27 -0500 received badge  Autobiographer
2012-08-18 14:32:35 -0500 received badge  Teacher (source)
2012-08-18 11:05:25 -0500 commented answer Opencl support (bm,sgbm etc)

Oh I never tried to use MinGW compiler on Windows. I did not know if there are OpenCV OCL module developers tried to compile it with MinGW, but I found a thread regarding a similar crashing problem with you on AMD support forum. I will ask the QA team to compile OCL module with MinGW on Windows later. Hopefully I will get the feedback sometime next week.

2012-08-18 04:23:47 -0500 commented answer Opencl support (bm,sgbm etc)

What's your AMD APP SDK version ? And make sure link correct OpenCL.lib file.

2012-08-18 00:52:19 -0500 commented question cv::FileStorage for custom Types Problem

I am not sure if the code you pasted above is correct or not, but write and read functions in the code snippet you provided are for instances of class BpcaParams not Alg_Params.

2012-08-18 00:48:50 -0500 answered a question Opencl support (bm,sgbm etc)

Using ocl module is pretty much alike using gpu module. To use OCL module, you must call getDevice() once before call any of the ocl module functions. It is like this:

vector<ocl::Info> info;

This function will detect if there is any valid GPU devices in all OpenCL enabled platforms on your machine; particularly, the ocl module should have best compatibility with an AMD graphic card.

Most ocl module functions require input matrices of type oclMat. oclMat is similar with Mat, but it encapsulates some OpenCL device's buffer object (cl_mem) and controls buffer release, transferring, etc. To convert a Mat to an oclMat object, simply call

oclMat myOclMat(mat); // mat is a Mat object

Alternatively, you could explicitly call

oclMat myOclMat;

oclMat then can be fed into ocl module functions once the memory data is uploaded to opencl device's memory. To access the oclMat's data, you need to download the gpu buffer data into host memory. Similar with upload operations, you could either call

mat = Mat(myOclMat);


Normally you do not need to worry about memory releasing. oclMat will deconstruct its encapsulated cl_mem buffer once they are not referenced any more.

To sum up,

, the usage of the OCL module is simply:

  1. globally register an OpenCL device // call ocl::getDevice()

  2. transfer from host memory to gpu memory // convert Mat to oclMat

  3. Do the calculations on OpenCL device // call ocl module functions,

  4. transfer back from gpu memory to host memory // convert oclMat to Mat

  5. Do rest calculations with Mat

There is some sample ocl module programs provided in the trunk repository. You could refer to them as a start.

BTW, if you are not familiar with OpenCL, I recommend you to read some basics about OpenCL's basics before include OpenCL into your project.

2012-08-17 22:43:39 -0500 answered a question cv::FileStorage for custom Types Problem

I am not sure if the code you pasted above is correct or not, but write and read functions in the code snippet you provided are for instances of class BpcaParams not Alg_Params.