From b181d78ca5e67ec987c67e89483b44421d4b6c36 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 15 Sep 2010 12:47:59 +0000 Subject: [PATCH] Added implementation and test for the GPU version of warpAffine, warpPerspective, rotate, based on NPP. Renamed copyConstBorder to copyMakeBorder. Fixed warnings when HAVE_CUDA is not defined. --- modules/gpu/include/opencv2/gpu/gpu.hpp | 17 +- modules/gpu/src/arithm.cpp | 229 ++++++++++++++++++++++-- modules/gpu/src/imgproc_gpu.cpp | 4 +- tests/gpu/src/npp_image_arithm.cpp | 91 +++++++++- 4 files changed, 313 insertions(+), 28 deletions(-) diff --git a/modules/gpu/include/opencv2/gpu/gpu.hpp b/modules/gpu/include/opencv2/gpu/gpu.hpp index d146ee88af..47e36fd456 100644 --- a/modules/gpu/include/opencv2/gpu/gpu.hpp +++ b/modules/gpu/include/opencv2/gpu/gpu.hpp @@ -385,7 +385,7 @@ namespace cv //! resizes the image //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, INTER_LANCZOS4 - CV_EXPORTS void resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation=INTER_LINEAR); + CV_EXPORTS void resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR); //! computes sum of array elements CV_EXPORTS Scalar sum(const GpuMat& m); @@ -394,9 +394,22 @@ namespace cv CV_EXPORTS void minMax(const GpuMat& src, double* minVal, double* maxVal = 0); //! copies 2D array to a larger destination array and pads borders with user-specifiable constant - CV_EXPORTS void copyConstBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value = Scalar()); + CV_EXPORTS void copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value = Scalar()); + + //! warps the image using affine transformation + //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC + CV_EXPORTS void warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR); + + //! warps the image using perspective transformation + //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC + CV_EXPORTS void warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR); + + //! rotate 8bit single or four channel image + //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC + CV_EXPORTS void rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, int interpolation = INTER_LINEAR); ////////////////////////////// Image processing ////////////////////////////// + // DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation. // xymap.type() == xymap.type() == CV_32FC1 CV_EXPORTS void remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap); diff --git a/modules/gpu/src/arithm.cpp b/modules/gpu/src/arithm.cpp index 295827a4ae..0902ab7044 100644 --- a/modules/gpu/src/arithm.cpp +++ b/modules/gpu/src/arithm.cpp @@ -48,38 +48,57 @@ using namespace std; #if !defined (HAVE_CUDA) -void cv::gpu::add(const GpuMat& src1, const GpuMat& src2, GpuMat& dst) { throw_nogpu(); } -void cv::gpu::subtract(const GpuMat& src1, const GpuMat& src2, GpuMat& dst) { throw_nogpu(); } -void cv::gpu::multiply(const GpuMat& src1, const GpuMat& src2, GpuMat& dst) { throw_nogpu(); } -void cv::gpu::divide(const GpuMat& src1, const GpuMat& src2, GpuMat& dst) { throw_nogpu(); } +void cv::gpu::add(const GpuMat&, const GpuMat&, GpuMat&) { throw_nogpu(); } +void cv::gpu::subtract(const GpuMat&, const GpuMat&, GpuMat&) { throw_nogpu(); } +void cv::gpu::multiply(const GpuMat&, const GpuMat&, GpuMat&) { throw_nogpu(); } +void cv::gpu::divide(const GpuMat&, const GpuMat&, GpuMat&) { throw_nogpu(); } -void cv::gpu::transpose(const GpuMat& src1, GpuMat& dst) { throw_nogpu(); } +void cv::gpu::transpose(const GpuMat&, GpuMat&) { throw_nogpu(); } -void cv::gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst) { throw_nogpu(); } +void cv::gpu::absdiff(const GpuMat&, const GpuMat&, GpuMat&) { throw_nogpu(); } -double cv::gpu::threshold(const GpuMat& src, GpuMat& dst, double thresh, double maxVal, int thresholdType) { throw_nogpu(); return 0.0; } +double cv::gpu::threshold(const GpuMat&, GpuMat&, double, double, int) { throw_nogpu(); return 0.0; } -void cv::gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int cmpop) { throw_nogpu(); } +void cv::gpu::compare(const GpuMat&, const GpuMat&, GpuMat&, int) { throw_nogpu(); } -void cv::gpu::meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev) { throw_nogpu(); } +void cv::gpu::meanStdDev(const GpuMat&, Scalar&, Scalar&) { throw_nogpu(); } -double cv::gpu::norm(const GpuMat& src1, int normType) { throw_nogpu(); return 0.0; } -double cv::gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType) { throw_nogpu(); return 0.0; } +double cv::gpu::norm(const GpuMat&, int) { throw_nogpu(); return 0.0; } +double cv::gpu::norm(const GpuMat&, const GpuMat&, int) { throw_nogpu(); return 0.0; } -void cv::gpu::flip(const GpuMat& a, GpuMat& b, int flipCode) { throw_nogpu(); } +void cv::gpu::flip(const GpuMat&, GpuMat&, int) { throw_nogpu(); } -void cv::gpu::resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx, double fy, int interpolation) { throw_nogpu(); } +void cv::gpu::resize(const GpuMat&, GpuMat&, Size, double, double, int) { throw_nogpu(); } -Scalar cv::gpu::sum(const GpuMat& m) { throw_nogpu(); return Scalar(); } +Scalar cv::gpu::sum(const GpuMat&) { throw_nogpu(); return Scalar(); } -void cv::gpu::minMax(const GpuMat& src, double* minVal, double* maxVal) { throw_nogpu(); } +void cv::gpu::minMax(const GpuMat&, double*, double*) { throw_nogpu(); } -void cv::gpu::copyConstBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value) { throw_nogpu(); } +void cv::gpu::copyMakeBorder(const GpuMat&, GpuMat&, int, int, int, int, const Scalar&) { throw_nogpu(); } + +void cv::gpu::warpAffine(const GpuMat&, GpuMat&, const Mat&, Size, int) { throw_nogpu(); } + +void cv::gpu::warpPerspective(const GpuMat&, GpuMat&, const Mat&, Size, int) { throw_nogpu(); } + +void cv::gpu::rotate(const GpuMat&, GpuMat&, Size, double, double, double, int) { throw_nogpu(); } #else /* !defined (HAVE_CUDA) */ namespace -{ +{ + typedef NppStatus (*npp_warp_8u_t)(const Npp8u* pSrc, NppiSize srcSize, int srcStep, NppiRect srcRoi, Npp8u* pDst, + int dstStep, NppiRect dstRoi, const double coeffs[][3], + int interpolation); + typedef NppStatus (*npp_warp_16u_t)(const Npp16u* pSrc, NppiSize srcSize, int srcStep, NppiRect srcRoi, Npp16u* pDst, + int dstStep, NppiRect dstRoi, const double coeffs[][3], + int interpolation); + typedef NppStatus (*npp_warp_32s_t)(const Npp32s* pSrc, NppiSize srcSize, int srcStep, NppiRect srcRoi, Npp32s* pDst, + int dstStep, NppiRect dstRoi, const double coeffs[][3], + int interpolation); + typedef NppStatus (*npp_warp_32f_t)(const Npp32f* pSrc, NppiSize srcSize, int srcStep, NppiRect srcRoi, Npp32f* pDst, + int dstStep, NppiRect dstRoi, const double coeffs[][3], + int interpolation); + typedef NppStatus (*npp_binary_func_8u_scale_t)(const Npp8u* pSrc1, int nSrc1Step, const Npp8u* pSrc2, int nSrc2Step, Npp8u* pDst, int nDstStep, NppiSize oSizeROI, int nScaleFactor); typedef NppStatus (*npp_binary_func_32f_t)(const Npp32f* pSrc1, int nSrc1Step, const Npp32f* pSrc2, int nSrc2Step, Npp32f* pDst, @@ -374,7 +393,7 @@ void cv::gpu::minMax(const GpuMat& src, double* minVal, double* maxVal) *maxVal = max_res; } -void cv::gpu::copyConstBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value) +void cv::gpu::copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value) { CV_Assert(src.type() == CV_8UC1 || src.type() == CV_8UC4 || src.type() == CV_32SC1); @@ -410,4 +429,178 @@ void cv::gpu::copyConstBorder(const GpuMat& src, GpuMat& dst, int top, int botto } } +namespace +{ + void nppWarpCaller(const GpuMat& src, GpuMat& dst, double coeffs[][3], const Size& dsize, int flags, + npp_warp_8u_t npp_warp_8u[][2], npp_warp_16u_t npp_warp_16u[][2], + npp_warp_32s_t npp_warp_32s[][2], npp_warp_32f_t npp_warp_32f[][2]) + { + static const int npp_inter[] = {NPPI_INTER_NN, NPPI_INTER_LINEAR, NPPI_INTER_CUBIC}; + + int interpolation = flags & INTER_MAX; + + CV_Assert((src.depth() == CV_8U || src.depth() == CV_16U || src.depth() == CV_32S || src.depth() == CV_32F) && src.channels() != 2); + CV_Assert(interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC); + + dst.create(dsize, src.type()); + + NppiSize srcsz; + srcsz.height = src.rows; + srcsz.width = src.cols; + NppiRect srcroi; + srcroi.x = srcroi.y = 0; + srcroi.height = src.rows; + srcroi.width = src.cols; + NppiRect dstroi; + dstroi.x = dstroi.y = 0; + dstroi.height = dst.rows; + dstroi.width = dst.cols; + + int warpInd = (flags & WARP_INVERSE_MAP) >> 4; + + switch (src.depth()) + { + case CV_8U: + npp_warp_8u[src.channels()][warpInd]((const Npp8u*)src.ptr(), srcsz, src.step, srcroi, + (Npp8u*)dst.ptr(), dst.step, dstroi, coeffs, npp_inter[interpolation]); + break; + case CV_16U: + npp_warp_16u[src.channels()][warpInd]((const Npp16u*)src.ptr(), srcsz, src.step, srcroi, + (Npp16u*)dst.ptr(), dst.step, dstroi, coeffs, npp_inter[interpolation]); + break; + case CV_32SC1: + npp_warp_32s[src.channels()][warpInd]((const Npp32s*)src.ptr(), srcsz, src.step, srcroi, + (Npp32s*)dst.ptr(), dst.step, dstroi, coeffs, npp_inter[interpolation]); + break; + case CV_32FC1: + npp_warp_32f[src.channels()][warpInd]((const Npp32f*)src.ptr(), srcsz, src.step, srcroi, + (Npp32f*)dst.ptr(), dst.step, dstroi, coeffs, npp_inter[interpolation]); + break; + default: + CV_Assert(!"Unsupported source type"); + } + } +} + +void cv::gpu::warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags) +{ + static npp_warp_8u_t npp_warpAffine_8u[][2] = + { + {0, 0}, + {nppiWarpAffine_8u_C1R, nppiWarpAffineBack_8u_C1R}, + {0, 0}, + {nppiWarpAffine_8u_C3R, nppiWarpAffineBack_8u_C3R}, + {nppiWarpAffine_8u_C4R, nppiWarpAffineBack_8u_C4R} + }; + static npp_warp_16u_t npp_warpAffine_16u[][2] = + { + {0, 0}, + {nppiWarpAffine_16u_C1R, nppiWarpAffineBack_16u_C1R}, + {0, 0}, + {nppiWarpAffine_16u_C3R, nppiWarpAffineBack_16u_C3R}, + {nppiWarpAffine_16u_C4R, nppiWarpAffineBack_16u_C4R} + }; + static npp_warp_32s_t npp_warpAffine_32s[][2] = + { + {0, 0}, + {nppiWarpAffine_32s_C1R, nppiWarpAffineBack_32s_C1R}, + {0, 0}, + {nppiWarpAffine_32s_C3R, nppiWarpAffineBack_32s_C3R}, + {nppiWarpAffine_32s_C4R, nppiWarpAffineBack_32s_C4R} + }; + static npp_warp_32f_t npp_warpAffine_32f[][2] = + { + {0, 0}, + {nppiWarpAffine_32f_C1R, nppiWarpAffineBack_32f_C1R}, + {0, 0}, + {nppiWarpAffine_32f_C3R, nppiWarpAffineBack_32f_C3R}, + {nppiWarpAffine_32f_C4R, nppiWarpAffineBack_32f_C4R} + }; + + CV_Assert(M.rows == 2 && M.cols == 3); + + double coeffs[2][3]; + Mat coeffsMat(2, 3, CV_64F, (void*)coeffs); + M.convertTo(coeffsMat, coeffsMat.type()); + + nppWarpCaller(src, dst, coeffs, dsize, flags, npp_warpAffine_8u, npp_warpAffine_16u, npp_warpAffine_32s, npp_warpAffine_32f); +} + +void cv::gpu::warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags) +{ + static npp_warp_8u_t npp_warpPerspective_8u[][2] = + { + {0, 0}, + {nppiWarpPerspective_8u_C1R, nppiWarpPerspectiveBack_8u_C1R}, + {0, 0}, + {nppiWarpPerspective_8u_C3R, nppiWarpPerspectiveBack_8u_C3R}, + {nppiWarpPerspective_8u_C4R, nppiWarpPerspectiveBack_8u_C4R} + }; + static npp_warp_16u_t npp_warpPerspective_16u[][2] = + { + {0, 0}, + {nppiWarpPerspective_16u_C1R, nppiWarpPerspectiveBack_16u_C1R}, + {0, 0}, + {nppiWarpPerspective_16u_C3R, nppiWarpPerspectiveBack_16u_C3R}, + {nppiWarpPerspective_16u_C4R, nppiWarpPerspectiveBack_16u_C4R} + }; + static npp_warp_32s_t npp_warpPerspective_32s[][2] = + { + {0, 0}, + {nppiWarpPerspective_32s_C1R, nppiWarpPerspectiveBack_32s_C1R}, + {0, 0}, + {nppiWarpPerspective_32s_C3R, nppiWarpPerspectiveBack_32s_C3R}, + {nppiWarpPerspective_32s_C4R, nppiWarpPerspectiveBack_32s_C4R} + }; + static npp_warp_32f_t npp_warpPerspective_32f[][2] = + { + {0, 0}, + {nppiWarpPerspective_32f_C1R, nppiWarpPerspectiveBack_32f_C1R}, + {0, 0}, + {nppiWarpPerspective_32f_C3R, nppiWarpPerspectiveBack_32f_C3R}, + {nppiWarpPerspective_32f_C4R, nppiWarpPerspectiveBack_32f_C4R} + }; + + CV_Assert(M.rows == 3 && M.cols == 3); + + double coeffs[3][3]; + Mat coeffsMat(3, 3, CV_64F, (void*)coeffs); + M.convertTo(coeffsMat, coeffsMat.type()); + + nppWarpCaller(src, dst, coeffs, dsize, flags, npp_warpPerspective_8u, npp_warpPerspective_16u, npp_warpPerspective_32s, npp_warpPerspective_32f); +} + +void cv::gpu::rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift, double yShift, int interpolation) +{ + static const int npp_inter[] = {NPPI_INTER_NN, NPPI_INTER_LINEAR, NPPI_INTER_CUBIC}; + + CV_Assert(src.type() == CV_8UC1 || src.type() == CV_8UC4); + CV_Assert(interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC); + + dst.create(dsize, src.type()); + + NppiSize srcsz; + srcsz.height = src.rows; + srcsz.width = src.cols; + NppiRect srcroi; + srcroi.x = srcroi.y = 0; + srcroi.height = src.rows; + srcroi.width = src.cols; + NppiRect dstroi; + dstroi.x = dstroi.y = 0; + dstroi.height = dst.rows; + dstroi.width = dst.cols; + + if (src.channels() == 1) + { + nppiRotate_8u_C1R((const Npp8u*)src.ptr(), srcsz, src.step, srcroi, + (Npp8u*)dst.ptr(), dst.step, dstroi, angle, xShift, yShift, npp_inter[interpolation]); + } + else + { + nppiRotate_8u_C4R((const Npp8u*)src.ptr(), srcsz, src.step, srcroi, + (Npp8u*)dst.ptr(), dst.step, dstroi, angle, xShift, yShift, npp_inter[interpolation]); + } +} + #endif /* !defined (HAVE_CUDA) */ \ No newline at end of file diff --git a/modules/gpu/src/imgproc_gpu.cpp b/modules/gpu/src/imgproc_gpu.cpp index 719f1068f9..d8685faf5f 100644 --- a/modules/gpu/src/imgproc_gpu.cpp +++ b/modules/gpu/src/imgproc_gpu.cpp @@ -47,8 +47,8 @@ using namespace cv::gpu; #if !defined (HAVE_CUDA) -void cv::gpu::remap( const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap ){ throw_nogpu(); } -void cv::gpu::meanShiftFiltering(const GpuMat&, GpuMat&, int, int, TermCriteria ) { throw_nogpu(); } +void cv::gpu::remap(const GpuMat&, GpuMat&, const GpuMat&, const GpuMat&){ throw_nogpu(); } +void cv::gpu::meanShiftFiltering(const GpuMat&, GpuMat&, int, int, TermCriteria) { throw_nogpu(); } void cv::gpu::drawColorDisp(const GpuMat&, GpuMat&, int) { throw_nogpu(); } void cv::gpu::drawColorDisp(const GpuMat&, GpuMat&, int, const Stream&) { throw_nogpu(); } void cv::gpu::reprojectImageTo3D(const GpuMat&, GpuMat&, const Mat&) { throw_nogpu(); } diff --git a/tests/gpu/src/npp_image_arithm.cpp b/tests/gpu/src/npp_image_arithm.cpp index 2ce5d72d06..ec28361932 100644 --- a/tests/gpu/src/npp_image_arithm.cpp +++ b/tests/gpu/src/npp_image_arithm.cpp @@ -687,20 +687,20 @@ CV_GpuNppImageMinNaxTest CV_GpuNppImageMinNax_test; //////////////////////////////////////////////////////////////////////////////// // copyConstBorder -class CV_GpuNppImageCopyConstBorderTest : public CV_GpuNppImageArithmTest +class CV_GpuNppImageCopyMakeBorderTest : public CV_GpuNppImageArithmTest { public: - CV_GpuNppImageCopyConstBorderTest(); + CV_GpuNppImageCopyMakeBorderTest(); protected: virtual int test(const Mat& cpu1, const Mat& cpu2); }; -CV_GpuNppImageCopyConstBorderTest::CV_GpuNppImageCopyConstBorderTest(): CV_GpuNppImageArithmTest( "GPU-NppImageCopyConstBorder", "copyConstBorder" ) +CV_GpuNppImageCopyMakeBorderTest::CV_GpuNppImageCopyMakeBorderTest(): CV_GpuNppImageArithmTest( "GPU-NppImageCopyMakeBorder", "copyMakeBorder" ) { } -int CV_GpuNppImageCopyConstBorderTest::test( const Mat& cpu1, const Mat& ) +int CV_GpuNppImageCopyMakeBorderTest::test( const Mat& cpu1, const Mat& ) { if (cpu1.type() != CV_8UC1 && cpu1.type() != CV_8UC4 && cpu1.type() != CV_32SC1) return CvTS::OK; @@ -710,9 +710,88 @@ int CV_GpuNppImageCopyConstBorderTest::test( const Mat& cpu1, const Mat& ) GpuMat gpu1(cpu1); GpuMat gpudst; - cv::gpu::copyConstBorder(gpu1, gpudst, 5, 5, 5, 5); + cv::gpu::copyMakeBorder(gpu1, gpudst, 5, 5, 5, 5); return CheckNorm(cpudst, gpudst); } -CV_GpuNppImageCopyConstBorderTest CV_GpuNppImageCopyConstBorder_test; \ No newline at end of file +CV_GpuNppImageCopyMakeBorderTest CV_GpuNppImageCopyMakeBorder_test; + +//////////////////////////////////////////////////////////////////////////////// +// warpAffine +class CV_GpuNppImageWarpAffineTest : public CV_GpuNppImageArithmTest +{ +public: + CV_GpuNppImageWarpAffineTest(); + +protected: + virtual int test(const Mat& cpu1, const Mat& cpu2); +}; + +CV_GpuNppImageWarpAffineTest::CV_GpuNppImageWarpAffineTest(): CV_GpuNppImageArithmTest( "GPU-NppImageWarpAffine", "warpAffine" ) +{ +} + +int CV_GpuNppImageWarpAffineTest::test( const Mat& cpu1, const Mat& ) +{ + static const double coeffs[2][3] = + { + {cos(3.14 / 6), -sin(3.14 / 6), 100.0}, + {sin(3.14 / 6), cos(3.14 / 6), -100.0} + }; + Mat M(2, 3, CV_64F, (void*)coeffs); + + if (cpu1.type() == CV_32SC1) + return CvTS::OK; + + Mat cpudst; + cv::warpAffine(cpu1, cpudst, M, cpu1.size(), INTER_CUBIC | WARP_INVERSE_MAP); + + GpuMat gpu1(cpu1); + GpuMat gpudst; + cv::gpu::warpAffine(gpu1, gpudst, M, gpu1.size(), INTER_CUBIC | WARP_INVERSE_MAP); + + return CheckNorm(cpudst, gpudst); +} + +CV_GpuNppImageWarpAffineTest CV_GpuNppImageWarpAffine_test; + +//////////////////////////////////////////////////////////////////////////////// +// warpAffine +class CV_GpuNppImageWarpPerspectiveTest : public CV_GpuNppImageArithmTest +{ +public: + CV_GpuNppImageWarpPerspectiveTest(); + +protected: + virtual int test(const Mat& cpu1, const Mat& cpu2); +}; + +CV_GpuNppImageWarpPerspectiveTest::CV_GpuNppImageWarpPerspectiveTest(): CV_GpuNppImageArithmTest( "GPU-NppImageWarpPerspective", "warpPerspective" ) +{ +} + +int CV_GpuNppImageWarpPerspectiveTest::test( const Mat& cpu1, const Mat& ) +{ + static const double coeffs[3][3] = + { + {cos(3.14 / 6), -sin(3.14 / 6), 100.0}, + {sin(3.14 / 6), cos(3.14 / 6), -100.0}, + {0.0, 0.0, 1.0} + }; + Mat M(3, 3, CV_64F, (void*)coeffs); + + if (cpu1.type() == CV_32SC1) + return CvTS::OK; + + Mat cpudst; + cv::warpPerspective(cpu1, cpudst, M, cpu1.size(), INTER_CUBIC | WARP_INVERSE_MAP); + + GpuMat gpu1(cpu1); + GpuMat gpudst; + cv::gpu::warpPerspective(gpu1, gpudst, M, gpu1.size(), INTER_CUBIC | WARP_INVERSE_MAP); + + return CheckNorm(cpudst, gpudst); +} + +CV_GpuNppImageWarpPerspectiveTest CV_GpuNppImageWarpPerspective_test; \ No newline at end of file