Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version


Well the solution was easy .. found it here

I needed to assign a gpuMat for the output. The code becomes :

static cv::Mat InversePerspectiveMapping(cv::Mat input, int w, int h, bool transform_order, bool display, int n) // w : width and h : height

cv::Mat output, M;  //create the output matrice

if (transform_order == true)    {M = cv::getPerspectiveTransform(src_pts, dst_pts); } // calculation of the transform matrix 
else                {M = cv::getPerspectiveTransform(dst_pts, src_pts); } // Calculation of the inverse transfrom matrix

cv::cuda::GpuMat gpuOutput; 
cv::cuda::GpuMat gpuInput = cv::cuda::GpuMat(input);

cv::cuda::warpPerspective( gpuInput, gpuOutput, M, cv::Size(w,h), INTER_LINEAR , BORDER_CONSTANT, 0, Stream::Null() );;

imshow("left_IPM", output);
return output;