Ask Your Question

ken83's profile - activity

2014-03-04 07:35:19 -0600 received badge  Scholar (source)
2014-03-02 00:57:38 -0600 commented answer Direct access to pixel by oclMat.

Thank you for your quick reply. I will try create OpenCL kernel code.

2014-03-01 23:11:21 -0600 asked a question Direct access to pixel by oclMat.

I have tried direct access to pixel so as to change its color by the following source code. (Underlying environment is the NVIDIA GeForce and Windows Vista 32bit.It is working fine initialization of ocl (ocl :: setDiveice ()) is.)


cv::Mat src = cv::imread("c:\temp\test.jpg");

cv::Mat dst(Size(src.cols,src.rows),CV_8UC3);

cv::ocl::oclMat omat(src);

for(int x = 0;x < omat.cols; x++){

for(int y = 0;y < omat.rows;y ++){

    omat.data[y * omat.step + x * omat.oclchannels() + 0] = (uchar)255; //* memory access error(0xC0000005)

    omat.data[y * omat.step + x * omat.oclchannels() + 1] = (uchar)0;

    omat.data[y * omat.step + x * omat.oclchannels() + 2] = (uchar)0;

}

}

omat.download(dst);


Memory access error is occured in the about source code. I studied oclMat data structure according to the following (http://docs.opencv.org/modules/ocl/doc/data_structures.html), but i wonder in actual way how to access oclMat data. Please suggest me.

Thank you, in favor.