mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
refactored and fixed bugs in gpu warp functions (remap, resize, warpAffine, warpPerspective)
wrote more complicated tests for them implemented own version of warpAffine and warpPerspective for different border interpolation types refactored some gpu tests
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_TEST_INTERPOLATION_HPP__
|
||||
#define __OPENCV_TEST_INTERPOLATION_HPP__
|
||||
|
||||
template <typename T> T readVal(const cv::Mat& src, int y, int x, int c, int border_type, cv::Scalar borderVal = cv::Scalar())
|
||||
{
|
||||
if (border_type == cv::BORDER_CONSTANT)
|
||||
return (y >= 0 && y < src.rows && x >= 0 && x < src.cols) ? src.at<T>(y, x * src.channels() + c) : cv::saturate_cast<T>(borderVal.val[c]);
|
||||
|
||||
return src.at<T>(cv::borderInterpolate(y, src.rows, border_type), cv::borderInterpolate(x, src.cols, border_type) * src.channels() + c);
|
||||
}
|
||||
|
||||
template <typename T> struct NearestInterpolator
|
||||
{
|
||||
static T getValue(const cv::Mat& src, float y, float x, int c, int border_type, cv::Scalar borderVal = cv::Scalar())
|
||||
{
|
||||
return readVal<T>(src, cvFloor(y), cvFloor(x), c, border_type, borderVal);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> struct LinearInterpolator
|
||||
{
|
||||
static T getValue(const cv::Mat& src, float y, float x, int c, int border_type, cv::Scalar borderVal = cv::Scalar())
|
||||
{
|
||||
x -= 0.5f;
|
||||
y -= 0.5f;
|
||||
|
||||
int x1 = cvFloor(x);
|
||||
int y1 = cvFloor(y);
|
||||
int x2 = x1 + 1;
|
||||
int y2 = y1 + 1;
|
||||
|
||||
float res = 0;
|
||||
|
||||
res += readVal<T>(src, y1, x1, c, border_type, borderVal) * ((x2 - x) * (y2 - y));
|
||||
res += readVal<T>(src, y1, x2, c, border_type, borderVal) * ((x - x1) * (y2 - y));
|
||||
res += readVal<T>(src, y2, x1, c, border_type, borderVal) * ((x2 - x) * (y - y1));
|
||||
res += readVal<T>(src, y2, x2, c, border_type, borderVal) * ((x - x1) * (y - y1));
|
||||
|
||||
return cv::saturate_cast<T>(res);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> struct CubicInterpolator
|
||||
{
|
||||
static float getValue(float p[4], float x)
|
||||
{
|
||||
return p[1] + 0.5 * x * (p[2] - p[0] + x*(2.0*p[0] - 5.0*p[1] + 4.0*p[2] - p[3] + x*(3.0*(p[1] - p[2]) + p[3] - p[0])));
|
||||
}
|
||||
|
||||
static float getValue(float p[4][4], float x, float y)
|
||||
{
|
||||
float arr[4];
|
||||
|
||||
arr[0] = getValue(p[0], x);
|
||||
arr[1] = getValue(p[1], x);
|
||||
arr[2] = getValue(p[2], x);
|
||||
arr[3] = getValue(p[3], x);
|
||||
|
||||
return getValue(arr, y);
|
||||
}
|
||||
|
||||
static T getValue(const cv::Mat& src, float y, float x, int c, int border_type, cv::Scalar borderVal = cv::Scalar())
|
||||
{
|
||||
int ix = cvRound(x);
|
||||
int iy = cvRound(y);
|
||||
|
||||
float vals[4][4] =
|
||||
{
|
||||
{readVal<T>(src, iy - 2, ix - 2, c, border_type, borderVal), readVal<T>(src, iy - 2, ix - 1, c, border_type, borderVal), readVal<T>(src, iy - 2, ix, c, border_type, borderVal), readVal<T>(src, iy - 2, ix + 1, c, border_type, borderVal)},
|
||||
{readVal<T>(src, iy - 1, ix - 2, c, border_type, borderVal), readVal<T>(src, iy - 1, ix - 1, c, border_type, borderVal), readVal<T>(src, iy - 1, ix, c, border_type, borderVal), readVal<T>(src, iy - 1, ix + 1, c, border_type, borderVal)},
|
||||
{readVal<T>(src, iy , ix - 2, c, border_type, borderVal), readVal<T>(src, iy , ix - 1, c, border_type, borderVal), readVal<T>(src, iy , ix, c, border_type, borderVal), readVal<T>(src, iy , ix + 1, c, border_type, borderVal)},
|
||||
{readVal<T>(src, iy + 1, ix - 2, c, border_type, borderVal), readVal<T>(src, iy + 1, ix - 1, c, border_type, borderVal), readVal<T>(src, iy + 1, ix, c, border_type, borderVal), readVal<T>(src, iy + 1, ix + 1, c, border_type, borderVal)},
|
||||
};
|
||||
|
||||
return cv::saturate_cast<T>(getValue(vals, (x - ix + 2.0) / 4.0, (y - iy + 2.0) / 4.0));
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __OPENCV_TEST_INTERPOLATION_HPP__
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
@@ -39,4 +39,4 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
@@ -47,10 +47,11 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
@@ -60,6 +61,8 @@
|
||||
#include "opencv2/ts/ts.hpp"
|
||||
#include "opencv2/ts/ts_perf.hpp"
|
||||
#include "opencv2/gpu/gpu.hpp"
|
||||
#include "test_gpu_base.hpp"
|
||||
|
||||
#include "utility.hpp"
|
||||
#include "interpolation.hpp"
|
||||
|
||||
#endif
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
@@ -117,7 +117,7 @@ INSTANTIATE_TEST_CASE_P(Arithm, Add, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_16SC1, CV_16SC2, CV_16SC3, CV_16SC4,
|
||||
CV_32SC1, CV_32SC2, CV_32SC3, CV_32FC1, CV_32FC2, CV_32FC3, CV_32FC4),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// subtract
|
||||
@@ -160,7 +160,7 @@ INSTANTIATE_TEST_CASE_P(Arithm, Subtract, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_16SC1, CV_16SC2, CV_16SC3, CV_16SC4,
|
||||
CV_32SC1, CV_32SC2, CV_32SC3, CV_32FC1, CV_32FC2, CV_32FC3, CV_32FC4),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// multiply
|
||||
@@ -203,7 +203,7 @@ INSTANTIATE_TEST_CASE_P(Arithm, Multiply, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_16SC1, CV_16SC3, CV_16SC4,
|
||||
CV_32SC1, CV_32SC3, CV_32FC1, CV_32FC3, CV_32FC4),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// divide
|
||||
@@ -246,7 +246,7 @@ INSTANTIATE_TEST_CASE_P(Arithm, Divide, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_16SC1, CV_16SC3, CV_16SC4,
|
||||
CV_32SC1, CV_32SC3, CV_32FC1, CV_32FC3, CV_32FC4),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// transpose
|
||||
@@ -272,7 +272,7 @@ TEST_P(Transpose, Accuracy)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Transpose, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_8UC4, CV_8SC1, CV_8SC4, CV_16UC2, CV_16SC2, CV_32SC1, CV_32SC2, CV_32FC1, CV_32FC2, CV_64FC1),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// absdiff
|
||||
@@ -314,7 +314,7 @@ TEST_P(Absdiff, Scalar)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Absdiff, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_16UC1, CV_32SC1, CV_32FC1),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// abs
|
||||
@@ -339,7 +339,7 @@ TEST_P(Abs, Array)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Abs, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_16SC1, CV_32FC1),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Sqr
|
||||
@@ -365,7 +365,7 @@ TEST_P(Sqr, Array)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Sqr, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Sqrt
|
||||
@@ -391,7 +391,7 @@ TEST_P(Sqrt, Array)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Sqrt, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(MatType(CV_32FC1)),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// compare
|
||||
@@ -445,7 +445,7 @@ INSTANTIATE_TEST_CASE_P(Arithm, Compare, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_16UC1, CV_32SC1),
|
||||
Values((int) cv::CMP_EQ, (int) cv::CMP_GT, (int) cv::CMP_GE, (int) cv::CMP_LT, (int) cv::CMP_LE, (int) cv::CMP_NE),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// meanStdDev
|
||||
@@ -498,7 +498,7 @@ TEST_P(MeanStdDev, Accuracy)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, MeanStdDev, Combine(
|
||||
ALL_DEVICES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// normDiff
|
||||
@@ -543,7 +543,7 @@ TEST_P(NormDiff, Accuracy)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, NormDiff, Combine(
|
||||
ALL_DEVICES,
|
||||
Values((int) cv::NORM_INF, (int) cv::NORM_L1, (int) cv::NORM_L2),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// flip
|
||||
@@ -596,7 +596,7 @@ INSTANTIATE_TEST_CASE_P(Arithm, Flip, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32SC1, CV_32SC3, CV_32SC4, CV_32FC1, CV_32FC3, CV_32FC4),
|
||||
Values((int)FLIP_BOTH, (int)FLIP_X, (int)FLIP_Y),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// LUT
|
||||
@@ -648,7 +648,7 @@ TEST_P(LUT, Accuracy)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, LUT, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8UC1, CV_8UC3),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// exp
|
||||
@@ -695,7 +695,7 @@ TEST_P(Exp, Accuracy)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Exp, Combine(
|
||||
ALL_DEVICES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// pow
|
||||
@@ -754,7 +754,7 @@ TEST_P(Pow, Accuracy)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Pow, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_32F, CV_32FC3),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// log
|
||||
@@ -801,7 +801,7 @@ TEST_P(Log, Accuracy)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Log, Combine(
|
||||
ALL_DEVICES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// magnitude
|
||||
@@ -849,7 +849,7 @@ TEST_P(Magnitude, Accuracy)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Magnitude, Combine(
|
||||
ALL_DEVICES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// phase
|
||||
@@ -897,7 +897,7 @@ TEST_P(Phase, Accuracy)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Phase, Combine(
|
||||
ALL_DEVICES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cartToPolar
|
||||
@@ -949,7 +949,7 @@ TEST_P(CartToPolar, Accuracy)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, CartToPolar, Combine(
|
||||
ALL_DEVICES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// polarToCart
|
||||
@@ -1002,7 +1002,7 @@ TEST_P(PolarToCart, Accuracy)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, PolarToCart, Combine(
|
||||
ALL_DEVICES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// minMax
|
||||
@@ -1078,7 +1078,7 @@ TEST_P(MinMax, Accuracy)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, MinMax, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// minMaxLoc
|
||||
@@ -1167,7 +1167,7 @@ TEST_P(MinMaxLoc, Accuracy)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, MinMaxLoc, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// countNonZero
|
||||
@@ -1215,7 +1215,7 @@ TEST_P(CountNonZero, Accuracy)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, CountNonZero, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// sum
|
||||
@@ -1295,7 +1295,7 @@ TEST_P(Sum, Sqr)
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Sum, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// bitwise
|
||||
@@ -1560,7 +1560,7 @@ INSTANTIATE_TEST_CASE_P(Arithm, AddWeighted, Combine(
|
||||
TYPES(CV_8U, CV_64F, 1, 1),
|
||||
TYPES(CV_8U, CV_64F, 1, 1),
|
||||
TYPES(CV_8U, CV_64F, 1, 1),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// reduce
|
||||
@@ -1624,7 +1624,7 @@ INSTANTIATE_TEST_CASE_P(Arithm, Reduce, Combine(
|
||||
Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4),
|
||||
Values(0, 1),
|
||||
Values((int)CV_REDUCE_SUM, (int)CV_REDUCE_AVG, (int)CV_REDUCE_MAX, (int)CV_REDUCE_MIN),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// gemm
|
||||
@@ -1685,6 +1685,6 @@ INSTANTIATE_TEST_CASE_P(Arithm, GEMM, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(CV_32FC1, CV_32FC2),
|
||||
Values(0, (int) cv::GEMM_1_T, (int) cv::GEMM_2_T, (int) cv::GEMM_3_T),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
PARAM_TEST_CASE(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, int, Border, UseRoi)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
cv::Size size;
|
||||
int type;
|
||||
int border;
|
||||
int borderType;
|
||||
bool useRoi;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
size = GET_PARAM(1);
|
||||
type = GET_PARAM(2);
|
||||
border = GET_PARAM(3);
|
||||
borderType = GET_PARAM(4);
|
||||
useRoi = GET_PARAM(5);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(CopyMakeBorder, Accuracy)
|
||||
{
|
||||
cv::Mat src = randomMat(size, type);
|
||||
cv::Scalar val = randomScalar(0, 255);
|
||||
|
||||
cv::gpu::GpuMat dst = createMat(cv::Size(size.width + 2 * border, size.height + 2 * border), type, useRoi);
|
||||
cv::gpu::copyMakeBorder(loadMat(src, useRoi), dst, border, border, border, border, borderType, val);
|
||||
|
||||
cv::Mat dst_gold;
|
||||
cv::copyMakeBorder(src, dst_gold, border, border, border, border, borderType, val);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, CopyMakeBorder, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
DIFFERENT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
|
||||
testing::Values(1, 10, 50),
|
||||
testing::Values(Border(cv::BORDER_REFLECT101), Border(cv::BORDER_REPLICATE), Border(cv::BORDER_CONSTANT), Border(cv::BORDER_REFLECT), Border(cv::BORDER_WRAP)),
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
@@ -132,7 +132,7 @@ TEST_P(Blur, Gray)
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Blur, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(cv::Size(3, 3), cv::Size(5, 5), cv::Size(7, 7)),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// sobel
|
||||
@@ -212,7 +212,7 @@ INSTANTIATE_TEST_CASE_P(Filter, Sobel, Combine(
|
||||
Values(3, 5, 7),
|
||||
Values(0, 1, 2),
|
||||
Values(0, 1, 2),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// scharr
|
||||
@@ -289,7 +289,7 @@ INSTANTIATE_TEST_CASE_P(Filter, Scharr, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(0, 1),
|
||||
Values(0, 1),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// gaussianBlur
|
||||
@@ -361,7 +361,7 @@ TEST_P(GaussianBlur, Gray)
|
||||
INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(cv::Size(3, 3), cv::Size(5, 5), cv::Size(7, 7), cv::Size(9, 9), cv::Size(11, 11), cv::Size(13, 13), cv::Size(15, 15), cv::Size(17, 17), cv::Size(19, 19), cv::Size(21, 21), cv::Size(23, 23), cv::Size(25, 25), cv::Size(27, 27), cv::Size(29, 29), cv::Size(31, 31)),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// laplacian
|
||||
@@ -426,7 +426,7 @@ TEST_P(Laplacian, Gray)
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Laplacian, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(1, 3),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// erode
|
||||
@@ -492,7 +492,7 @@ TEST_P(Erode, Gray)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Erode, Combine(
|
||||
ALL_DEVICES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// dilate
|
||||
@@ -558,7 +558,7 @@ TEST_P(Dilate, Gray)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Dilate, Combine(
|
||||
ALL_DEVICES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// morphEx
|
||||
@@ -627,7 +627,7 @@ TEST_P(MorphEx, Gray)
|
||||
INSTANTIATE_TEST_CASE_P(Filter, MorphEx, Combine(
|
||||
ALL_DEVICES,
|
||||
Values((int)cv::MORPH_OPEN, (int)cv::MORPH_CLOSE, (int)cv::MORPH_GRADIENT, (int)cv::MORPH_TOPHAT, (int)cv::MORPH_BLACKHAT),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// filter2D
|
||||
@@ -717,6 +717,6 @@ TEST_P(Filter2D, 32FC1)
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Filter2D, Combine(
|
||||
ALL_DEVICES,
|
||||
Values(3, 5, 7, 11, 13, 15),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
||||
+3353
-3727
File diff suppressed because it is too large
Load Diff
@@ -40,7 +40,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
@@ -106,7 +106,7 @@ TEST_P(Merge, Accuracy)
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, Merge, Combine(
|
||||
ALL_DEVICES,
|
||||
ALL_TYPES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// split
|
||||
@@ -167,7 +167,7 @@ TEST_P(Split, Accuracy)
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, Split, Combine(
|
||||
ALL_DEVICES,
|
||||
ALL_TYPES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// split_merge_consistency
|
||||
@@ -328,7 +328,7 @@ TEST_P(SetTo, Masked)
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, SetTo, Combine(
|
||||
ALL_DEVICES,
|
||||
ALL_TYPES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// copyTo
|
||||
@@ -407,7 +407,7 @@ TEST_P(CopyTo, Masked)
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, CopyTo, Combine(
|
||||
ALL_DEVICES,
|
||||
ALL_TYPES,
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// convertTo
|
||||
@@ -491,7 +491,7 @@ INSTANTIATE_TEST_CASE_P(MatOp, ConvertTo, Combine(
|
||||
ALL_DEVICES,
|
||||
TYPES(CV_8U, CV_64F, 1, 1),
|
||||
TYPES(CV_8U, CV_64F, 1, 1),
|
||||
USE_ROI));
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// async
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Gold implementation
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T, template <typename> class Interpolator> void remapImpl(const cv::Mat& src, const cv::Mat& xmap, const cv::Mat& ymap, cv::Mat& dst, int borderType, cv::Scalar borderVal)
|
||||
{
|
||||
const int cn = src.channels();
|
||||
|
||||
cv::Size dsize = xmap.size();
|
||||
|
||||
dst.create(dsize, src.type());
|
||||
|
||||
for (int y = 0; y < dsize.height; ++y)
|
||||
{
|
||||
for (int x = 0; x < dsize.width; ++x)
|
||||
{
|
||||
for (int c = 0; c < cn; ++c)
|
||||
dst.at<T>(y, x * cn + c) = Interpolator<T>::getValue(src, ymap.at<float>(y, x), xmap.at<float>(y, x), c, borderType, borderVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void remapGold(const cv::Mat& src, const cv::Mat& xmap, const cv::Mat& ymap, cv::Mat& dst, int interpolation, int borderType, cv::Scalar borderVal)
|
||||
{
|
||||
typedef void (*func_t)(const cv::Mat& src, const cv::Mat& xmap, const cv::Mat& ymap, cv::Mat& dst, int borderType, cv::Scalar borderVal);
|
||||
|
||||
static const func_t nearest_funcs[] =
|
||||
{
|
||||
remapImpl<unsigned char, NearestInterpolator>,
|
||||
remapImpl<signed char, NearestInterpolator>,
|
||||
remapImpl<unsigned short, NearestInterpolator>,
|
||||
remapImpl<short, NearestInterpolator>,
|
||||
remapImpl<int, NearestInterpolator>,
|
||||
remapImpl<float, NearestInterpolator>
|
||||
};
|
||||
|
||||
static const func_t linear_funcs[] =
|
||||
{
|
||||
remapImpl<unsigned char, LinearInterpolator>,
|
||||
remapImpl<signed char, LinearInterpolator>,
|
||||
remapImpl<unsigned short, LinearInterpolator>,
|
||||
remapImpl<short, LinearInterpolator>,
|
||||
remapImpl<int, LinearInterpolator>,
|
||||
remapImpl<float, LinearInterpolator>
|
||||
};
|
||||
|
||||
static const func_t cubic_funcs[] =
|
||||
{
|
||||
remapImpl<unsigned char, CubicInterpolator>,
|
||||
remapImpl<signed char, CubicInterpolator>,
|
||||
remapImpl<unsigned short, CubicInterpolator>,
|
||||
remapImpl<short, CubicInterpolator>,
|
||||
remapImpl<int, CubicInterpolator>,
|
||||
remapImpl<float, CubicInterpolator>
|
||||
};
|
||||
|
||||
static const func_t* funcs[] = {nearest_funcs, linear_funcs, cubic_funcs};
|
||||
|
||||
funcs[interpolation][src.depth()](src, xmap, ymap, dst, borderType, borderVal);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
PARAM_TEST_CASE(Remap, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, Border, UseRoi)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
cv::Size size;
|
||||
int type;
|
||||
int interpolation;
|
||||
int borderType;
|
||||
bool useRoi;
|
||||
|
||||
cv::Mat xmap;
|
||||
cv::Mat ymap;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
size = GET_PARAM(1);
|
||||
type = GET_PARAM(2);
|
||||
interpolation = GET_PARAM(3);
|
||||
borderType = GET_PARAM(4);
|
||||
useRoi = GET_PARAM(5);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
// rotation matrix
|
||||
|
||||
const double aplha = CV_PI / 4;
|
||||
static double M[2][3] = { {std::cos(aplha), -std::sin(aplha), size.width / 2.0},
|
||||
{std::sin(aplha), std::cos(aplha), 0.0}};
|
||||
|
||||
xmap.create(size, CV_32FC1);
|
||||
ymap.create(size, CV_32FC1);
|
||||
|
||||
for (int y = 0; y < size.height; ++y)
|
||||
{
|
||||
for (int x = 0; x < size.width; ++x)
|
||||
{
|
||||
xmap.at<float>(y, x) = static_cast<float>(M[0][0] * x + M[0][1] * y + M[0][2]);
|
||||
ymap.at<float>(y, x) = static_cast<float>(M[1][0] * x + M[1][1] * y + M[1][2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(Remap, Accuracy)
|
||||
{
|
||||
cv::Mat src = randomMat(size, type);
|
||||
cv::Scalar val = randomScalar(0.0, 255.0);
|
||||
|
||||
cv::gpu::GpuMat dst = createMat(xmap.size(), type, useRoi);
|
||||
cv::gpu::remap(loadMat(src, useRoi), dst, loadMat(xmap, useRoi), loadMat(ymap, useRoi), interpolation, borderType, val);
|
||||
|
||||
cv::Mat dst_gold;
|
||||
remapGold(src, xmap, ymap, dst_gold, interpolation, borderType, val);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, src.depth() == CV_32F ? 1e-4 : 1.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Remap, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
DIFFERENT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
|
||||
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
|
||||
testing::Values(Border(cv::BORDER_REFLECT101), Border(cv::BORDER_REPLICATE), Border(cv::BORDER_CONSTANT), Border(cv::BORDER_REFLECT), Border(cv::BORDER_WRAP)),
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
@@ -0,0 +1,202 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Gold implementation
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T, template <typename> class Interpolator> void resizeImpl(const cv::Mat& src, cv::Mat& dst, double fx, double fy)
|
||||
{
|
||||
const int cn = src.channels();
|
||||
|
||||
cv::Size dsize(cv::saturate_cast<int>(src.cols * fx), cv::saturate_cast<int>(src.rows * fy));
|
||||
|
||||
dst.create(dsize, src.type());
|
||||
|
||||
float ifx = static_cast<float>(1.0 / fx);
|
||||
float ify = static_cast<float>(1.0 / fy);
|
||||
|
||||
for (int y = 0; y < dsize.height; ++y)
|
||||
{
|
||||
for (int x = 0; x < dsize.width; ++x)
|
||||
{
|
||||
for (int c = 0; c < cn; ++c)
|
||||
dst.at<T>(y, x * cn + c) = Interpolator<T>::getValue(src, y * ify, x * ifx, c, cv::BORDER_REPLICATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void resizeGold(const cv::Mat& src, cv::Mat& dst, double fx, double fy, int interpolation)
|
||||
{
|
||||
typedef void (*func_t)(const cv::Mat& src, cv::Mat& dst, double fx, double fy);
|
||||
|
||||
static const func_t nearest_funcs[] =
|
||||
{
|
||||
resizeImpl<unsigned char, NearestInterpolator>,
|
||||
resizeImpl<signed char, NearestInterpolator>,
|
||||
resizeImpl<unsigned short, NearestInterpolator>,
|
||||
resizeImpl<short, NearestInterpolator>,
|
||||
resizeImpl<int, NearestInterpolator>,
|
||||
resizeImpl<float, NearestInterpolator>
|
||||
};
|
||||
|
||||
|
||||
static const func_t linear_funcs[] =
|
||||
{
|
||||
resizeImpl<unsigned char, LinearInterpolator>,
|
||||
resizeImpl<signed char, LinearInterpolator>,
|
||||
resizeImpl<unsigned short, LinearInterpolator>,
|
||||
resizeImpl<short, LinearInterpolator>,
|
||||
resizeImpl<int, LinearInterpolator>,
|
||||
resizeImpl<float, LinearInterpolator>
|
||||
};
|
||||
|
||||
static const func_t cubic_funcs[] =
|
||||
{
|
||||
resizeImpl<unsigned char, CubicInterpolator>,
|
||||
resizeImpl<signed char, CubicInterpolator>,
|
||||
resizeImpl<unsigned short, CubicInterpolator>,
|
||||
resizeImpl<short, CubicInterpolator>,
|
||||
resizeImpl<int, CubicInterpolator>,
|
||||
resizeImpl<float, CubicInterpolator>
|
||||
};
|
||||
|
||||
static const func_t* funcs[] = {nearest_funcs, linear_funcs, cubic_funcs};
|
||||
|
||||
funcs[interpolation][src.depth()](src, dst, fx, fy);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
PARAM_TEST_CASE(Resize, cv::gpu::DeviceInfo, cv::Size, MatType, double, Interpolation, UseRoi)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
cv::Size size;
|
||||
double coeff;
|
||||
int interpolation;
|
||||
int type;
|
||||
bool useRoi;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
size = GET_PARAM(1);
|
||||
type = GET_PARAM(2);
|
||||
coeff = GET_PARAM(3);
|
||||
interpolation = GET_PARAM(4);
|
||||
useRoi = GET_PARAM(5);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(Resize, Accuracy)
|
||||
{
|
||||
cv::Mat src = randomMat(size, type);
|
||||
|
||||
cv::gpu::GpuMat dst = createMat(cv::Size(cv::saturate_cast<int>(src.cols * coeff), cv::saturate_cast<int>(src.rows * coeff)), type, useRoi);
|
||||
cv::gpu::resize(loadMat(src, useRoi), dst, cv::Size(), coeff, coeff, interpolation);
|
||||
|
||||
cv::Mat dst_gold;
|
||||
resizeGold(src, dst_gold, coeff, coeff, interpolation);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, src.depth() == CV_32F ? 1e-2 : 1.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Resize, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
DIFFERENT_SIZES,
|
||||
testing::Values(MatType(CV_8UC3), MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
|
||||
testing::Values(0.3, 0.5, 1.5, 2.0),
|
||||
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Test NPP
|
||||
|
||||
PARAM_TEST_CASE(ResizeNPP, cv::gpu::DeviceInfo, MatType, double, Interpolation)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
double coeff;
|
||||
int interpolation;
|
||||
int type;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
type = GET_PARAM(1);
|
||||
coeff = GET_PARAM(2);
|
||||
interpolation = GET_PARAM(3);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(ResizeNPP, Accuracy)
|
||||
{
|
||||
if (type == CV_8UC1 && interpolation == cv::INTER_CUBIC)
|
||||
return;
|
||||
|
||||
cv::Mat src = readImageType("stereobp/aloe-L.png", type);
|
||||
|
||||
cv::gpu::GpuMat dst;
|
||||
cv::gpu::resize(loadMat(src), dst, cv::Size(), coeff, coeff, interpolation);
|
||||
|
||||
cv::Mat dst_gold;
|
||||
resizeGold(src, dst_gold, coeff, coeff, interpolation);
|
||||
|
||||
EXPECT_MAT_SIMILAR(dst_gold, dst, 1e-1);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, ResizeNPP, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),
|
||||
testing::Values(0.3, 0.5, 1.5, 2.0),
|
||||
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC))));
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
@@ -0,0 +1,88 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
PARAM_TEST_CASE(Threshold, cv::gpu::DeviceInfo, cv::Size, MatType, ThreshOp, UseRoi)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
cv::Size size;
|
||||
int type;
|
||||
int threshOp;
|
||||
bool useRoi;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
size = GET_PARAM(1);
|
||||
type = GET_PARAM(2);
|
||||
threshOp = GET_PARAM(3);
|
||||
useRoi = GET_PARAM(4);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(Threshold, Accuracy)
|
||||
{
|
||||
cv::Mat src = randomMat(size, type);
|
||||
double maxVal = randomDouble(20.0, 127.0);
|
||||
double thresh = randomDouble(0.0, maxVal);
|
||||
|
||||
cv::gpu::GpuMat dst = createMat(src.size(), src.type(), useRoi);
|
||||
cv::gpu::threshold(loadMat(src, useRoi), dst, thresh, maxVal, threshOp);
|
||||
|
||||
cv::Mat dst_gold;
|
||||
cv::threshold(src, dst_gold, thresh, maxVal, threshOp);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Threshold, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
DIFFERENT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_16SC1), MatType(CV_32FC1)),
|
||||
testing::Values(ThreshOp(cv::THRESH_BINARY), ThreshOp(cv::THRESH_BINARY_INV), ThreshOp(cv::THRESH_TRUNC), ThreshOp(cv::THRESH_TOZERO), ThreshOp(cv::THRESH_TOZERO_INV)),
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace
|
||||
{
|
||||
cv::Mat createTransfomMatrix(cv::Size srcSize, double angle)
|
||||
{
|
||||
cv::Mat M(2, 3, CV_64FC1);
|
||||
M.at<double>(0, 0) = std::cos(angle); M.at<double>(0, 1) = -std::sin(angle); M.at<double>(0, 2) = srcSize.width / 2;
|
||||
M.at<double>(1, 0) = std::sin(angle); M.at<double>(1, 1) = std::cos(angle); M.at<double>(1, 2) = 0.0;
|
||||
|
||||
return M;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Test buildWarpAffineMaps
|
||||
|
||||
PARAM_TEST_CASE(BuildWarpAffineMaps, cv::gpu::DeviceInfo, cv::Size, Inverse)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
cv::Size size;
|
||||
bool inverse;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
size = GET_PARAM(1);
|
||||
inverse = GET_PARAM(2);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(BuildWarpAffineMaps, Accuracy)
|
||||
{
|
||||
cv::Mat M = createTransfomMatrix(size, CV_PI / 4);
|
||||
cv::gpu::GpuMat xmap, ymap;
|
||||
cv::gpu::buildWarpAffineMaps(M, inverse, size, xmap, ymap);
|
||||
|
||||
int interpolation = cv::INTER_NEAREST;
|
||||
int borderMode = cv::BORDER_CONSTANT;
|
||||
|
||||
cv::Mat src = randomMat(randomSize(200, 400), CV_8UC1);
|
||||
cv::Mat dst;
|
||||
cv::remap(src, dst, cv::Mat(xmap), cv::Mat(ymap), interpolation, borderMode);
|
||||
|
||||
int flags = interpolation;
|
||||
if (inverse)
|
||||
flags |= cv::WARP_INVERSE_MAP;
|
||||
cv::Mat dst_gold;
|
||||
cv::warpAffine(src, dst_gold, M, size, flags, borderMode);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, BuildWarpAffineMaps, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
DIFFERENT_SIZES,
|
||||
DIRECT_INVERSE));
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Gold implementation
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T, template <typename> class Interpolator> void warpAffineImpl(const cv::Mat& src, const cv::Mat& M, cv::Size dsize, cv::Mat& dst, int borderType, cv::Scalar borderVal)
|
||||
{
|
||||
const int cn = src.channels();
|
||||
|
||||
dst.create(dsize, src.type());
|
||||
|
||||
for (int y = 0; y < dsize.height; ++y)
|
||||
{
|
||||
for (int x = 0; x < dsize.width; ++x)
|
||||
{
|
||||
float xcoo = static_cast<float>(M.at<double>(0, 0) * x + M.at<double>(0, 1) * y + M.at<double>(0, 2));
|
||||
float ycoo = static_cast<float>(M.at<double>(1, 0) * x + M.at<double>(1, 1) * y + M.at<double>(1, 2));
|
||||
|
||||
for (int c = 0; c < cn; ++c)
|
||||
dst.at<T>(y, x * cn + c) = Interpolator<T>::getValue(src, ycoo, xcoo, c, borderType, borderVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void warpAffineGold(const cv::Mat& src, const cv::Mat& M, bool inverse, cv::Size dsize, cv::Mat& dst, int interpolation, int borderType, cv::Scalar borderVal)
|
||||
{
|
||||
typedef void (*func_t)(const cv::Mat& src, const cv::Mat& M, cv::Size dsize, cv::Mat& dst, int borderType, cv::Scalar borderVal);
|
||||
|
||||
static const func_t nearest_funcs[] =
|
||||
{
|
||||
warpAffineImpl<unsigned char, NearestInterpolator>,
|
||||
warpAffineImpl<signed char, NearestInterpolator>,
|
||||
warpAffineImpl<unsigned short, NearestInterpolator>,
|
||||
warpAffineImpl<short, NearestInterpolator>,
|
||||
warpAffineImpl<int, NearestInterpolator>,
|
||||
warpAffineImpl<float, NearestInterpolator>
|
||||
};
|
||||
|
||||
static const func_t linear_funcs[] =
|
||||
{
|
||||
warpAffineImpl<unsigned char, LinearInterpolator>,
|
||||
warpAffineImpl<signed char, LinearInterpolator>,
|
||||
warpAffineImpl<unsigned short, LinearInterpolator>,
|
||||
warpAffineImpl<short, LinearInterpolator>,
|
||||
warpAffineImpl<int, LinearInterpolator>,
|
||||
warpAffineImpl<float, LinearInterpolator>
|
||||
};
|
||||
|
||||
static const func_t cubic_funcs[] =
|
||||
{
|
||||
warpAffineImpl<unsigned char, CubicInterpolator>,
|
||||
warpAffineImpl<signed char, CubicInterpolator>,
|
||||
warpAffineImpl<unsigned short, CubicInterpolator>,
|
||||
warpAffineImpl<short, CubicInterpolator>,
|
||||
warpAffineImpl<int, CubicInterpolator>,
|
||||
warpAffineImpl<float, CubicInterpolator>
|
||||
};
|
||||
|
||||
static const func_t* funcs[] = {nearest_funcs, linear_funcs, cubic_funcs};
|
||||
|
||||
if (inverse)
|
||||
funcs[interpolation][src.depth()](src, M, dsize, dst, borderType, borderVal);
|
||||
else
|
||||
{
|
||||
cv::Mat iM;
|
||||
cv::invertAffineTransform(M, iM);
|
||||
funcs[interpolation][src.depth()](src, iM, dsize, dst, borderType, borderVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
PARAM_TEST_CASE(WarpAffine, cv::gpu::DeviceInfo, cv::Size, MatType, Inverse, Interpolation, Border, UseRoi)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
cv::Size size;
|
||||
int type;
|
||||
bool inverse;
|
||||
int interpolation;
|
||||
int borderType;
|
||||
bool useRoi;
|
||||
|
||||
cv::Mat M;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
size = GET_PARAM(1);
|
||||
type = GET_PARAM(2);
|
||||
inverse = GET_PARAM(3);
|
||||
interpolation = GET_PARAM(4);
|
||||
borderType = GET_PARAM(5);
|
||||
useRoi = GET_PARAM(6);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(WarpAffine, Accuracy)
|
||||
{
|
||||
cv::Mat src = randomMat(size, type);
|
||||
cv::Mat M = createTransfomMatrix(size, CV_PI / 3);
|
||||
int flags = interpolation;
|
||||
if (inverse)
|
||||
flags |= cv::WARP_INVERSE_MAP;
|
||||
cv::Scalar val = randomScalar(0.0, 255.0);
|
||||
|
||||
cv::gpu::GpuMat dst = createMat(size, type, useRoi);
|
||||
cv::gpu::warpAffine(loadMat(src, useRoi), dst, M, size, flags, borderType, val);
|
||||
|
||||
cv::Mat dst_gold;
|
||||
warpAffineGold(src, M, inverse, size, dst_gold, interpolation, borderType, val);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, src.depth() == CV_32F ? 1e-1 : 1.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, WarpAffine, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
DIFFERENT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
|
||||
DIRECT_INVERSE,
|
||||
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
|
||||
testing::Values(Border(cv::BORDER_REFLECT101), Border(cv::BORDER_REPLICATE), Border(cv::BORDER_REFLECT), Border(cv::BORDER_WRAP)),
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Test NPP
|
||||
|
||||
PARAM_TEST_CASE(WarpAffineNPP, cv::gpu::DeviceInfo, MatType, Inverse, Interpolation)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
int type;
|
||||
bool inverse;
|
||||
int interpolation;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
type = GET_PARAM(1);
|
||||
inverse = GET_PARAM(2);
|
||||
interpolation = GET_PARAM(3);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(WarpAffineNPP, Accuracy)
|
||||
{
|
||||
cv::Mat src = readImageType("stereobp/aloe-L.png", type);
|
||||
cv::Mat M = createTransfomMatrix(src.size(), CV_PI / 4);
|
||||
int flags = interpolation;
|
||||
if (inverse)
|
||||
flags |= cv::WARP_INVERSE_MAP;
|
||||
|
||||
cv::gpu::GpuMat dst;
|
||||
cv::gpu::warpAffine(loadMat(src), dst, M, src.size(), flags);
|
||||
|
||||
cv::Mat dst_gold;
|
||||
warpAffineGold(src, M, inverse, src.size(), dst_gold, interpolation, cv::BORDER_CONSTANT, cv::Scalar::all(0));
|
||||
|
||||
EXPECT_MAT_SIMILAR(dst_gold, dst, 2e-2);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, WarpAffineNPP, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
|
||||
DIRECT_INVERSE,
|
||||
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC))));
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
@@ -0,0 +1,275 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
namespace
|
||||
{
|
||||
cv::Mat createTransfomMatrix(cv::Size srcSize, double angle)
|
||||
{
|
||||
cv::Mat M(3, 3, CV_64FC1);
|
||||
M.at<double>(0, 0) = std::cos(angle); M.at<double>(0, 1) = -std::sin(angle); M.at<double>(0, 2) = srcSize.width / 2;
|
||||
M.at<double>(1, 0) = std::sin(angle); M.at<double>(1, 1) = std::cos(angle); M.at<double>(1, 2) = 0.0;
|
||||
M.at<double>(2, 0) = 0.0 ; M.at<double>(2, 1) = 0.0 ; M.at<double>(2, 2) = 1.0;
|
||||
|
||||
return M;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Test buildWarpPerspectiveMaps
|
||||
|
||||
PARAM_TEST_CASE(BuildWarpPerspectiveMaps, cv::gpu::DeviceInfo, cv::Size, Inverse)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
cv::Size size;
|
||||
bool inverse;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
size = GET_PARAM(1);
|
||||
inverse = GET_PARAM(2);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(BuildWarpPerspectiveMaps, Accuracy)
|
||||
{
|
||||
cv::Mat M = createTransfomMatrix(size, CV_PI / 4);
|
||||
cv::gpu::GpuMat xmap, ymap;
|
||||
cv::gpu::buildWarpPerspectiveMaps(M, inverse, size, xmap, ymap);
|
||||
|
||||
cv::Mat src = randomMat(randomSize(200, 400), CV_8UC1);
|
||||
cv::Mat dst;
|
||||
cv::remap(src, dst, cv::Mat(xmap), cv::Mat(ymap), cv::INTER_NEAREST, cv::BORDER_CONSTANT);
|
||||
|
||||
int flags = cv::INTER_NEAREST;
|
||||
if (inverse)
|
||||
flags |= cv::WARP_INVERSE_MAP;
|
||||
cv::Mat dst_gold;
|
||||
cv::warpPerspective(src, dst_gold, M, size, flags, cv::BORDER_CONSTANT);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, BuildWarpPerspectiveMaps, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
DIFFERENT_SIZES,
|
||||
DIRECT_INVERSE));
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Gold implementation
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T, template <typename> class Interpolator> void warpPerspectiveImpl(const cv::Mat& src, const cv::Mat& M, cv::Size dsize, cv::Mat& dst, int borderType, cv::Scalar borderVal)
|
||||
{
|
||||
const int cn = src.channels();
|
||||
|
||||
dst.create(dsize, src.type());
|
||||
|
||||
for (int y = 0; y < dsize.height; ++y)
|
||||
{
|
||||
for (int x = 0; x < dsize.width; ++x)
|
||||
{
|
||||
float coeff = static_cast<float>(M.at<double>(2, 0) * x + M.at<double>(2, 1) * y + M.at<double>(2, 2));
|
||||
|
||||
float xcoo = static_cast<float>((M.at<double>(0, 0) * x + M.at<double>(0, 1) * y + M.at<double>(0, 2)) / coeff);
|
||||
float ycoo = static_cast<float>((M.at<double>(1, 0) * x + M.at<double>(1, 1) * y + M.at<double>(1, 2)) / coeff);
|
||||
|
||||
for (int c = 0; c < cn; ++c)
|
||||
dst.at<T>(y, x * cn + c) = Interpolator<T>::getValue(src, ycoo, xcoo, c, borderType, borderVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void warpPerspectiveGold(const cv::Mat& src, const cv::Mat& M, bool inverse, cv::Size dsize, cv::Mat& dst, int interpolation, int borderType, cv::Scalar borderVal)
|
||||
{
|
||||
typedef void (*func_t)(const cv::Mat& src, const cv::Mat& M, cv::Size dsize, cv::Mat& dst, int borderType, cv::Scalar borderVal);
|
||||
|
||||
static const func_t nearest_funcs[] =
|
||||
{
|
||||
warpPerspectiveImpl<unsigned char, NearestInterpolator>,
|
||||
warpPerspectiveImpl<signed char, NearestInterpolator>,
|
||||
warpPerspectiveImpl<unsigned short, NearestInterpolator>,
|
||||
warpPerspectiveImpl<short, NearestInterpolator>,
|
||||
warpPerspectiveImpl<int, NearestInterpolator>,
|
||||
warpPerspectiveImpl<float, NearestInterpolator>
|
||||
};
|
||||
|
||||
static const func_t linear_funcs[] =
|
||||
{
|
||||
warpPerspectiveImpl<unsigned char, LinearInterpolator>,
|
||||
warpPerspectiveImpl<signed char, LinearInterpolator>,
|
||||
warpPerspectiveImpl<unsigned short, LinearInterpolator>,
|
||||
warpPerspectiveImpl<short, LinearInterpolator>,
|
||||
warpPerspectiveImpl<int, LinearInterpolator>,
|
||||
warpPerspectiveImpl<float, LinearInterpolator>
|
||||
};
|
||||
|
||||
static const func_t cubic_funcs[] =
|
||||
{
|
||||
warpPerspectiveImpl<unsigned char, CubicInterpolator>,
|
||||
warpPerspectiveImpl<signed char, CubicInterpolator>,
|
||||
warpPerspectiveImpl<unsigned short, CubicInterpolator>,
|
||||
warpPerspectiveImpl<short, CubicInterpolator>,
|
||||
warpPerspectiveImpl<int, CubicInterpolator>,
|
||||
warpPerspectiveImpl<float, CubicInterpolator>
|
||||
};
|
||||
|
||||
static const func_t* funcs[] = {nearest_funcs, linear_funcs, cubic_funcs};
|
||||
|
||||
if (inverse)
|
||||
funcs[interpolation][src.depth()](src, M, dsize, dst, borderType, borderVal);
|
||||
else
|
||||
{
|
||||
cv::Mat iM;
|
||||
cv::invert(M, iM);
|
||||
funcs[interpolation][src.depth()](src, iM, dsize, dst, borderType, borderVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
PARAM_TEST_CASE(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, MatType, Inverse, Interpolation, Border, UseRoi)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
cv::Size size;
|
||||
int type;
|
||||
bool inverse;
|
||||
int interpolation;
|
||||
int borderType;
|
||||
bool useRoi;
|
||||
|
||||
cv::Mat M;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
size = GET_PARAM(1);
|
||||
type = GET_PARAM(2);
|
||||
inverse = GET_PARAM(3);
|
||||
interpolation = GET_PARAM(4);
|
||||
borderType = GET_PARAM(5);
|
||||
useRoi = GET_PARAM(6);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(WarpPerspective, Accuracy)
|
||||
{
|
||||
cv::Mat src = randomMat(size, type);
|
||||
cv::Mat M = createTransfomMatrix(size, CV_PI / 3);
|
||||
int flags = interpolation;
|
||||
if (inverse)
|
||||
flags |= cv::WARP_INVERSE_MAP;
|
||||
cv::Scalar val = randomScalar(0.0, 255.0);
|
||||
|
||||
cv::gpu::GpuMat dst = createMat(size, type, useRoi);
|
||||
cv::gpu::warpPerspective(loadMat(src, useRoi), dst, M, size, flags, borderType, val);
|
||||
|
||||
cv::Mat dst_gold;
|
||||
warpPerspectiveGold(src, M, inverse, size, dst_gold, interpolation, borderType, val);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, src.depth() == CV_32F ? 1e-1 : 1.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, WarpPerspective, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
DIFFERENT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
|
||||
DIRECT_INVERSE,
|
||||
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
|
||||
testing::Values(Border(cv::BORDER_REFLECT101), Border(cv::BORDER_REPLICATE), Border(cv::BORDER_REFLECT), Border(cv::BORDER_WRAP)),
|
||||
WHOLE_SUBMAT));
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Test NPP
|
||||
|
||||
PARAM_TEST_CASE(WarpPerspectiveNPP, cv::gpu::DeviceInfo, MatType, Inverse, Interpolation)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
int type;
|
||||
bool inverse;
|
||||
int interpolation;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
type = GET_PARAM(1);
|
||||
inverse = GET_PARAM(2);
|
||||
interpolation = GET_PARAM(3);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(WarpPerspectiveNPP, Accuracy)
|
||||
{
|
||||
cv::Mat src = readImageType("stereobp/aloe-L.png", type);
|
||||
cv::Mat M = createTransfomMatrix(src.size(), CV_PI / 4);
|
||||
int flags = interpolation;
|
||||
if (inverse)
|
||||
flags |= cv::WARP_INVERSE_MAP;
|
||||
|
||||
cv::gpu::GpuMat dst;
|
||||
cv::gpu::warpPerspective(loadMat(src), dst, M, src.size(), flags);
|
||||
|
||||
cv::Mat dst_gold;
|
||||
warpPerspectiveGold(src, M, inverse, src.size(), dst_gold, interpolation, cv::BORDER_CONSTANT, cv::Scalar::all(0));
|
||||
|
||||
EXPECT_MAT_SIMILAR(dst_gold, dst, 2e-2);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, WarpPerspectiveNPP, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
|
||||
DIRECT_INVERSE,
|
||||
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC))));
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
@@ -39,36 +39,94 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::gpu;
|
||||
using namespace cvtest;
|
||||
|
||||
GpuMat loadMat(const Mat& m, bool useRoi)
|
||||
int randomInt(int minVal, int maxVal)
|
||||
{
|
||||
RNG& rng = TS::ptr()->get_rng();
|
||||
return rng.uniform(minVal, maxVal);
|
||||
}
|
||||
|
||||
double randomDouble(double minVal, double maxVal)
|
||||
{
|
||||
RNG& rng = TS::ptr()->get_rng();
|
||||
return rng.uniform(minVal, maxVal);
|
||||
}
|
||||
|
||||
Size randomSize(int minVal, int maxVal)
|
||||
{
|
||||
return cv::Size(randomInt(minVal, maxVal), randomInt(minVal, maxVal));
|
||||
}
|
||||
|
||||
Scalar randomScalar(double minVal, double maxVal)
|
||||
{
|
||||
return Scalar(randomDouble(minVal, maxVal), randomDouble(minVal, maxVal), randomDouble(minVal, maxVal), randomDouble(minVal, maxVal));
|
||||
}
|
||||
|
||||
Mat randomMat(Size size, int type, double minVal, double maxVal)
|
||||
{
|
||||
return randomMat(TS::ptr()->get_rng(), size, type, minVal, maxVal, false);
|
||||
}
|
||||
|
||||
cv::gpu::GpuMat createMat(cv::Size size, int type, bool useRoi)
|
||||
{
|
||||
Size size = m.size();
|
||||
Size size0 = size;
|
||||
|
||||
if (useRoi)
|
||||
{
|
||||
RNG& rng = TS::ptr()->get_rng();
|
||||
|
||||
size0.width += rng.uniform(5, 15);
|
||||
size0.height += rng.uniform(5, 15);
|
||||
size0.width += randomInt(5, 15);
|
||||
size0.height += randomInt(5, 15);
|
||||
}
|
||||
|
||||
GpuMat d_m(size0, m.type());
|
||||
GpuMat d_m(size0, type);
|
||||
|
||||
if (size0 != size)
|
||||
d_m = d_m(Rect((size0.width - size.width) / 2, (size0.height - size.height) / 2, size.width, size.height));
|
||||
|
||||
d_m.upload(m);
|
||||
|
||||
return d_m;
|
||||
}
|
||||
|
||||
GpuMat loadMat(const Mat& m, bool useRoi)
|
||||
{
|
||||
GpuMat d_m = createMat(m.size(), m.type(), useRoi);
|
||||
d_m.upload(m);
|
||||
return d_m;
|
||||
}
|
||||
|
||||
void showDiff(InputArray gold_, InputArray actual_, double eps)
|
||||
{
|
||||
Mat gold;
|
||||
if (gold_.kind() == _InputArray::MAT)
|
||||
gold = gold_.getMat();
|
||||
else
|
||||
gold_.getGpuMat().download(gold);
|
||||
|
||||
Mat actual;
|
||||
if (actual_.kind() == _InputArray::MAT)
|
||||
actual = actual_.getMat();
|
||||
else
|
||||
actual_.getGpuMat().download(actual);
|
||||
|
||||
Mat diff;
|
||||
absdiff(gold, actual, diff);
|
||||
threshold(diff, diff, eps, 255.0, cv::THRESH_BINARY);
|
||||
|
||||
namedWindow("gold", WINDOW_NORMAL);
|
||||
namedWindow("actual", WINDOW_NORMAL);
|
||||
namedWindow("diff", WINDOW_NORMAL);
|
||||
|
||||
imshow("gold", gold);
|
||||
imshow("actual", actual);
|
||||
imshow("diff", diff);
|
||||
|
||||
waitKey();
|
||||
}
|
||||
|
||||
bool supportFeature(const DeviceInfo& info, FeatureSet feature)
|
||||
{
|
||||
return TargetArchs::builtWith(feature) && info.supports(feature);
|
||||
@@ -149,6 +207,24 @@ Mat readImage(const string& fileName, int flags)
|
||||
return imread(string(cvtest::TS::ptr()->get_data_path()) + fileName, flags);
|
||||
}
|
||||
|
||||
Mat readImageType(const string& fname, int type)
|
||||
{
|
||||
Mat src = readImage(fname, CV_MAT_CN(type) == 1 ? IMREAD_GRAYSCALE : IMREAD_COLOR);
|
||||
if (CV_MAT_CN(type) == 4)
|
||||
{
|
||||
Mat temp;
|
||||
cvtColor(src, temp, cv::COLOR_BGR2BGRA);
|
||||
swap(src, temp);
|
||||
}
|
||||
src.convertTo(src, CV_MAT_DEPTH(type));
|
||||
return src;
|
||||
}
|
||||
|
||||
double checkNorm(const Mat& m)
|
||||
{
|
||||
return norm(m, NORM_INF);
|
||||
}
|
||||
|
||||
double checkNorm(const Mat& m1, const Mat& m2)
|
||||
{
|
||||
return norm(m1, m2, NORM_INF);
|
||||
@@ -173,3 +249,11 @@ void PrintTo(const UseRoi& useRoi, std::ostream* os)
|
||||
else
|
||||
(*os) << "whole matrix";
|
||||
}
|
||||
|
||||
void PrintTo(const Inverse& inverse, std::ostream* os)
|
||||
{
|
||||
if (inverse)
|
||||
(*os) << "inverse";
|
||||
else
|
||||
(*os) << "direct";
|
||||
}
|
||||
@@ -39,11 +39,20 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_TEST_GPU_BASE_HPP__
|
||||
#define __OPENCV_TEST_GPU_BASE_HPP__
|
||||
#ifndef __OPENCV_TEST_UTILITY_HPP__
|
||||
#define __OPENCV_TEST_UTILITY_HPP__
|
||||
|
||||
int randomInt(int minVal, int maxVal);
|
||||
double randomDouble(double minVal, double maxVal);
|
||||
cv::Size randomSize(int minVal, int maxVal);
|
||||
cv::Scalar randomScalar(double minVal, double maxVal);
|
||||
cv::Mat randomMat(cv::Size size, int type, double minVal = 0.0, double maxVal = 255.0);
|
||||
|
||||
cv::gpu::GpuMat createMat(cv::Size size, int type, bool useRoi = false);
|
||||
cv::gpu::GpuMat loadMat(const cv::Mat& m, bool useRoi = false);
|
||||
|
||||
void showDiff(cv::InputArray gold, cv::InputArray actual, double eps);
|
||||
|
||||
//! return true if device supports specified feature and gpu module was built with support the feature.
|
||||
bool supportFeature(const cv::gpu::DeviceInfo& info, cv::gpu::FeatureSet feature);
|
||||
|
||||
@@ -54,22 +63,29 @@ std::vector<cv::gpu::DeviceInfo> devices(cv::gpu::FeatureSet feature);
|
||||
|
||||
//! read image from testdata folder.
|
||||
cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR);
|
||||
cv::Mat readImageType(const std::string& fname, int type);
|
||||
|
||||
double checkNorm(const cv::Mat& m);
|
||||
double checkNorm(const cv::Mat& m1, const cv::Mat& m2);
|
||||
double checkSimilarity(const cv::Mat& m1, const cv::Mat& m2);
|
||||
|
||||
#define EXPECT_MAT_NORM(mat, eps) \
|
||||
{ \
|
||||
EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \
|
||||
}
|
||||
|
||||
#define EXPECT_MAT_NEAR(mat1, mat2, eps) \
|
||||
{ \
|
||||
ASSERT_EQ(mat1.type(), mat2.type()); \
|
||||
ASSERT_EQ(mat1.size(), mat2.size()); \
|
||||
EXPECT_LE(checkNorm(mat1, mat2), eps); \
|
||||
EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \
|
||||
}
|
||||
|
||||
#define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \
|
||||
{ \
|
||||
ASSERT_EQ(mat1.type(), mat2.type()); \
|
||||
ASSERT_EQ(mat1.size(), mat2.size()); \
|
||||
EXPECT_LE(checkSimilarity(mat1, mat2), eps); \
|
||||
EXPECT_LE(checkSimilarity(cv::Mat(mat1), cv::Mat(mat2)), eps); \
|
||||
}
|
||||
|
||||
namespace cv { namespace gpu
|
||||
@@ -99,6 +115,19 @@ private:
|
||||
|
||||
void PrintTo(const UseRoi& useRoi, std::ostream* os);
|
||||
|
||||
class Inverse
|
||||
{
|
||||
public:
|
||||
inline Inverse(bool val = false) : val_(val) {}
|
||||
|
||||
inline operator bool() const { return val_; }
|
||||
|
||||
private:
|
||||
bool val_;
|
||||
};
|
||||
|
||||
void PrintTo(const Inverse& useRoi, std::ostream* os);
|
||||
|
||||
CV_ENUM(CmpCode, cv::CMP_EQ, cv::CMP_GT, cv::CMP_GE, cv::CMP_LT, cv::CMP_LE, cv::CMP_NE)
|
||||
|
||||
CV_ENUM(NormCode, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_TYPE_MASK, cv::NORM_RELATIVE, cv::NORM_MINMAX)
|
||||
@@ -127,11 +156,19 @@ CV_ENUM(TemplateMethod, cv::TM_SQDIFF, cv::TM_SQDIFF_NORMED, cv::TM_CCORR, cv::T
|
||||
CV_FLAGS(DftFlags, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMPLEX_OUTPUT, cv::DFT_REAL_OUTPUT)
|
||||
|
||||
#define PARAM_TEST_CASE(name, ...) struct name : testing::TestWithParam< std::tr1::tuple< __VA_ARGS__ > >
|
||||
|
||||
#define GET_PARAM(k) std::tr1::get< k >(GetParam())
|
||||
|
||||
#define ALL_DEVICES testing::ValuesIn(devices())
|
||||
#define DEVICES(feature) testing::ValuesIn(devices(feature))
|
||||
|
||||
#define ALL_TYPES testing::ValuesIn(all_types())
|
||||
#define TYPES(depth_start, depth_end, cn_start, cn_end) testing::ValuesIn(types(depth_start, depth_end, cn_start, cn_end))
|
||||
#define USE_ROI testing::Values(false, true)
|
||||
|
||||
#endif // __OPENCV_TEST_GPU_BASE_HPP__
|
||||
#define DIFFERENT_SIZES testing::Values(cv::Size(128, 128), cv::Size(113, 113))
|
||||
|
||||
#define WHOLE_SUBMAT testing::Values(UseRoi(false), UseRoi(true))
|
||||
|
||||
#define DIRECT_INVERSE testing::Values(Inverse(false), Inverse(true))
|
||||
|
||||
#endif // __OPENCV_TEST_UTILITY_HPP__
|
||||
Reference in New Issue
Block a user