2015-06-08 23:34:29 -0600 | asked a question | gpu::warpPerspective and warpPerspective return different mats Hi all I have a very basic question - I am new to OpenCV and CV in general. This question is related to OpenCV 2.4. I am currently using the github version of OpenCV with the following tag: remotes/origin/2.4 found at: https://github.com/Itseez/opencv I am doing experiments on Nvidia GPUs with the CUDA support and calling the warpPerspective function offered for the host and the GPU. Even if I am passing warpPerspective the very same input (properly transferred to GPU memory when needed) I obtain different results. My experiments are on an Intel box with a K20Xm GPU. Here is a code snippet representing what I am doing: // declare maskin and maskout and fill maskin up Mat maskin ...; Mat maskout ...; // transfer input to gpu gpu::GpuMat maskin_gpu; maskin_gpu.upload (maskin); // allocate output on GPU and corresponding CPU version for checking gpu::GpuMat maskout_gpu (maskout.size (), maskout.type ()); Mat maskout_check (maskout.size(), maskout.type()); gpu::warpPerspective (maskin_gpu, maskout_gpu, myH, size); // transfer back GPU-->HOST the result into maskout_check maskout_gpu.download (maskout_check); // now do same calculation on CPU warpPerspective (maskin, maskout, myH, size); // check results Mat diffMask = maskout != maskout_check; int numNoZero = cv::countNonZero(diffMask); if (numNoZero > 0) { printf ("Drats..\n"); } Printing the number of non-zeros gives me about ~2000 mismatches for 720x480 Mats based on CV_8U elements. What is it that I am doing wrong? Is this supposed to happen because of re-ordering of operations in the GPU code? Thanks!! -- Carlo |