Ask Your Question

aurelien's profile - activity

2014-06-02 03:28:54 -0600 asked a question How opencv_gpu multiplication works for big images

Hi, I would like to know if someone can explain me how OpenCV computes multiplication for very big image (1920*1080). I have to create a specific image processing but my kernel is very slow. So I have created a kernel for just a multiplication. It takes 45ms against 0ms (1ms) with OpenCV_gpu multiplication. How to optimize the number of thread and wrap for my application (for my real application I use 7 ints and 9 floats for my computation)?

2014-05-13 05:02:23 -0600 asked a question how to add .cu file to OPENCV source without obtain linked error

Hi everybody. I would like to know how to add .cu file to the OPENCV source. To test a CUDA function, I have written a simple function who adds a value to all pixels of matrix. But when I compile the project, I obtain link error. I follow the same scheme as for pyrup functions: - Templates functions in .cu file - I create the declaration of the host function in the gpu.hpp file and I create a .cpp file in which I define the host function (which called the CUDA function). If I put my function in original sources files (pyr_up.cu , gpu.hpp, pyramids.cpp), I can build the solution and access to the function, but not if I create new files… I’ve got one error by each type of data, they all looks like to : Erreur 101 error LNK2001: symbole externe non résolu "void __cdecl cv::gpu::device::imgproc::test_gpu<float>(struct cv::gpu::DevMem2D_<unsigned char="">,struct cv::gpu::DevMem2D_<unsigned char="">,struct CUstream_st *)" (??$test_gpu@M@imgproc@device@gpu@cv@@YAXU?$DevMem2D_@E@23@0PAUCUstream_st@@@Z) F:\install_opencv_cuda_modif\modules\gpu\testCuda.obj

2014-02-17 00:59:19 -0600 answered a question why the result of filter2D function is correct on cpu and wrong on gpu??

Thanks a lot ;-)

2014-02-17 00:56:01 -0600 received badge  Scholar (source)
2014-02-13 05:09:36 -0600 asked a question why the result of filter2D function is correct on cpu and wrong on gpu??

The processing on the GPU give me wrong result and noise(not randomly). This is my code :

Mat ker(3,3,CV_8S);
// gain=0
ker.at<char>(0,0)=-(1+gain),ker.at<char>(0,1)=-(1+gain),ker.at<char>(0,2)=-(1+gain);
ker.at<char>(1,0)=-(1+gain),ker.at<char>(1,1)=(1+gain)*8,ker.at<char>(1,2)=-(1+gain);
ker.at<char>(2,0)=-(1+gain),ker.at<char>(2,1)=-(1+gain),ker.at<char>(2,2)=-(1+gain);
Mat test(taille,taille,CV_8UC1,125);
for(int x=0;x<taille;x++)
{
    for(int y=0;y<taille;y++)
    {
     //   test.at<uchar>(y,x)=((x%2)^(y%2))*255; //corect
            test.at<uchar>(y,x)=x+y;
    }
}
Mat res;
Mat temp;
test.copyTo((temp,test));
GpuMat resgpu(test);

test.copyTo(res,test);
filter2D(res,res,res.depth(),ker);
filter2D(resgpu,resgpu,resgpu.depth(),ker);
vector<int> compression_params;
compression_params.push_back(CV_IMWRITE_JPEG_QUALITY );
compression_params.push_back(100);

imwrite("aze.jpg",test,compression_params);
imwrite("aze_filtre.jpg",res,compression_params);
imwrite("aze_filtre_gpu.jpg",Mat(resgpu),compression_params);

correct:cpu:

image description:

wrong:gpu:

image description