performance and bug fix for addWeighted cartToPolar div exp log resize setTo
add channel 3 support add fast way Between CPU and GPU for the data which is aligned
This commit is contained in:
@@ -396,6 +396,101 @@ TEST_P(SetTo, With_mask)
|
||||
}
|
||||
}
|
||||
|
||||
//convertC3C4
|
||||
PARAM_TEST_CASE(convertC3C4, MatType, cv::Size)
|
||||
{
|
||||
int type;
|
||||
cv::Size ksize;
|
||||
|
||||
//src mat
|
||||
cv::Mat mat1;
|
||||
cv::Mat dst;
|
||||
|
||||
// set up roi
|
||||
int roicols;
|
||||
int roirows;
|
||||
int src1x;
|
||||
int src1y;
|
||||
int dstx;
|
||||
int dsty;
|
||||
|
||||
//src mat with roi
|
||||
cv::Mat mat1_roi;
|
||||
cv::Mat dst_roi;
|
||||
std::vector<cv::ocl::Info> oclinfo;
|
||||
//ocl dst mat for testing
|
||||
cv::ocl::oclMat gdst_whole;
|
||||
|
||||
//ocl mat with roi
|
||||
cv::ocl::oclMat gmat1;
|
||||
cv::ocl::oclMat gdst;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
type = GET_PARAM(0);
|
||||
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()
|
||||
{
|
||||
#ifdef RANDOMROI
|
||||
//randomize ROI
|
||||
cv::RNG &rng = TS::ptr()->get_rng();
|
||||
roicols = rng.uniform(2, mat1.cols);
|
||||
roirows = rng.uniform(2, mat1.rows);
|
||||
src1x = rng.uniform(0, mat1.cols - roicols);
|
||||
src1y = rng.uniform(0, mat1.rows - roirows);
|
||||
dstx = rng.uniform(0, dst.cols - roicols);
|
||||
dsty = rng.uniform(0, dst.rows - roirows);
|
||||
#else
|
||||
roicols = mat1.cols;
|
||||
roirows = mat1.rows;
|
||||
src1x = 0;
|
||||
src1y = 0;
|
||||
dstx = 0;
|
||||
dsty = 0;
|
||||
#endif
|
||||
|
||||
mat1_roi = mat1(Rect(src1x, src1y, roicols, roirows));
|
||||
dst_roi = dst(Rect(dstx, dsty, roicols, roirows));
|
||||
|
||||
gdst_whole = dst;
|
||||
gdst = gdst_whole(Rect(dstx, dsty, roicols, roirows));
|
||||
|
||||
|
||||
gmat1 = mat1_roi;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
TEST_P(convertC3C4, Accuracy)
|
||||
{
|
||||
cv::RNG &rng = TS::ptr()->get_rng();
|
||||
for(int j = 0; j < LOOP_TIMES; j++)
|
||||
{
|
||||
//random_roi();
|
||||
int width = rng.uniform(2, MWIDTH);
|
||||
int height = rng.uniform(2, MHEIGHT);
|
||||
cv::Size size(width, height);
|
||||
|
||||
mat1 = randomMat(rng, size, type, 0, 40, false);
|
||||
gmat1 = mat1;
|
||||
cv::Mat cpu_dst;
|
||||
gmat1.download(cpu_dst);
|
||||
char sss[1024];
|
||||
sprintf(sss, "cols=%d,rows=%d", mat1.cols, mat1.rows);
|
||||
EXPECT_MAT_NEAR(mat1, cpu_dst, 0.0, sss);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MatrixOperation, ConvertTo, Combine(
|
||||
Values(CV_8UC1, CV_8UC4, CV_32SC1, CV_32SC4, CV_32FC1, CV_32FC4),
|
||||
@@ -408,5 +503,8 @@ INSTANTIATE_TEST_CASE_P(MatrixOperation, CopyTo, Combine(
|
||||
INSTANTIATE_TEST_CASE_P(MatrixOperation, SetTo, Combine(
|
||||
Values(CV_8UC1, CV_8UC4, CV_32SC1, CV_32SC4, CV_32FC1, CV_32FC4),
|
||||
Values(false))); // Values(false) is the reserved parameter
|
||||
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MatrixOperation, convertC3C4, Combine(
|
||||
Values(CV_8UC3, CV_32SC3, CV_32FC3),
|
||||
Values(cv::Size())));
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user