2012-07-17 01:08:14 +08:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// License Agreement
|
|
|
|
// For Open Source Computer Vision Library
|
|
|
|
//
|
|
|
|
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
|
|
|
|
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
2013-05-08 15:12:12 +08:00
|
|
|
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
2012-07-17 01:08:14 +08:00
|
|
|
// Third party copyrights are property of their respective owners.
|
|
|
|
//
|
|
|
|
// @Authors
|
|
|
|
// Niko Li, newlife20080214@gmail.com
|
|
|
|
// Jia Haipeng, jiahaipeng95@gmail.com
|
|
|
|
// Shengen Yan, yanshengen@gmail.com
|
|
|
|
// Jiang Liyuan,jlyuan001.good@163.com
|
|
|
|
// Rock Li, Rock.Li@amd.com
|
|
|
|
// Zailong Wu, bullet@yeah.net
|
2013-05-08 15:12:12 +08:00
|
|
|
// Yao Wang, bitwangyaoyao@gmail.com
|
2012-07-17 01:08:14 +08:00
|
|
|
//
|
|
|
|
// 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
|
2013-10-25 22:00:46 +08:00
|
|
|
// and/or other materials provided with the distribution.
|
2012-07-17 01:08:14 +08:00
|
|
|
//
|
|
|
|
// * The name of the copyright holders 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*/
|
|
|
|
|
2013-08-08 22:18:54 +08:00
|
|
|
#include "test_precomp.hpp"
|
2012-07-17 01:08:14 +08:00
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
#ifdef HAVE_OPENCL
|
|
|
|
|
|
|
|
using namespace cv;
|
|
|
|
using namespace cv::ocl;
|
|
|
|
using namespace cvtest;
|
|
|
|
using namespace testing;
|
|
|
|
using namespace std;
|
|
|
|
|
2013-10-23 23:53:04 +08:00
|
|
|
static bool relativeError(double actual, double expected, double eps)
|
|
|
|
{
|
|
|
|
return std::abs(actual - expected) / actual < eps;
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// LUT /////////////////////////////////////////////////
|
|
|
|
|
2013-10-19 05:17:46 +08:00
|
|
|
PARAM_TEST_CASE(Lut, MatDepth, MatDepth, bool, bool)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
int lut_depth;
|
|
|
|
int cn;
|
|
|
|
bool use_roi, same_cn;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
// src mat
|
|
|
|
cv::Mat src;
|
|
|
|
cv::Mat lut;
|
2012-07-17 01:08:14 +08:00
|
|
|
cv::Mat dst;
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
// src mat with roi
|
|
|
|
cv::Mat src_roi;
|
|
|
|
cv::Mat lut_roi;
|
2012-07-17 01:08:14 +08:00
|
|
|
cv::Mat dst_roi;
|
2013-05-08 15:12:12 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
// ocl dst mat for testing
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::oclMat gsrc_whole;
|
|
|
|
cv::ocl::oclMat glut_whole;
|
2012-07-17 01:08:14 +08:00
|
|
|
cv::ocl::oclMat gdst_whole;
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
// ocl mat with roi
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::oclMat gsrc_roi;
|
|
|
|
cv::ocl::oclMat glut_roi;
|
|
|
|
cv::ocl::oclMat gdst_roi;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
|
|
|
virtual void SetUp()
|
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
lut_depth = GET_PARAM(0);
|
|
|
|
cn = GET_PARAM(1);
|
|
|
|
same_cn = GET_PARAM(2);
|
|
|
|
use_roi = GET_PARAM(3);
|
|
|
|
}
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
void random_roi()
|
|
|
|
{
|
2013-10-03 00:18:48 +08:00
|
|
|
const int src_type = CV_MAKE_TYPE(CV_8U, cn);
|
|
|
|
const int lut_type = CV_MAKE_TYPE(lut_depth, same_cn ? cn : 1);
|
|
|
|
const int dst_type = CV_MAKE_TYPE(lut_depth, cn);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Size roiSize = randomSize(1, MAX_VALUE);
|
|
|
|
Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(src, src_roi, roiSize, srcBorder, src_type, 0, 256);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Size lutRoiSize = Size(256, 1);
|
|
|
|
Border lutBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(lut, lut_roi, lutRoiSize, lutBorder, lut_type, 5, 16);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Border dstBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(dst, dst_roi, roiSize, dstBorder, dst_type, 5, 16);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
generateOclMat(gsrc_whole, gsrc_roi, src, roiSize, srcBorder);
|
|
|
|
generateOclMat(glut_whole, glut_roi, lut, lutRoiSize, lutBorder);
|
|
|
|
generateOclMat(gdst_whole, gdst_roi, dst, roiSize, dstBorder);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
|
2013-05-08 17:07:44 +08:00
|
|
|
void Near(double threshold = 0.)
|
|
|
|
{
|
2013-10-27 19:55:40 +08:00
|
|
|
Mat whole, roi;
|
|
|
|
gdst_whole.download(whole);
|
|
|
|
gdst_roi.download(roi);
|
|
|
|
|
|
|
|
EXPECT_MAT_NEAR(dst, whole, threshold);
|
|
|
|
EXPECT_MAT_NEAR(dst_roi, roi, threshold);
|
2013-05-08 17:07:44 +08:00
|
|
|
}
|
2013-09-24 18:13:10 +08:00
|
|
|
};
|
2013-05-08 17:07:44 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Lut, Mat)
|
2013-09-24 18:13:10 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2013-08-21 20:44:09 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
random_roi();
|
2013-05-08 17:07:44 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::LUT(src_roi, lut_roi, dst_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::LUT(gsrc_roi, glut_roi, gdst_roi);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
|
|
|
Near();
|
|
|
|
}
|
|
|
|
}
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
///////////////////////// ArithmTestBase ///////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-19 05:17:46 +08:00
|
|
|
PARAM_TEST_CASE(ArithmTestBase, MatDepth, Channels, bool)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
int depth;
|
|
|
|
int cn;
|
|
|
|
bool use_roi;
|
|
|
|
cv::Scalar val;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
// src mat
|
|
|
|
cv::Mat src1;
|
|
|
|
cv::Mat src2;
|
|
|
|
cv::Mat mask;
|
|
|
|
cv::Mat dst1;
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::Mat dst2;
|
2013-09-24 18:13:10 +08:00
|
|
|
|
|
|
|
// src mat with roi
|
|
|
|
cv::Mat src1_roi;
|
|
|
|
cv::Mat src2_roi;
|
|
|
|
cv::Mat mask_roi;
|
|
|
|
cv::Mat dst1_roi;
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::Mat dst2_roi;
|
2013-09-24 18:13:10 +08:00
|
|
|
|
|
|
|
// ocl dst mat for testing
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::oclMat gsrc1_whole;
|
|
|
|
cv::ocl::oclMat gsrc2_whole;
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::ocl::oclMat gdst1_whole;
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::oclMat gdst2_whole;
|
|
|
|
cv::ocl::oclMat gmask_whole;
|
2013-09-24 18:13:10 +08:00
|
|
|
|
|
|
|
// ocl mat with roi
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::oclMat gsrc1_roi;
|
|
|
|
cv::ocl::oclMat gsrc2_roi;
|
|
|
|
cv::ocl::oclMat gdst1_roi;
|
|
|
|
cv::ocl::oclMat gdst2_roi;
|
|
|
|
cv::ocl::oclMat gmask_roi;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
virtual void SetUp()
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
depth = GET_PARAM(0);
|
|
|
|
cn = GET_PARAM(1);
|
|
|
|
use_roi = GET_PARAM(2);
|
|
|
|
}
|
|
|
|
|
2013-11-05 03:59:56 +08:00
|
|
|
virtual void random_roi()
|
2013-09-24 18:13:10 +08:00
|
|
|
{
|
2013-10-03 00:18:48 +08:00
|
|
|
const int type = CV_MAKE_TYPE(depth, cn);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Size roiSize = randomSize(1, MAX_VALUE);
|
2013-11-05 03:59:56 +08:00
|
|
|
Border src1Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
2014-03-13 19:35:53 +08:00
|
|
|
randomSubMat(src1, src1_roi, roiSize, src1Border, type, -11, 11);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Border src2Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(src2, src2_roi, roiSize, src2Border, type, -1540, 1740);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Border dst1Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(dst1, dst1_roi, roiSize, dst1Border, type, 5, 16);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Border dst2Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(dst2, dst2_roi, roiSize, dst2Border, type, 5, 16);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Border maskBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(mask, mask_roi, roiSize, maskBorder, CV_8UC1, 0, 2);
|
|
|
|
cv::threshold(mask, mask, 0.5, 255., CV_8UC1);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
|
|
|
|
2013-11-05 03:59:56 +08:00
|
|
|
generateOclMat(gsrc1_whole, gsrc1_roi, src1, roiSize, src1Border);
|
2013-10-03 00:18:48 +08:00
|
|
|
generateOclMat(gsrc2_whole, gsrc2_roi, src2, roiSize, src2Border);
|
|
|
|
generateOclMat(gdst1_whole, gdst1_roi, dst1, roiSize, dst1Border);
|
|
|
|
generateOclMat(gdst2_whole, gdst2_roi, dst2, roiSize, dst2Border);
|
|
|
|
generateOclMat(gmask_whole, gmask_roi, mask, roiSize, maskBorder);
|
2013-10-23 22:42:55 +08:00
|
|
|
|
|
|
|
val = cv::Scalar(rng.uniform(-100.0, 100.0), rng.uniform(-100.0, 100.0),
|
|
|
|
rng.uniform(-100.0, 100.0), rng.uniform(-100.0, 100.0));
|
2013-09-24 18:13:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Near(double threshold = 0.)
|
|
|
|
{
|
2013-10-27 19:55:40 +08:00
|
|
|
Mat whole, roi;
|
|
|
|
gdst1_whole.download(whole);
|
|
|
|
gdst1_roi.download(roi);
|
|
|
|
|
|
|
|
EXPECT_MAT_NEAR(dst1, whole, threshold);
|
|
|
|
EXPECT_MAT_NEAR(dst1_roi, roi, threshold);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
void Near1(double threshold = 0.)
|
|
|
|
{
|
2013-10-27 19:55:40 +08:00
|
|
|
Mat whole, roi;
|
|
|
|
gdst2_whole.download(whole);
|
|
|
|
gdst2_roi.download(roi);
|
|
|
|
|
|
|
|
EXPECT_MAT_NEAR(dst2, whole, threshold);
|
|
|
|
EXPECT_MAT_NEAR(dst2_roi, roi, threshold);
|
2013-09-24 18:13:10 +08:00
|
|
|
}
|
|
|
|
};
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Exp /////////////////////////////////////////////////
|
|
|
|
|
|
|
|
typedef ArithmTestBase Exp;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Exp, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::exp(src1_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::exp(gsrc1_roi, gdst1_roi);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(2);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Log /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Log;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Log, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::log(src1_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::log(gsrc1_roi, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Add /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Add;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Add, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::add(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::add(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Add, Mat_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::add(src1_roi, src2_roi, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::add(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
2013-05-08 17:07:44 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Add, Scalar)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::add(src1_roi, val, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::add(gsrc1_roi, val, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Add, Scalar_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::add(src1_roi, val, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::add(gsrc1_roi, val, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Sub /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Sub;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Sub, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::subtract(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::subtract(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Sub, Mat_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::subtract(src1_roi, src2_roi, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::subtract(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
2013-05-08 15:12:12 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Sub, Scalar)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::subtract(src1_roi, val, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::subtract(gsrc1_roi, val, gdst1_roi);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Sub, Scalar_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::subtract(src1_roi, val, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::subtract(gsrc1_roi, val, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Mul /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Mul;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Mul, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::multiply(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::multiply(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Mul, Scalar)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-10-23 22:42:55 +08:00
|
|
|
cv::multiply(Scalar::all(val[0]), src1_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::multiply(val[0], gsrc1_roi, gdst1_roi);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Mul, Mat_Scalar)
|
2013-09-24 18:13:10 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
cv::multiply(src1_roi, src2_roi, dst1_roi, val[0]);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::multiply(gsrc1_roi, gsrc2_roi, gdst1_roi, val[0]);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1);
|
2013-09-24 18:13:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////// Div /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Div;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Div, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::divide(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::divide(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Div, Scalar)
|
2013-09-24 18:13:10 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
cv::divide(val[0], src1_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::divide(val[0], gsrc1_roi, gdst1_roi);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1);
|
2013-09-24 18:13:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Div, Mat_Scalar)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::divide(src1_roi, src2_roi, dst1_roi, val[0]);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::divide(gsrc1_roi, gsrc2_roi, gdst1_roi, val[0]);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
Near(gdst1_roi.depth() >= CV_32F ? 4e-3 : 1);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Absdiff /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-07 21:41:50 +08:00
|
|
|
typedef ArithmTestBase Min;
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Min, Mat)
|
2013-10-07 21:41:50 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
dst1_roi = cv::min(src1_roi, src2_roi);
|
2013-10-09 18:07:24 +08:00
|
|
|
cv::ocl::min(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-10-07 21:41:50 +08:00
|
|
|
Near(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef ArithmTestBase Max;
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Max, Mat)
|
2013-10-07 21:41:50 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
dst1_roi = cv::min(src1_roi, src2_roi);
|
2013-10-09 18:07:24 +08:00
|
|
|
cv::ocl::min(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-10-07 21:41:50 +08:00
|
|
|
Near(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-08 21:16:30 +08:00
|
|
|
//////////////////////////////// Abs /////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
typedef ArithmTestBase Abs;
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Abs, Abs)
|
2013-10-08 21:16:30 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
dst1_roi = cv::abs(src1_roi);
|
2013-10-09 18:07:24 +08:00
|
|
|
cv::ocl::abs(gsrc1_roi, gdst1_roi);
|
2013-10-08 21:16:30 +08:00
|
|
|
Near(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-07 21:41:50 +08:00
|
|
|
//////////////////////////////// Absdiff /////////////////////////////////////////////////
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Absdiff;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Absdiff, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::absdiff(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::absdiff(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Absdiff, Scalar)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::absdiff(src1_roi, val, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::absdiff(gsrc1_roi, val, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// CartToPolar /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase CartToPolar;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(CartToPolar, angleInDegree)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::cartToPolar(src1_roi, src2_roi, dst1_roi, dst2_roi, true);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::cartToPolar(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi, true);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(.5);
|
|
|
|
Near1(.5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(CartToPolar, angleInRadians)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::cartToPolar(src1_roi, src2_roi, dst1_roi, dst2_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::cartToPolar(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(.5);
|
|
|
|
Near1(.5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// PolarToCart /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase PolarToCart;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(PolarToCart, angleInDegree)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::polarToCart(src1_roi, src2_roi, dst1_roi, dst2_roi, true);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::polarToCart(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi, true);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(.5);
|
|
|
|
Near1(.5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(PolarToCart, angleInRadians)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::polarToCart(src1_roi, src2_roi, dst1_roi, dst2_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::polarToCart(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(.5);
|
|
|
|
Near1(.5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Magnitude /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Magnitude;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Magnitude, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::magnitude(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::magnitude(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-09-24 18:13:10 +08:00
|
|
|
Near(depth == CV_64F ? 1e-5 : 1e-2);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Transpose /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Transpose;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Transpose, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::transpose(src1_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::transpose(gsrc1_roi, gdst1_roi);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Transpose, SquareInplace)
|
2013-09-24 18:13:10 +08:00
|
|
|
{
|
2013-10-03 00:18:48 +08:00
|
|
|
const int type = CV_MAKE_TYPE(depth, cn);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2013-09-24 18:13:10 +08:00
|
|
|
{
|
2013-10-03 00:18:48 +08:00
|
|
|
Size roiSize = randomSize(1, MAX_VALUE);
|
|
|
|
roiSize.height = roiSize.width; // make it square
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(src1, src1_roi, roiSize, srcBorder, type, 5, 16);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
generateOclMat(gsrc1_whole, gsrc1_roi, src1, roiSize, srcBorder);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
|
|
|
cv::transpose(src1_roi, src1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::transpose(gsrc1_roi, gsrc1_roi);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-10-03 00:18:48 +08:00
|
|
|
EXPECT_MAT_NEAR(src1, Mat(gsrc1_whole), 0.0);
|
|
|
|
EXPECT_MAT_NEAR(src1_roi, Mat(gsrc1_roi), 0.0);
|
2013-09-24 18:13:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////// Flip /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Flip;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Flip, X)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::flip(src1_roi, dst1_roi, 0);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::flip(gsrc1_roi, gdst1_roi, 0);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Flip, Y)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::flip(src1_roi, dst1_roi, 1);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::flip(gsrc1_roi, gdst1_roi, 1);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Flip, BOTH)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::flip(src1_roi, dst1_roi, -1);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::flip(gsrc1_roi, gdst1_roi, -1);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// MinMax /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase MinMax;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(MinMax, MAT)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2012-07-17 01:08:14 +08:00
|
|
|
double minVal, maxVal;
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
if (src1.depth() != CV_8S)
|
|
|
|
cv::minMaxIdx(src1_roi, &minVal, &maxVal, NULL, NULL);
|
2012-07-17 01:08:14 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
minVal = std::numeric_limits<double>::max();
|
|
|
|
maxVal = -std::numeric_limits<double>::max();
|
2015-10-26 21:55:42 +08:00
|
|
|
for (int i2 = 0; i2 < src1_roi.rows; ++i2)
|
|
|
|
for (int j2 = 0; j2 < src1_roi.cols; ++j2)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2015-10-26 21:55:42 +08:00
|
|
|
signed char oneVal = src1_roi.at<signed char>(i2, j2);
|
|
|
|
if (oneVal < minVal) minVal = oneVal;
|
|
|
|
if (oneVal > maxVal) maxVal = oneVal;
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
double minVal_, maxVal_;
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::minMax(gsrc1_roi, &minVal_, &maxVal_);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-05-08 15:12:12 +08:00
|
|
|
EXPECT_DOUBLE_EQ(minVal_, minVal);
|
|
|
|
EXPECT_DOUBLE_EQ(maxVal_, maxVal);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(MinMax, MASK)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-10-27 19:55:40 +08:00
|
|
|
enum { MAX_IDX = 0, MIN_IDX };
|
|
|
|
static const double minMaxGolds[2][7] =
|
|
|
|
{
|
2015-10-26 21:55:42 +08:00
|
|
|
{ (double)std::numeric_limits<uchar>::min(), (double)std::numeric_limits<char>::min(), (double)std::numeric_limits<ushort>::min(),
|
|
|
|
(double)std::numeric_limits<short>::min(), (double)std::numeric_limits<int>::min(), (double)-std::numeric_limits<float>::max(), (double)-std::numeric_limits<double>::max() },
|
|
|
|
{ (double)std::numeric_limits<uchar>::max(), (double)std::numeric_limits<char>::max(), (double)std::numeric_limits<ushort>::max(),
|
|
|
|
(double)std::numeric_limits<short>::max(), (double)std::numeric_limits<int>::max(), (double)std::numeric_limits<float>::max(), (double)std::numeric_limits<double>::max() },
|
2013-10-27 19:55:40 +08:00
|
|
|
};
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2012-07-17 01:08:14 +08:00
|
|
|
double minVal, maxVal;
|
|
|
|
cv::Point minLoc, maxLoc;
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
if (src1.depth() != CV_8S)
|
|
|
|
cv::minMaxLoc(src1_roi, &minVal, &maxVal, &minLoc, &maxLoc, mask_roi);
|
2012-07-17 01:08:14 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
minVal = std::numeric_limits<double>::max();
|
|
|
|
maxVal = -std::numeric_limits<double>::max();
|
2015-10-26 21:55:42 +08:00
|
|
|
for (int i2 = 0; i2 < src1_roi.rows; ++i2)
|
|
|
|
for (int j2 = 0; j2 < src1_roi.cols; ++j2)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2015-10-26 21:55:42 +08:00
|
|
|
signed char oneVal = src1_roi.at<signed char>(i2, j2);
|
|
|
|
unsigned char m = mask_roi.at<unsigned char>(i2, j2);
|
|
|
|
if (oneVal < minVal && m) minVal = oneVal;
|
|
|
|
if (oneVal > maxVal && m) maxVal = oneVal;
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
double minVal_, maxVal_;
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::minMax(gsrc1_roi, &minVal_, &maxVal_, gmask_roi);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-27 19:55:40 +08:00
|
|
|
if (cv::countNonZero(mask_roi) == 0)
|
|
|
|
{
|
|
|
|
EXPECT_DOUBLE_EQ(minMaxGolds[MIN_IDX][depth], minVal_);
|
|
|
|
EXPECT_DOUBLE_EQ(minMaxGolds[MAX_IDX][depth], maxVal_);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EXPECT_DOUBLE_EQ(minVal, minVal_);
|
|
|
|
EXPECT_DOUBLE_EQ(maxVal, maxVal_);
|
|
|
|
}
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// MinMaxLoc /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase MinMaxLoc;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(MinMaxLoc, MAT)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2012-07-17 01:08:14 +08:00
|
|
|
double minVal, maxVal;
|
|
|
|
cv::Point minLoc, maxLoc;
|
2015-10-26 21:55:42 +08:00
|
|
|
int oneDepth = src1.depth();
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth != CV_8S)
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::minMaxLoc(src1_roi, &minVal, &maxVal, &minLoc, &maxLoc);
|
2012-07-17 01:08:14 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
minVal = std::numeric_limits<double>::max();
|
|
|
|
maxVal = -std::numeric_limits<double>::max();
|
2015-10-26 21:55:42 +08:00
|
|
|
for (int i2 = 0; i2 < src1_roi.rows; ++i2)
|
|
|
|
for (int j2 = 0; j2 < src1_roi.cols; ++j2)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2015-10-26 21:55:42 +08:00
|
|
|
signed char oneVal = src1_roi.at<signed char>(i2, j2);
|
|
|
|
if (oneVal < minVal)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2015-10-26 21:55:42 +08:00
|
|
|
minVal = oneVal;
|
|
|
|
minLoc.x = j2;
|
|
|
|
minLoc.y = i2;
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneVal > maxVal)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2015-10-26 21:55:42 +08:00
|
|
|
maxVal = oneVal;
|
|
|
|
maxLoc.x = j2;
|
|
|
|
maxLoc.y = i2;
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
double minVal_, maxVal_;
|
|
|
|
cv::Point minLoc_, maxLoc_;
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::minMaxLoc(gsrc1_roi, &minVal_, &maxVal_, &minLoc_, &maxLoc_, cv::ocl::oclMat());
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2012-10-22 15:14:22 +08:00
|
|
|
double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.;
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 0)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<unsigned char>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<unsigned char>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<unsigned char>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<unsigned char>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<unsigned char>(minLoc_) - src1_roi.at<unsigned char>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<unsigned char>(maxLoc_) - src1_roi.at<unsigned char>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 1)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<signed char>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<signed char>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<signed char>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<signed char>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<signed char>(minLoc_) - src1_roi.at<signed char>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<signed char>(maxLoc_) - src1_roi.at<signed char>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 2)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<unsigned short>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<unsigned short>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<unsigned short>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<unsigned short>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<unsigned short>(minLoc_) - src1_roi.at<unsigned short>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<unsigned short>(maxLoc_) - src1_roi.at<unsigned short>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 3)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<signed short>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<signed short>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<signed short>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<signed short>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<signed short>(minLoc_) - src1_roi.at<signed short>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<signed short>(maxLoc_) - src1_roi.at<signed short>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 4)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<int>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<int>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<int>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<int>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<int>(minLoc_) - src1_roi.at<int>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<int>(maxLoc_) - src1_roi.at<int>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 5)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<float>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<float>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<float>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<float>(maxLoc_);
|
2015-11-16 23:07:24 +08:00
|
|
|
error0 = std::abs(src1_roi.at<float>(minLoc_) - src1_roi.at<float>(minLoc));
|
|
|
|
error1 = std::abs(src1_roi.at<float>(maxLoc_) - src1_roi.at<float>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 6)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<double>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<double>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<double>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<double>(maxLoc_);
|
2015-11-16 23:07:24 +08:00
|
|
|
error0 = std::abs(src1_roi.at<double>(minLoc_) - src1_roi.at<double>(minLoc));
|
|
|
|
error1 = std::abs(src1_roi.at<double>(maxLoc_) - src1_roi.at<double>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
|
2013-05-08 15:12:12 +08:00
|
|
|
EXPECT_DOUBLE_EQ(minVal_, minVal);
|
|
|
|
EXPECT_DOUBLE_EQ(maxVal_, maxVal);
|
|
|
|
EXPECT_DOUBLE_EQ(minlocVal_, minlocVal);
|
|
|
|
EXPECT_DOUBLE_EQ(maxlocVal_, maxlocVal);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-05-08 15:12:12 +08:00
|
|
|
EXPECT_DOUBLE_EQ(error0, 0.0);
|
|
|
|
EXPECT_DOUBLE_EQ(error1, 0.0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(MinMaxLoc, MASK)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
double minVal, maxVal;
|
|
|
|
cv::Point minLoc, maxLoc;
|
2015-10-26 21:55:42 +08:00
|
|
|
int oneDepth = src1.depth();
|
|
|
|
if (oneDepth != CV_8S)
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::minMaxLoc(src1_roi, &minVal, &maxVal, &minLoc, &maxLoc, mask_roi);
|
2012-07-17 01:08:14 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
minVal = std::numeric_limits<double>::max();
|
|
|
|
maxVal = -std::numeric_limits<double>::max();
|
2015-10-26 21:55:42 +08:00
|
|
|
for (int i2 = 0; i2 < src1_roi.rows; ++i2)
|
|
|
|
for (int j2 = 0; j2 < src1_roi.cols; ++j2)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2015-10-26 21:55:42 +08:00
|
|
|
signed char oneVal = src1_roi.at<signed char>(i2, j2);
|
|
|
|
unsigned char m = mask_roi.at<unsigned char>(i2 , j2);
|
|
|
|
if (oneVal < minVal && m)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2015-10-26 21:55:42 +08:00
|
|
|
minVal = oneVal;
|
|
|
|
minLoc.x = j2;
|
|
|
|
minLoc.y = i2;
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneVal > maxVal && m)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2015-10-26 21:55:42 +08:00
|
|
|
maxVal = oneVal;
|
|
|
|
maxLoc.x = j2;
|
|
|
|
maxLoc.y = i2;
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
double minVal_, maxVal_;
|
|
|
|
cv::Point minLoc_, maxLoc_;
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::minMaxLoc(gsrc1_roi, &minVal_, &maxVal_, &minLoc_, &maxLoc_, gmask_roi);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2012-10-22 15:14:22 +08:00
|
|
|
double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.;
|
2013-09-24 18:13:10 +08:00
|
|
|
if (minLoc_.x == -1 || minLoc_.y == -1 || maxLoc_.x == -1 || maxLoc_.y == -1) continue;
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 0)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<unsigned char>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<unsigned char>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<unsigned char>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<unsigned char>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<unsigned char>(minLoc_) - src1_roi.at<unsigned char>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<unsigned char>(maxLoc_) - src1_roi.at<unsigned char>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 1)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<signed char>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<signed char>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<signed char>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<signed char>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<signed char>(minLoc_) - src1_roi.at<signed char>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<signed char>(maxLoc_) - src1_roi.at<signed char>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 2)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<unsigned short>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<unsigned short>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<unsigned short>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<unsigned short>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<unsigned short>(minLoc_) - src1_roi.at<unsigned short>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<unsigned short>(maxLoc_) - src1_roi.at<unsigned short>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 3)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<signed short>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<signed short>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<signed short>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<signed short>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<signed short>(minLoc_) - src1_roi.at<signed short>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<signed short>(maxLoc_) - src1_roi.at<signed short>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 4)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<int>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<int>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<int>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<int>(maxLoc_);
|
|
|
|
error0 = ::abs(src1_roi.at<int>(minLoc_) - src1_roi.at<int>(minLoc));
|
|
|
|
error1 = ::abs(src1_roi.at<int>(maxLoc_) - src1_roi.at<int>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 5)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<float>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<float>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<float>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<float>(maxLoc_);
|
2015-11-16 23:07:24 +08:00
|
|
|
error0 = std::abs(src1_roi.at<float>(minLoc_) - src1_roi.at<float>(minLoc));
|
|
|
|
error1 = std::abs(src1_roi.at<float>(maxLoc_) - src1_roi.at<float>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
2015-10-26 21:55:42 +08:00
|
|
|
if (oneDepth == 6)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
minlocVal = src1_roi.at<double>(minLoc);
|
|
|
|
minlocVal_ = src1_roi.at<double>(minLoc_);
|
|
|
|
maxlocVal = src1_roi.at<double>(maxLoc);
|
|
|
|
maxlocVal_ = src1_roi.at<double>(maxLoc_);
|
2015-11-16 23:07:24 +08:00
|
|
|
error0 = std::abs(src1_roi.at<double>(minLoc_) - src1_roi.at<double>(minLoc));
|
|
|
|
error1 = std::abs(src1_roi.at<double>(maxLoc_) - src1_roi.at<double>(maxLoc));
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
|
2013-05-08 15:12:12 +08:00
|
|
|
EXPECT_DOUBLE_EQ(minVal_, minVal);
|
|
|
|
EXPECT_DOUBLE_EQ(maxVal_, maxVal);
|
|
|
|
EXPECT_DOUBLE_EQ(minlocVal_, minlocVal);
|
|
|
|
EXPECT_DOUBLE_EQ(maxlocVal_, maxlocVal);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-05-08 15:12:12 +08:00
|
|
|
EXPECT_DOUBLE_EQ(error0, 0.0);
|
|
|
|
EXPECT_DOUBLE_EQ(error1, 0.0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Sum /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Sum;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Sum, MAT)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
2013-09-24 18:13:10 +08:00
|
|
|
|
|
|
|
Scalar cpures = cv::sum(src1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
Scalar gpures = cv::ocl::sum(gsrc1_roi);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-27 21:56:30 +08:00
|
|
|
// check results
|
|
|
|
EXPECT_NEAR(cpures[0], gpures[0], 0.1);
|
|
|
|
EXPECT_NEAR(cpures[1], gpures[1], 0.1);
|
|
|
|
EXPECT_NEAR(cpures[2], gpures[2], 0.1);
|
|
|
|
EXPECT_NEAR(cpures[3], gpures[3], 0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef ArithmTestBase SqrSum;
|
|
|
|
|
|
|
|
template <typename T, typename WT>
|
|
|
|
static Scalar sqrSum(const Mat & src)
|
|
|
|
{
|
|
|
|
Scalar sum = Scalar::all(0);
|
|
|
|
int cn = src.channels();
|
|
|
|
WT data[4] = { 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
int cols = src.cols * cn;
|
|
|
|
for (int y = 0; y < src.rows; ++y)
|
|
|
|
{
|
|
|
|
const T * const sdata = src.ptr<T>(y);
|
|
|
|
for (int x = 0; x < cols; )
|
|
|
|
for (int i = 0; i < cn; ++i, ++x)
|
|
|
|
{
|
|
|
|
WT t = static_cast<WT>(sdata[x]);
|
|
|
|
data[i] += t * t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < cn; ++i)
|
|
|
|
sum[i] = static_cast<double>(data[i]);
|
|
|
|
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef Scalar (*sumFunc)(const Mat &);
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(SqrSum, MAT)
|
2013-09-27 21:56:30 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
static sumFunc funcs[] = { sqrSum<uchar, int>,
|
|
|
|
sqrSum<char, int>,
|
|
|
|
sqrSum<ushort, int>,
|
|
|
|
sqrSum<short, int>,
|
|
|
|
sqrSum<int, int>,
|
|
|
|
sqrSum<float, double>,
|
|
|
|
sqrSum<double, double>,
|
|
|
|
0 };
|
|
|
|
|
|
|
|
sumFunc func = funcs[src1_roi.depth()];
|
|
|
|
CV_Assert(func != 0);
|
|
|
|
|
|
|
|
Scalar cpures = func(src1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
Scalar gpures = cv::ocl::sqrSum(gsrc1_roi);
|
2013-09-27 21:56:30 +08:00
|
|
|
|
|
|
|
// check results
|
|
|
|
EXPECT_NEAR(cpures[0], gpures[0], 1.0);
|
|
|
|
EXPECT_NEAR(cpures[1], gpures[1], 1.0);
|
|
|
|
EXPECT_NEAR(cpures[2], gpures[2], 1.0);
|
|
|
|
EXPECT_NEAR(cpures[3], gpures[3], 1.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef ArithmTestBase AbsSum;
|
|
|
|
|
|
|
|
template <typename T, typename WT>
|
|
|
|
static Scalar absSum(const Mat & src)
|
|
|
|
{
|
|
|
|
Scalar sum = Scalar::all(0);
|
|
|
|
int cn = src.channels();
|
|
|
|
WT data[4] = { 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
int cols = src.cols * cn;
|
|
|
|
for (int y = 0; y < src.rows; ++y)
|
|
|
|
{
|
|
|
|
const T * const sdata = src.ptr<T>(y);
|
|
|
|
for (int x = 0; x < cols; )
|
|
|
|
for (int i = 0; i < cn; ++i, ++x)
|
|
|
|
{
|
|
|
|
WT t = static_cast<WT>(sdata[x]);
|
|
|
|
data[i] += t >= 0 ? t : -t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < cn; ++i)
|
|
|
|
sum[i] = static_cast<double>(data[i]);
|
|
|
|
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(AbsSum, MAT)
|
2013-09-27 21:56:30 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
static sumFunc funcs[] = { absSum<uchar, int>,
|
|
|
|
absSum<char, int>,
|
|
|
|
absSum<ushort, int>,
|
|
|
|
absSum<short, int>,
|
|
|
|
absSum<int, int>,
|
|
|
|
absSum<float, double>,
|
|
|
|
absSum<double, double>,
|
|
|
|
0 };
|
|
|
|
|
|
|
|
sumFunc func = funcs[src1_roi.depth()];
|
|
|
|
CV_Assert(func != 0);
|
|
|
|
|
|
|
|
Scalar cpures = func(src1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
Scalar gpures = cv::ocl::absSum(gsrc1_roi);
|
2013-09-27 21:56:30 +08:00
|
|
|
|
|
|
|
// check results
|
2013-05-08 15:12:12 +08:00
|
|
|
EXPECT_NEAR(cpures[0], gpures[0], 0.1);
|
|
|
|
EXPECT_NEAR(cpures[1], gpures[1], 0.1);
|
|
|
|
EXPECT_NEAR(cpures[2], gpures[2], 0.1);
|
|
|
|
EXPECT_NEAR(cpures[3], gpures[3], 0.1);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// CountNonZero /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase CountNonZero;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(CountNonZero, MAT)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
2013-09-24 18:13:10 +08:00
|
|
|
int cpures = cv::countNonZero(src1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
int gpures = cv::ocl::countNonZero(gsrc1_roi);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2014-03-13 19:35:53 +08:00
|
|
|
EXPECT_EQ(cpures, gpures);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Phase /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Phase;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Phase, angleInDegrees)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-30 19:08:26 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-30 19:08:26 +08:00
|
|
|
random_roi();
|
|
|
|
cv::phase(src1_roi, src2_roi, dst1_roi, true);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::phase(gsrc1_roi, gsrc2_roi, gdst1_roi, true);
|
2013-09-30 19:08:26 +08:00
|
|
|
|
|
|
|
Near(1e-2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Phase, angleInRadians)
|
2013-09-30 19:08:26 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
cv::phase(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::phase(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-09-30 19:08:26 +08:00
|
|
|
|
|
|
|
Near(1e-2);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Bitwise_and /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Bitwise_and;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_and, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_and(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_and(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_and, Mat_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_and(src1_roi, src2_roi, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_and(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
2013-05-08 17:07:44 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_and, Scalar)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_and(src1_roi, val, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_and(gsrc1_roi, val, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_and, Scalar_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_and(src1_roi, val, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_and(gsrc1_roi, val, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Bitwise_or /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Bitwise_or;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_or, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_or(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_or(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_or, Mat_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_or(src1_roi, src2_roi, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_or(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
2013-05-08 17:07:44 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_or, Scalar)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_or(src1_roi, val, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_or(gsrc1_roi, val, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_or, Scalar_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_or(src1_roi, val, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_or(gsrc1_roi, val, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Bitwise_xor /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Bitwise_xor;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_xor, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_xor(src1_roi, src2_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_xor(gsrc1_roi, gsrc2_roi, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_xor, Mat_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_xor(src1_roi, src2_roi, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_xor(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
2013-05-08 17:07:44 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_xor, Scalar)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_xor(src1_roi, val, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_xor(gsrc1_roi, val, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_xor, Scalar_Mask)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_xor(src1_roi, val, dst1_roi, mask_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_xor(gsrc1_roi, val, gdst1_roi, gmask_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1e-5);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Bitwise_not /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Bitwise_not;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Bitwise_not, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::bitwise_not(src1_roi, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::bitwise_not(gsrc1_roi, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Compare /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Compare;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Compare, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
int cmp_codes[] = { CMP_EQ, CMP_GT, CMP_GE, CMP_LT, CMP_LE, CMP_NE };
|
2012-07-17 01:08:14 +08:00
|
|
|
int cmp_num = sizeof(cmp_codes) / sizeof(int);
|
|
|
|
|
|
|
|
for (int i = 0; i < cmp_num; ++i)
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::compare(src1_roi, src2_roi, dst1_roi, cmp_codes[i]);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::compare(gsrc1_roi, gsrc2_roi, gdst1_roi, cmp_codes[i]);
|
2013-09-24 18:13:10 +08:00
|
|
|
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(0);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// Pow /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase Pow;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Pow, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
double p = 4.5;
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::pow(src1_roi, p, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::pow(gsrc1_roi, p, gdst1_roi);
|
2013-05-08 17:07:44 +08:00
|
|
|
Near(1);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////// AddWeighted /////////////////////////////////////////////////
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
typedef ArithmTestBase AddWeighted;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(AddWeighted, Mat)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
2013-09-24 18:13:10 +08:00
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
2012-07-17 01:08:14 +08:00
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
const double alpha = 2.0, beta = 1.0, gama = 3.0;
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
cv::addWeighted(src1_roi, alpha, src2_roi, beta, gama, dst1_roi);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::addWeighted(gsrc1_roi, alpha, gsrc2_roi, beta, gama, gdst1_roi);
|
2012-07-17 01:08:14 +08:00
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
Near(3e-4);
|
2012-07-17 01:08:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-30 20:54:09 +08:00
|
|
|
//////////////////////////////// setIdentity /////////////////////////////////////////////////
|
|
|
|
|
|
|
|
typedef ArithmTestBase SetIdentity;
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(SetIdentity, Mat)
|
2013-09-30 20:54:09 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
cv::setIdentity(dst1_roi, val);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::setIdentity(gdst1_roi, val);
|
2013-09-30 20:54:09 +08:00
|
|
|
|
|
|
|
Near(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-30 22:58:32 +08:00
|
|
|
//////////////////////////////// meanStdDev /////////////////////////////////////////////////
|
2013-09-30 21:36:59 +08:00
|
|
|
|
|
|
|
typedef ArithmTestBase MeanStdDev;
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(MeanStdDev, Mat)
|
2013-09-30 21:36:59 +08:00
|
|
|
{
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
Scalar cpu_mean, cpu_stddev;
|
|
|
|
Scalar gpu_mean, gpu_stddev;
|
|
|
|
|
|
|
|
cv::meanStdDev(src1_roi, cpu_mean, cpu_stddev);
|
2013-10-03 00:18:48 +08:00
|
|
|
cv::ocl::meanStdDev(gsrc1_roi, gpu_mean, gpu_stddev);
|
2013-09-30 21:36:59 +08:00
|
|
|
|
|
|
|
for (int i = 0; i < 4; ++i)
|
|
|
|
{
|
2013-09-30 22:58:32 +08:00
|
|
|
EXPECT_NEAR(cpu_mean[i], gpu_mean[i], 0.1);
|
2013-09-30 21:36:59 +08:00
|
|
|
EXPECT_NEAR(cpu_stddev[i], gpu_stddev[i], 0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-30 22:58:32 +08:00
|
|
|
//////////////////////////////// Norm /////////////////////////////////////////////////
|
|
|
|
|
|
|
|
typedef ArithmTestBase Norm;
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Norm, NORM_INF)
|
2013-09-30 22:58:32 +08:00
|
|
|
{
|
|
|
|
for (int relative = 0; relative < 2; ++relative)
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
int type = NORM_INF;
|
|
|
|
if (relative == 1)
|
|
|
|
type |= NORM_RELATIVE;
|
|
|
|
|
|
|
|
const double cpuRes = cv::norm(src1_roi, src2_roi, type);
|
2013-10-03 00:18:48 +08:00
|
|
|
const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type);
|
2013-09-30 22:58:32 +08:00
|
|
|
|
|
|
|
EXPECT_NEAR(cpuRes, gpuRes, 0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Norm, NORM_L1)
|
2013-09-30 22:58:32 +08:00
|
|
|
{
|
|
|
|
for (int relative = 0; relative < 2; ++relative)
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
int type = NORM_L1;
|
|
|
|
if (relative == 1)
|
|
|
|
type |= NORM_RELATIVE;
|
|
|
|
|
|
|
|
const double cpuRes = cv::norm(src1_roi, src2_roi, type);
|
2013-10-03 00:18:48 +08:00
|
|
|
const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type);
|
2013-09-30 22:58:32 +08:00
|
|
|
|
2013-10-23 23:53:04 +08:00
|
|
|
EXPECT_PRED3(relativeError, cpuRes, gpuRes, 1e-6);
|
2013-09-30 22:58:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 22:05:09 +08:00
|
|
|
OCL_TEST_P(Norm, NORM_L2)
|
2013-09-30 22:58:32 +08:00
|
|
|
{
|
|
|
|
for (int relative = 0; relative < 2; ++relative)
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
int type = NORM_L2;
|
|
|
|
if (relative == 1)
|
|
|
|
type |= NORM_RELATIVE;
|
|
|
|
|
|
|
|
const double cpuRes = cv::norm(src1_roi, src2_roi, type);
|
2013-10-03 00:18:48 +08:00
|
|
|
const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type);
|
2013-09-30 22:58:32 +08:00
|
|
|
|
2013-10-23 23:53:04 +08:00
|
|
|
EXPECT_PRED3(relativeError, cpuRes, gpuRes, 1e-6);
|
2013-09-30 22:58:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-05 03:59:56 +08:00
|
|
|
//// Repeat
|
|
|
|
|
|
|
|
struct RepeatTestCase :
|
|
|
|
public ArithmTestBase
|
|
|
|
{
|
|
|
|
int nx, ny;
|
|
|
|
|
|
|
|
virtual void random_roi()
|
|
|
|
{
|
|
|
|
const int type = CV_MAKE_TYPE(depth, cn);
|
|
|
|
|
|
|
|
nx = randomInt(1, 4);
|
|
|
|
ny = randomInt(1, 4);
|
|
|
|
|
|
|
|
Size srcRoiSize = randomSize(1, MAX_VALUE);
|
|
|
|
Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(src1, src1_roi, srcRoiSize, srcBorder, type, 2, 11);
|
|
|
|
|
|
|
|
Size dstRoiSize(srcRoiSize.width * nx, srcRoiSize.height * ny);
|
|
|
|
Border dst1Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
|
|
|
randomSubMat(dst1, dst1_roi, dstRoiSize, dst1Border, type, 5, 16);
|
|
|
|
|
|
|
|
generateOclMat(gsrc1_whole, gsrc1_roi, src1, srcRoiSize, srcBorder);
|
|
|
|
generateOclMat(gdst1_whole, gdst1_roi, dst1, dstRoiSize, dst1Border);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef RepeatTestCase Repeat;
|
|
|
|
|
|
|
|
OCL_TEST_P(Repeat, Mat)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < LOOP_TIMES; ++i)
|
|
|
|
{
|
|
|
|
random_roi();
|
|
|
|
|
|
|
|
cv::repeat(src1_roi, ny, nx, dst1_roi);
|
|
|
|
cv::ocl::repeat(gsrc1_roi, ny, nx, gdst1_roi);
|
|
|
|
|
|
|
|
Near();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 18:13:10 +08:00
|
|
|
//////////////////////////////////////// Instantiation /////////////////////////////////////////
|
|
|
|
|
2013-10-19 05:17:46 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Lut, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool(), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Exp, Combine(testing::Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Log, Combine(testing::Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Add, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Sub, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Mul, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Div, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Min, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Max, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Abs, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Absdiff, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, CartToPolar, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, PolarToCart, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Magnitude, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Transpose, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Flip, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, MinMax, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(Channels(1)), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, MinMaxLoc, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(Channels(1)), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Sum, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, SqrSum, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, AbsSum, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, CountNonZero, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(Channels(1)), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Phase, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_and, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_or, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_xor, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_not, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Compare, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(Channels(1)), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Pow, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, AddWeighted, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, SetIdentity, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, MeanStdDev, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Norm, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
2013-11-05 03:59:56 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(Arithm, Repeat, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
|
2012-07-17 01:08:14 +08:00
|
|
|
|
|
|
|
#endif // HAVE_OPENCL
|