Commit 6eb5a95a authored by Vadim Pisarevsky's avatar Vadim Pisarevsky Committed by OpenCV Buildbot

Merge pull request #871 from bitwangyaoyao:2.4_acry

parents fd83f2f5 e23884a2
/*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__
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
#include "opencv2/ocl/ocl.hpp" #include "opencv2/ocl/ocl.hpp"
#include "utility.hpp" #include "utility.hpp"
#include "interpolation.hpp"
//#include "add_test_info.h" //#include "add_test_info.h"
#endif #endif
......
This diff is collapsed.
/*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.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// @Authors
// Nathan, liujun@multicorewareinc.com
//
// 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 oclMaterials provided with the distribution.
//
// * 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*/
#include "precomp.hpp" #include "precomp.hpp"
#include <iomanip> #include <iomanip>
...@@ -33,20 +77,14 @@ void blendLinearGold(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &we ...@@ -33,20 +77,14 @@ void blendLinearGold(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &we
PARAM_TEST_CASE(Blend, cv::Size, MatType/*, UseRoi*/) PARAM_TEST_CASE(Blend, cv::Size, MatType/*, UseRoi*/)
{ {
//std::vector<cv::ocl::Info> oclinfo;
cv::Size size; cv::Size size;
int type; int type;
bool useRoi; bool useRoi;
virtual void SetUp() virtual void SetUp()
{ {
//devInfo = GET_PARAM(0);
size = GET_PARAM(0); size = GET_PARAM(0);
type = GET_PARAM(1); type = GET_PARAM(1);
/*useRoi = GET_PARAM(3);*/
//int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
} }
}; };
...@@ -59,12 +97,9 @@ TEST_P(Blend, Accuracy) ...@@ -59,12 +97,9 @@ TEST_P(Blend, Accuracy)
cv::Mat weights1 = randomMat(size, CV_32F, 0, 1); cv::Mat weights1 = randomMat(size, CV_32F, 0, 1);
cv::Mat weights2 = randomMat(size, CV_32F, 0, 1); cv::Mat weights2 = randomMat(size, CV_32F, 0, 1);
cv::ocl::oclMat gimg1(size, type), gimg2(size, type), gweights1(size, CV_32F), gweights2(size, CV_32F); cv::ocl::oclMat gimg1(img1), gimg2(img2), gweights1(weights1), gweights2(weights2);
cv::ocl::oclMat dst(size, type); cv::ocl::oclMat dst;
gimg1.upload(img1);
gimg2.upload(img2);
gweights1.upload(weights1);
gweights2.upload(weights2);
cv::ocl::blendLinear(gimg1, gimg2, gweights1, gweights2, dst); cv::ocl::blendLinear(gimg1, gimg2, gweights1, gweights2, dst);
cv::Mat result; cv::Mat result;
cv::Mat result_gold; cv::Mat result_gold;
...@@ -74,10 +109,10 @@ TEST_P(Blend, Accuracy) ...@@ -74,10 +109,10 @@ TEST_P(Blend, Accuracy)
else else
blendLinearGold<float>(img1, img2, weights1, weights2, result_gold); blendLinearGold<float>(img1, img2, weights1, weights2, result_gold);
EXPECT_MAT_NEAR(result_gold, result, CV_MAT_DEPTH(type) == CV_8U ? 1.f : 1e-5f, 0); EXPECT_MAT_NEAR(result_gold, result, CV_MAT_DEPTH(type) == CV_8U ? 1.f : 1e-5f);
} }
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Blend, Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, Blend, Combine(
DIFFERENT_SIZES, DIFFERENT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)) testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4))
)); ));
......
...@@ -7,12 +7,16 @@ ...@@ -7,12 +7,16 @@
// copy or use the software. // copy or use the software.
// //
// //
// Intel License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2010-2012, Multicoreware inc., all rights reserved. // Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// @Authors
// Nathan, liujun@multicorewareinc.com
//
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met: // are permitted provided that the following conditions are met:
// //
...@@ -21,12 +25,12 @@ ...@@ -21,12 +25,12 @@
// //
// * Redistribution's in binary form must reproduce the above copyright notice, // * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation // this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution. // and/or other oclMaterials provided with the distribution.
// //
// * The name of Intel Corporation may not be used to endorse or promote products // * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission. // derived from this software without specific prior written permission.
// //
// This software is provided by the copyright holders and contributors "as is" and // 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 // any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed. // 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, // In no event shall the Intel Corporation or contributors be liable for any direct,
......
...@@ -129,7 +129,7 @@ TEST_P(StereoMatchBP, Regression) ...@@ -129,7 +129,7 @@ TEST_P(StereoMatchBP, Regression)
bp(d_left, d_right, d_disp); bp(d_left, d_right, d_disp);
d_disp.download(disp); d_disp.download(disp);
disp.convertTo(disp, disp_gold.depth()); disp.convertTo(disp, disp_gold.depth());
EXPECT_MAT_NEAR(disp_gold, disp, 0.0, ""); EXPECT_MAT_NEAR(disp_gold, disp, 0.0);
} }
INSTANTIATE_TEST_CASE_P(OCL_Calib3D, StereoMatchBP, testing::Combine(testing::Values(64), INSTANTIATE_TEST_CASE_P(OCL_Calib3D, StereoMatchBP, testing::Combine(testing::Values(64),
testing::Values(8),testing::Values(2),testing::Values(25.0f), testing::Values(8),testing::Values(2),testing::Values(25.0f),
......
...@@ -100,7 +100,7 @@ PARAM_TEST_CASE(CvtColor, cv::Size, MatDepth) ...@@ -100,7 +100,7 @@ PARAM_TEST_CASE(CvtColor, cv::Size, MatDepth)
cv::cvtColor(src, dst_gold, CVTCODE(name));\ cv::cvtColor(src, dst_gold, CVTCODE(name));\
cv::Mat dst_mat;\ cv::Mat dst_mat;\
dst.download(dst_mat);\ dst.download(dst_mat);\
EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5, "");\ EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5);\
} }
//add new ones here using macro //add new ones here using macro
...@@ -141,7 +141,7 @@ TEST_P(CvtColor_Gray2RGB, Accuracy) ...@@ -141,7 +141,7 @@ TEST_P(CvtColor_Gray2RGB, Accuracy)
cv::cvtColor(src, dst_gold, code); cv::cvtColor(src, dst_gold, code);
cv::Mat dst_mat; cv::Mat dst_mat;
dst.download(dst_mat); dst.download(dst_mat);
EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5, ""); EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5);
} }
...@@ -171,7 +171,7 @@ TEST_P(CvtColor_YUV420, Accuracy) ...@@ -171,7 +171,7 @@ TEST_P(CvtColor_YUV420, Accuracy)
cv::Mat dst_mat; cv::Mat dst_mat;
dst.download(dst_mat); dst.download(dst_mat);
MAT_DIFF(dst_mat, dst_gold); MAT_DIFF(dst_mat, dst_gold);
EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5, ""); EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5);
} }
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor, testing::Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor, testing::Combine(
......
...@@ -47,27 +47,16 @@ ...@@ -47,27 +47,16 @@
#include "precomp.hpp" #include "precomp.hpp"
#include <iomanip> #include <iomanip>
///////////////////////////////////////////////////////////////////////////////
/// ColumnSum
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
//////////////////////////////////////////////////////////////////////// PARAM_TEST_CASE(ColumnSum, cv::Size)
// ColumnSum
PARAM_TEST_CASE(ColumnSum, cv::Size, bool )
{ {
cv::Size size; cv::Size size;
cv::Mat src; cv::Mat src;
bool useRoi;
//std::vector<cv::ocl::Info> oclinfo;
virtual void SetUp() virtual void SetUp()
{ {
size = GET_PARAM(0); size = GET_PARAM(0);
useRoi = GET_PARAM(1);
//int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
} }
}; };
...@@ -99,8 +88,7 @@ TEST_P(ColumnSum, Accuracy) ...@@ -99,8 +88,7 @@ TEST_P(ColumnSum, Accuracy)
} }
} }
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, ColumnSum, testing::Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, ColumnSum, DIFFERENT_SIZES);
DIFFERENT_SIZES, testing::Values(Inverse(false), Inverse(true))));
#endif #endif
...@@ -68,7 +68,7 @@ TEST_P(Dft, C2C) ...@@ -68,7 +68,7 @@ TEST_P(Dft, C2C)
cv::dft(a, b_gold, dft_flags); cv::dft(a, b_gold, dft_flags);
cv::ocl::dft(cv::ocl::oclMat(a), d_b, a.size(), dft_flags); cv::ocl::dft(cv::ocl::oclMat(a), d_b, a.size(), dft_flags);
EXPECT_MAT_NEAR(b_gold, cv::Mat(d_b), a.size().area() * 1e-4, ""); EXPECT_MAT_NEAR(b_gold, cv::Mat(d_b), a.size().area() * 1e-4);
} }
TEST_P(Dft, R2C) TEST_P(Dft, R2C)
...@@ -81,11 +81,11 @@ TEST_P(Dft, R2C) ...@@ -81,11 +81,11 @@ TEST_P(Dft, R2C)
cv::dft(a, b_gold, cv::DFT_COMPLEX_OUTPUT | dft_flags); cv::dft(a, b_gold, cv::DFT_COMPLEX_OUTPUT | dft_flags);
b_gold_roi = b_gold(cv::Rect(0, 0, d_b.cols, d_b.rows)); b_gold_roi = b_gold(cv::Rect(0, 0, d_b.cols, d_b.rows));
EXPECT_MAT_NEAR(b_gold_roi, cv::Mat(d_b), a.size().area() * 1e-4, ""); EXPECT_MAT_NEAR(b_gold_roi, cv::Mat(d_b), a.size().area() * 1e-4);
cv::Mat c_gold; cv::Mat c_gold;
cv::dft(b_gold, c_gold, cv::DFT_INVERSE | cv::DFT_REAL_OUTPUT | cv::DFT_SCALE); cv::dft(b_gold, c_gold, cv::DFT_INVERSE | cv::DFT_REAL_OUTPUT | cv::DFT_SCALE);
EXPECT_MAT_NEAR(b_gold_roi, cv::Mat(d_b), a.size().area() * 1e-4, ""); EXPECT_MAT_NEAR(b_gold_roi, cv::Mat(d_b), a.size().area() * 1e-4);
} }
TEST_P(Dft, R2CthenC2R) TEST_P(Dft, R2CthenC2R)
...@@ -95,7 +95,7 @@ TEST_P(Dft, R2CthenC2R) ...@@ -95,7 +95,7 @@ TEST_P(Dft, R2CthenC2R)
cv::ocl::oclMat d_b, d_c; cv::ocl::oclMat d_b, d_c;
cv::ocl::dft(cv::ocl::oclMat(a), d_b, a.size(), 0); cv::ocl::dft(cv::ocl::oclMat(a), d_b, a.size(), 0);
cv::ocl::dft(d_b, d_c, a.size(), cv::DFT_SCALE | cv::DFT_INVERSE | cv::DFT_REAL_OUTPUT); cv::ocl::dft(d_b, d_c, a.size(), cv::DFT_SCALE | cv::DFT_INVERSE | cv::DFT_REAL_OUTPUT);
EXPECT_MAT_NEAR(a, d_c, a.size().area() * 1e-4, ""); EXPECT_MAT_NEAR(a, d_c, a.size().area() * 1e-4);
} }
......
This diff is collapsed.
...@@ -53,13 +53,12 @@ PARAM_TEST_CASE(Gemm, int, cv::Size, int) ...@@ -53,13 +53,12 @@ PARAM_TEST_CASE(Gemm, int, cv::Size, int)
int type; int type;
cv::Size mat_size; cv::Size mat_size;
int flags; int flags;
//vector<cv::ocl::Info> info;
virtual void SetUp() virtual void SetUp()
{ {
type = GET_PARAM(0); type = GET_PARAM(0);
mat_size = GET_PARAM(1); mat_size = GET_PARAM(1);
flags = GET_PARAM(2); flags = GET_PARAM(2);
//cv::ocl::getDevice(info);
} }
}; };
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
// //
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved. // 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. // Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// @Authors // @Authors
......
...@@ -240,12 +240,11 @@ TEST_P(HOG, Detect) ...@@ -240,12 +240,11 @@ TEST_P(HOG, Detect)
} }
} }
char s[100] = {0}; EXPECT_MAT_NEAR(cv::Mat(d_comp), cv::Mat(comp), 3);
EXPECT_MAT_NEAR(cv::Mat(d_comp), cv::Mat(comp), 3, s);
} }
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, HOG, testing::Combine( INSTANTIATE_TEST_CASE_P(OCL_ObjDetect, HOG, testing::Combine(
testing::Values(cv::Size(64, 128), cv::Size(48, 96)), testing::Values(cv::Size(64, 128), cv::Size(48, 96)),
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)))); testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));
......
This diff is collapsed.
...@@ -62,7 +62,6 @@ PARAM_TEST_CASE(MatchTemplate8U, cv::Size, TemplateSize, Channels, TemplateMetho ...@@ -62,7 +62,6 @@ PARAM_TEST_CASE(MatchTemplate8U, cv::Size, TemplateSize, Channels, TemplateMetho
cv::Size templ_size; cv::Size templ_size;
int cn; int cn;
int method; int method;
//std::vector<cv::ocl::Info> oclinfo;
virtual void SetUp() virtual void SetUp()
{ {
...@@ -70,8 +69,6 @@ PARAM_TEST_CASE(MatchTemplate8U, cv::Size, TemplateSize, Channels, TemplateMetho ...@@ -70,8 +69,6 @@ PARAM_TEST_CASE(MatchTemplate8U, cv::Size, TemplateSize, Channels, TemplateMetho
templ_size = GET_PARAM(1); templ_size = GET_PARAM(1);
cn = GET_PARAM(2); cn = GET_PARAM(2);
method = GET_PARAM(3); method = GET_PARAM(3);
//int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
} }
}; };
...@@ -92,12 +89,10 @@ TEST_P(MatchTemplate8U, Accuracy) ...@@ -92,12 +89,10 @@ TEST_P(MatchTemplate8U, Accuracy)
cv::Mat dst_gold; cv::Mat dst_gold;
cv::matchTemplate(image, templ, dst_gold, method); cv::matchTemplate(image, templ, dst_gold, method);
char sss [100] = "";
cv::Mat mat_dst; cv::Mat mat_dst;
dst.download(mat_dst); dst.download(mat_dst);
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss); EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1);
} }
PARAM_TEST_CASE(MatchTemplate32F, cv::Size, TemplateSize, Channels, TemplateMethod) PARAM_TEST_CASE(MatchTemplate32F, cv::Size, TemplateSize, Channels, TemplateMethod)
...@@ -114,8 +109,6 @@ PARAM_TEST_CASE(MatchTemplate32F, cv::Size, TemplateSize, Channels, TemplateMeth ...@@ -114,8 +109,6 @@ PARAM_TEST_CASE(MatchTemplate32F, cv::Size, TemplateSize, Channels, TemplateMeth
templ_size = GET_PARAM(1); templ_size = GET_PARAM(1);
cn = GET_PARAM(2); cn = GET_PARAM(2);
method = GET_PARAM(3); method = GET_PARAM(3);
//int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
} }
}; };
...@@ -130,12 +123,10 @@ TEST_P(MatchTemplate32F, Accuracy) ...@@ -130,12 +123,10 @@ TEST_P(MatchTemplate32F, Accuracy)
cv::Mat dst_gold; cv::Mat dst_gold;
cv::matchTemplate(image, templ, dst_gold, method); cv::matchTemplate(image, templ, dst_gold, method);
char sss [100] = "";
cv::Mat mat_dst; cv::Mat mat_dst;
dst.download(mat_dst); dst.download(mat_dst);
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss); EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1);
} }
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, MatchTemplate8U, INSTANTIATE_TEST_CASE_P(OCL_ImgProc, MatchTemplate8U,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
// //
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved. // 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. // Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// @Authors // @Authors
...@@ -72,7 +73,7 @@ PARAM_TEST_CASE(ConvertToTestBase, MatType, MatType) ...@@ -72,7 +73,7 @@ PARAM_TEST_CASE(ConvertToTestBase, MatType, MatType)
//src mat with roi //src mat with roi
cv::Mat mat_roi; cv::Mat mat_roi;
cv::Mat dst_roi; cv::Mat dst_roi;
//std::vector<cv::ocl::Info> oclinfo;
//ocl dst mat for testing //ocl dst mat for testing
cv::ocl::oclMat gdst_whole; cv::ocl::oclMat gdst_whole;
...@@ -90,11 +91,6 @@ PARAM_TEST_CASE(ConvertToTestBase, MatType, MatType) ...@@ -90,11 +91,6 @@ PARAM_TEST_CASE(ConvertToTestBase, MatType, MatType)
mat = randomMat(rng, size, type, 5, 16, false); mat = randomMat(rng, size, type, 5, 16, false);
dst = randomMat(rng, size, type, 5, 16, false); dst = randomMat(rng, size, type, 5, 16, false);
//std::vector<cv::ocl::Info> oclinfo;
//int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
////if you want to use undefault device, set it here
////setDevice(oclinfo[0]);
} }
void random_roi() void random_roi()
...@@ -139,12 +135,7 @@ TEST_P(ConvertTo, Accuracy) ...@@ -139,12 +135,7 @@ TEST_P(ConvertTo, Accuracy)
mat_roi.convertTo(dst_roi, dst_type); mat_roi.convertTo(dst_roi, dst_type);
gmat.convertTo(gdst, dst_type); gmat.convertTo(gdst, dst_type);
cv::Mat cpu_dst; EXPECT_MAT_NEAR(dst, Mat(gdst_whole), 0.0);
gdst_whole.download(cpu_dst);
char sss[1024];
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,dstx=%d,dsty=%d", roicols, roirows, srcx , srcy, dstx, dsty);
EXPECT_MAT_NEAR(dst, cpu_dst, 0.0, sss);
} }
} }
...@@ -175,7 +166,7 @@ PARAM_TEST_CASE(CopyToTestBase, MatType, bool) ...@@ -175,7 +166,7 @@ PARAM_TEST_CASE(CopyToTestBase, MatType, bool)
cv::Mat mat_roi; cv::Mat mat_roi;
cv::Mat mask_roi; cv::Mat mask_roi;
cv::Mat dst_roi; cv::Mat dst_roi;
//std::vector<cv::ocl::Info> oclinfo;
//ocl dst mat for testing //ocl dst mat for testing
cv::ocl::oclMat gdst_whole; cv::ocl::oclMat gdst_whole;
...@@ -197,10 +188,6 @@ PARAM_TEST_CASE(CopyToTestBase, MatType, bool) ...@@ -197,10 +188,6 @@ PARAM_TEST_CASE(CopyToTestBase, MatType, bool)
cv::threshold(mask, mask, 0.5, 255., CV_8UC1); cv::threshold(mask, mask, 0.5, 255., CV_8UC1);
//int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
////if you want to use undefault device, set it here
////setDevice(oclinfo[0]);
} }
void random_roi() void random_roi()
...@@ -250,12 +237,7 @@ TEST_P(CopyTo, Without_mask) ...@@ -250,12 +237,7 @@ TEST_P(CopyTo, Without_mask)
mat_roi.copyTo(dst_roi); mat_roi.copyTo(dst_roi);
gmat.copyTo(gdst); gmat.copyTo(gdst);
cv::Mat cpu_dst; EXPECT_MAT_NEAR(dst, Mat(gdst_whole), 0.0);
gdst_whole.download(cpu_dst);
char sss[1024];
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,dstx=%d,dsty=%d,maskx=%d,masky=%d", roicols, roirows, srcx , srcy, dstx, dsty, maskx, masky);
EXPECT_MAT_NEAR(dst, cpu_dst, 0.0, sss);
} }
} }
...@@ -268,12 +250,7 @@ TEST_P(CopyTo, With_mask) ...@@ -268,12 +250,7 @@ TEST_P(CopyTo, With_mask)
mat_roi.copyTo(dst_roi, mask_roi); mat_roi.copyTo(dst_roi, mask_roi);
gmat.copyTo(gdst, gmask); gmat.copyTo(gdst, gmask);
cv::Mat cpu_dst; EXPECT_MAT_NEAR(dst, Mat(gdst_whole), 0.0);
gdst_whole.download(cpu_dst);
char sss[1024];
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,dstx=%d,dsty=%d,maskx=%d,masky=%d", roicols, roirows, srcx , srcy, dstx, dsty, maskx, masky);
EXPECT_MAT_NEAR(dst, cpu_dst, 0.0, sss);
} }
} }
...@@ -301,7 +278,7 @@ PARAM_TEST_CASE(SetToTestBase, MatType, bool) ...@@ -301,7 +278,7 @@ PARAM_TEST_CASE(SetToTestBase, MatType, bool)
//src mat with roi //src mat with roi
cv::Mat mat_roi; cv::Mat mat_roi;
cv::Mat mask_roi; cv::Mat mask_roi;
//std::vector<cv::ocl::Info> oclinfo;
//ocl dst mat for testing //ocl dst mat for testing
cv::ocl::oclMat gmat_whole; cv::ocl::oclMat gmat_whole;
...@@ -322,10 +299,6 @@ PARAM_TEST_CASE(SetToTestBase, MatType, bool) ...@@ -322,10 +299,6 @@ PARAM_TEST_CASE(SetToTestBase, MatType, bool)
cv::threshold(mask, mask, 0.5, 255., CV_8UC1); cv::threshold(mask, mask, 0.5, 255., CV_8UC1);
val = cv::Scalar(rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0)); val = cv::Scalar(rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0));
//int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
////if you want to use undefault device, set it here
////setDevice(oclinfo[0]);
} }
void random_roi() void random_roi()
...@@ -369,12 +342,7 @@ TEST_P(SetTo, Without_mask) ...@@ -369,12 +342,7 @@ TEST_P(SetTo, Without_mask)
mat_roi.setTo(val); mat_roi.setTo(val);
gmat.setTo(val); gmat.setTo(val);
cv::Mat cpu_dst; EXPECT_MAT_NEAR(mat, Mat(gmat_whole), 1.);
gmat_whole.download(cpu_dst);
char sss[1024];
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,maskx=%d,masky=%d", roicols, roirows, srcx , srcy, maskx, masky);
EXPECT_MAT_NEAR(mat, cpu_dst, 1., sss);
} }
} }
...@@ -387,12 +355,7 @@ TEST_P(SetTo, With_mask) ...@@ -387,12 +355,7 @@ TEST_P(SetTo, With_mask)
mat_roi.setTo(val, mask_roi); mat_roi.setTo(val, mask_roi);
gmat.setTo(val, gmask); gmat.setTo(val, gmask);
cv::Mat cpu_dst; EXPECT_MAT_NEAR(mat, Mat(gmat_whole), 1.);
gmat_whole.download(cpu_dst);
char sss[1024];
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,maskx=%d,masky=%d", roicols, roirows, srcx , srcy, maskx, masky);
EXPECT_MAT_NEAR(mat, cpu_dst, 1., sss);
} }
} }
...@@ -417,7 +380,7 @@ PARAM_TEST_CASE(convertC3C4, MatType, cv::Size) ...@@ -417,7 +380,7 @@ PARAM_TEST_CASE(convertC3C4, MatType, cv::Size)
//src mat with roi //src mat with roi
cv::Mat mat1_roi; cv::Mat mat1_roi;
cv::Mat dst_roi; cv::Mat dst_roi;
//std::vector<cv::ocl::Info> oclinfo;
//ocl dst mat for testing //ocl dst mat for testing
cv::ocl::oclMat gdst_whole; cv::ocl::oclMat gdst_whole;
...@@ -430,13 +393,6 @@ PARAM_TEST_CASE(convertC3C4, MatType, cv::Size) ...@@ -430,13 +393,6 @@ PARAM_TEST_CASE(convertC3C4, MatType, cv::Size)
type = GET_PARAM(0); type = GET_PARAM(0);
ksize = GET_PARAM(1); ksize = GET_PARAM(1);
//dst = randomMat(rng, size, type, 5, 16, false);
//int devnums = getDevice(oclinfo);
//CV_Assert(devnums > 0);
////if you want to use undefault device, set it here
////setDevice(oclinfo[1]);
} }
void random_roi() void random_roi()
...@@ -483,11 +439,8 @@ TEST_P(convertC3C4, Accuracy) ...@@ -483,11 +439,8 @@ TEST_P(convertC3C4, Accuracy)
mat1 = randomMat(rng, size, type, 0, 40, false); mat1 = randomMat(rng, size, type, 0, 40, false);
gmat1 = mat1; gmat1 = mat1;
cv::Mat cpu_dst;
gmat1.download(cpu_dst); EXPECT_MAT_NEAR(mat1, Mat(gmat1), 0.0);
char sss[1024];
sprintf(sss, "cols=%d,rows=%d", mat1.cols, mat1.rows);
EXPECT_MAT_NEAR(mat1, cpu_dst, 0.0, sss);
} }
} }
......
...@@ -10,7 +10,7 @@ using namespace cvtest; ...@@ -10,7 +10,7 @@ using namespace cvtest;
using namespace testing; using namespace testing;
using namespace std; using namespace std;
extern string workdir; extern string workdir;
PARAM_TEST_CASE(MomentsTestBase, MatType, bool) PARAM_TEST_CASE(MomentsTest, MatType, bool)
{ {
int type; int type;
cv::Mat mat1; cv::Mat mat1;
...@@ -30,13 +30,13 @@ PARAM_TEST_CASE(MomentsTestBase, MatType, bool) ...@@ -30,13 +30,13 @@ PARAM_TEST_CASE(MomentsTestBase, MatType, bool)
Mat gpu_dst, cpu_dst; Mat gpu_dst, cpu_dst;
HuMoments(cpu, cpu_dst); HuMoments(cpu, cpu_dst);
HuMoments(gpu, gpu_dst); HuMoments(gpu, gpu_dst);
EXPECT_MAT_NEAR(gpu_dst,cpu_dst, .5, ""); EXPECT_MAT_NEAR(gpu_dst,cpu_dst, .5);
} }
}; };
struct ocl_Moments : MomentsTestBase {};
TEST_P(ocl_Moments, Mat)
TEST_P(MomentsTest, Mat)
{ {
bool binaryImage = 0; bool binaryImage = 0;
SetUp(); SetUp();
...@@ -67,6 +67,6 @@ TEST_P(ocl_Moments, Mat) ...@@ -67,6 +67,6 @@ TEST_P(ocl_Moments, Mat)
} }
} }
INSTANTIATE_TEST_CASE_P(Moments, ocl_Moments, Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, MomentsTest, Combine(
Values(CV_8UC1, CV_16UC1, CV_16SC1, CV_64FC1), Values(true,false))); Values(CV_8UC1, CV_16UC1, CV_16SC1, CV_64FC1), Values(true,false)));
#endif // HAVE_OPENCL #endif // HAVE_OPENCL
...@@ -65,15 +65,6 @@ PARAM_TEST_CASE(PyrDown, MatType, int) ...@@ -65,15 +65,6 @@ PARAM_TEST_CASE(PyrDown, MatType, int)
{ {
type = GET_PARAM(0); type = GET_PARAM(0);
channels = GET_PARAM(1); channels = GET_PARAM(1);
//int devnums = getDevice(oclinfo);
//CV_Assert(devnums > 0);
////if you want to use undefault device, set it here
////setDevice(oclinfo[0]);
}
void Cleanup()
{
} }
}; };
...@@ -92,17 +83,11 @@ TEST_P(PyrDown, Mat) ...@@ -92,17 +83,11 @@ TEST_P(PyrDown, Mat)
cv::pyrDown(src, dst_cpu); cv::pyrDown(src, dst_cpu);
cv::ocl::pyrDown(gsrc, gdst); cv::ocl::pyrDown(gsrc, gdst);
cv::Mat dst; EXPECT_MAT_NEAR(dst_cpu, Mat(gdst), type == CV_32F ? 1e-4f : 1.0f);
gdst.download(dst);
char s[1024] = {0};
EXPECT_MAT_NEAR(dst, dst_cpu, dst.depth() == CV_32F ? 1e-4f : 1.0f, s);
Cleanup();
} }
} }
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, PyrDown, Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, PyrDown, Combine(
Values(CV_8U, CV_32F), Values(1, 3, 4))); Values(CV_8U, CV_32F), Values(1, 3, 4)));
......
...@@ -50,19 +50,7 @@ using namespace cvtest; ...@@ -50,19 +50,7 @@ using namespace cvtest;
using namespace testing; using namespace testing;
using namespace std; using namespace std;
//#define DUMP
/////////////////////////////////////////////////////////////////////////////////////////////////
// BroxOpticalFlow
extern string workdir; extern string workdir;
#define BROX_OPTICAL_FLOW_DUMP_FILE "opticalflow/brox_optical_flow.bin"
#define BROX_OPTICAL_FLOW_DUMP_FILE_CC20 "opticalflow/brox_optical_flow_cc20.bin"
/////////////////////////////////////////////////////////////////////////////////////////////////
// PyrLKOpticalFlow
//IMPLEMENT_PARAM_CLASS(UseGray, bool)
PARAM_TEST_CASE(Sparse, bool, bool) PARAM_TEST_CASE(Sparse, bool, bool)
{ {
......
...@@ -58,12 +58,9 @@ PARAM_TEST_CASE(PyrUp, MatType, int) ...@@ -58,12 +58,9 @@ PARAM_TEST_CASE(PyrUp, MatType, int)
{ {
int type; int type;
int channels; int channels;
//std::vector<cv::ocl::Info> oclinfo;
virtual void SetUp() virtual void SetUp()
{ {
//int devnums = cv::ocl::getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
type = GET_PARAM(0); type = GET_PARAM(0);
channels = GET_PARAM(1); channels = GET_PARAM(1);
} }
...@@ -80,17 +77,14 @@ TEST_P(PyrUp, Accuracy) ...@@ -80,17 +77,14 @@ TEST_P(PyrUp, Accuracy)
ocl::oclMat dst; ocl::oclMat dst;
ocl::oclMat srcMat(src); ocl::oclMat srcMat(src);
ocl::pyrUp(srcMat, dst); ocl::pyrUp(srcMat, dst);
Mat cpu_dst;
dst.download(cpu_dst);
char s[100] = {0};
EXPECT_MAT_NEAR(dst_gold, cpu_dst, (src.depth() == CV_32F ? 1e-4f : 1.0), s); EXPECT_MAT_NEAR(dst_gold, Mat(dst), (type == CV_32F ? 1e-4f : 1.0));
} }
} }
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, PyrUp, testing::Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, PyrUp, testing::Combine(
Values(CV_8U, CV_32F), Values(1, 3, 4))); Values(CV_8U, CV_32F), Values(1, 3, 4)));
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
// //
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved. // 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. // Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// @Authors // @Authors
...@@ -87,7 +88,7 @@ PARAM_TEST_CASE(MergeTestBase, MatType, int) ...@@ -87,7 +88,7 @@ PARAM_TEST_CASE(MergeTestBase, MatType, int)
//dst mat with roi //dst mat with roi
cv::Mat dst_roi; cv::Mat dst_roi;
//std::vector<cv::ocl::Info> oclinfo;
//ocl dst mat for testing //ocl dst mat for testing
cv::ocl::oclMat gdst_whole; cv::ocl::oclMat gdst_whole;
...@@ -112,10 +113,6 @@ PARAM_TEST_CASE(MergeTestBase, MatType, int) ...@@ -112,10 +113,6 @@ PARAM_TEST_CASE(MergeTestBase, MatType, int)
mat4 = randomMat(rng, size, CV_MAKETYPE(type, 1), 5, 16, false); mat4 = randomMat(rng, size, CV_MAKETYPE(type, 1), 5, 16, false);
dst = randomMat(rng, size, CV_MAKETYPE(type, channels), 5, 16, false); dst = randomMat(rng, size, CV_MAKETYPE(type, channels), 5, 16, false);
//int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
////if you want to use undefault device, set it here
////setDevice(oclinfo[0]);
} }
void random_roi() void random_roi()
...@@ -205,12 +202,7 @@ TEST_P(Merge, Accuracy) ...@@ -205,12 +202,7 @@ TEST_P(Merge, Accuracy)
cv::merge(dev_src, dst_roi); cv::merge(dev_src, dst_roi);
cv::ocl::merge(dev_gsrc, gdst); cv::ocl::merge(dev_gsrc, gdst);
cv::Mat cpu_dst; EXPECT_MAT_NEAR(dst, Mat(gdst_whole), 0.0);
gdst_whole.download(cpu_dst);
char sss[1024];
sprintf(sss, "roicols=%d,roirows=%d,src1x =%d,src1y=%d,src2x =%d,src2y=%d,src3x =%d,src3y=%d,src4x =%d,src4y=%d,dstx=%d,dsty=%d", roicols, roirows, src1x, src1y, src2x , src2y, src3x , src3y, src4x , src4y, dstx, dsty);
EXPECT_MAT_NEAR(dst, cpu_dst, 0.0, sss);
} }
} }
...@@ -252,7 +244,7 @@ PARAM_TEST_CASE(SplitTestBase, MatType, int) ...@@ -252,7 +244,7 @@ PARAM_TEST_CASE(SplitTestBase, MatType, int)
cv::Mat dst2_roi; cv::Mat dst2_roi;
cv::Mat dst3_roi; cv::Mat dst3_roi;
cv::Mat dst4_roi; cv::Mat dst4_roi;
//std::vector<cv::ocl::Info> oclinfo;
//ocl dst mat for testing //ocl dst mat for testing
cv::ocl::oclMat gdst1_whole; cv::ocl::oclMat gdst1_whole;
cv::ocl::oclMat gdst2_whole; cv::ocl::oclMat gdst2_whole;
...@@ -280,10 +272,6 @@ PARAM_TEST_CASE(SplitTestBase, MatType, int) ...@@ -280,10 +272,6 @@ PARAM_TEST_CASE(SplitTestBase, MatType, int)
dst3 = randomMat(rng, size, CV_MAKETYPE(type, 1), 5, 16, false); dst3 = randomMat(rng, size, CV_MAKETYPE(type, 1), 5, 16, false);
dst4 = randomMat(rng, size, CV_MAKETYPE(type, 1), 5, 16, false); dst4 = randomMat(rng, size, CV_MAKETYPE(type, 1), 5, 16, false);
//int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE);
//CV_Assert(devnums > 0);
////if you want to use undefault device, set it here
////setDevice(oclinfo[0]);
} }
void random_roi() void random_roi()
...@@ -356,28 +344,17 @@ TEST_P(Split, Accuracy) ...@@ -356,28 +344,17 @@ TEST_P(Split, Accuracy)
cv::split(mat_roi, dev_dst); cv::split(mat_roi, dev_dst);
cv::ocl::split(gmat, dev_gdst); cv::ocl::split(gmat, dev_gdst);
cv::Mat cpu_dst1;
cv::Mat cpu_dst2;
cv::Mat cpu_dst3;
cv::Mat cpu_dst4;
gdst1_whole.download(cpu_dst1);
gdst2_whole.download(cpu_dst2);
gdst3_whole.download(cpu_dst3);
gdst4_whole.download(cpu_dst4);
char sss[1024];
sprintf(sss, "roicols=%d,roirows=%d,dst1x =%d,dsty=%d,dst2x =%d,dst2y=%d,dst3x =%d,dst3y=%d,dst4x =%d,dst4y=%d,srcx=%d,srcy=%d", roicols, roirows, dst1x , dst1y, dst2x , dst2y, dst3x , dst3y, dst4x , dst4y, srcx, srcy);
if(channels >= 1) if(channels >= 1)
EXPECT_MAT_NEAR(dst1, cpu_dst1, 0.0, sss); EXPECT_MAT_NEAR(dst1, Mat(gdst1_whole), 0.0);
if(channels >= 2) if(channels >= 2)
EXPECT_MAT_NEAR(dst2, cpu_dst2, 0.0, sss); EXPECT_MAT_NEAR(dst2, Mat(gdst2_whole), 0.0);
if(channels >= 3) if(channels >= 3)
EXPECT_MAT_NEAR(dst3, cpu_dst3, 0.0, sss); EXPECT_MAT_NEAR(dst3, Mat(gdst3_whole), 0.0);
if(channels >= 4) if(channels >= 4)
EXPECT_MAT_NEAR(dst4, cpu_dst4, 0.0, sss); EXPECT_MAT_NEAR(dst4, Mat(gdst4_whole), 0.0);
} }
} }
......
...@@ -76,20 +76,20 @@ double checkSimilarity(const cv::Mat &m1, const cv::Mat &m2); ...@@ -76,20 +76,20 @@ double checkSimilarity(const cv::Mat &m1, const cv::Mat &m2);
EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \ EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \
} }
/*#define EXPECT_MAT_NEAR(mat1, mat2, eps) \ #define EXPECT_MAT_NEAR(mat1, mat2, eps) \
{ \ { \
ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.size(), mat2.size()); \ ASSERT_EQ(mat1.size(), mat2.size()); \
EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \ EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \
}*/ }
/*
#define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \ #define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \
{ \ { \
ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.size(), mat2.size()); \ ASSERT_EQ(mat1.size(), mat2.size()); \
EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps)<<s; \ EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps)<<s; \
} }
*/
#define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \ #define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \
{ \ { \
ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.type(), mat2.type()); \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment