mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.5 KiB
87 lines
2.5 KiB
13 years ago
|
#include "perf_precomp.hpp"
|
||
|
|
||
|
using namespace std;
|
||
|
using namespace cv;
|
||
|
using namespace perf;
|
||
13 years ago
|
using std::tr1::make_tuple;
|
||
|
using std::tr1::get;
|
||
13 years ago
|
|
||
|
typedef tr1::tuple<MatType, Size, Size> MatInfo_Size_Size_t;
|
||
|
typedef TestBaseWithParam<MatInfo_Size_Size_t> MatInfo_Size_Size;
|
||
|
|
||
|
PERF_TEST_P(MatInfo_Size_Size, resizeUpLinear,
|
||
13 years ago
|
testing::Values(
|
||
13 years ago
|
MatInfo_Size_Size_t(CV_8UC1, szVGA, szqHD),
|
||
|
MatInfo_Size_Size_t(CV_8UC1, szVGA, sz720p),
|
||
|
MatInfo_Size_Size_t(CV_8UC4, szVGA, sz720p)
|
||
|
)
|
||
13 years ago
|
)
|
||
13 years ago
|
{
|
||
13 years ago
|
int matType = get<0>(GetParam());
|
||
|
Size from = get<1>(GetParam());
|
||
|
Size to = get<2>(GetParam());
|
||
13 years ago
|
|
||
|
cv::Mat src(from, matType);
|
||
|
cv::Mat dst(to, matType);
|
||
|
|
||
|
declare.in(src, WARMUP_RNG).out(dst);
|
||
|
|
||
13 years ago
|
TEST_CYCLE() resize(src, dst, to);
|
||
13 years ago
|
|
||
13 years ago
|
SANITY_CHECK(dst, 1 + 1e-6);
|
||
13 years ago
|
}
|
||
|
|
||
|
PERF_TEST_P(MatInfo_Size_Size, resizeDownLinear,
|
||
13 years ago
|
testing::Values(
|
||
13 years ago
|
MatInfo_Size_Size_t(CV_8UC1, szVGA, szQVGA),
|
||
|
MatInfo_Size_Size_t(CV_8UC4, szqHD, szVGA),
|
||
|
MatInfo_Size_Size_t(CV_8UC1, sz720p, Size(120 * sz720p.width / sz720p.height, 120)),//face detection min_face_size = 20%
|
||
|
MatInfo_Size_Size_t(CV_8UC4, sz720p, szVGA),
|
||
|
MatInfo_Size_Size_t(CV_8UC4, sz720p, szQVGA)
|
||
|
)
|
||
13 years ago
|
)
|
||
13 years ago
|
{
|
||
13 years ago
|
int matType = get<0>(GetParam());
|
||
|
Size from = get<1>(GetParam());
|
||
|
Size to = get<2>(GetParam());
|
||
13 years ago
|
|
||
|
cv::Mat src(from, matType);
|
||
|
cv::Mat dst(to, matType);
|
||
|
|
||
|
declare.in(src, WARMUP_RNG).out(dst);
|
||
|
|
||
13 years ago
|
TEST_CYCLE() resize(src, dst, to);
|
||
13 years ago
|
|
||
13 years ago
|
SANITY_CHECK(dst, 1 + 1e-6);
|
||
13 years ago
|
}
|
||
|
|
||
13 years ago
|
|
||
|
typedef tr1::tuple<MatType, Size, int> MatInfo_Size_Scale_t;
|
||
|
typedef TestBaseWithParam<MatInfo_Size_Scale_t> MatInfo_Size_Scale;
|
||
|
|
||
13 years ago
|
PERF_TEST_P(MatInfo_Size_Scale, resizeAreaFast,
|
||
|
testing::Combine(
|
||
|
testing::Values(CV_8UC1, CV_8UC4),
|
||
|
testing::Values(szVGA, szqHD, sz720p, sz1080p),
|
||
|
testing::Values(2, 4)
|
||
|
)
|
||
|
)
|
||
13 years ago
|
{
|
||
13 years ago
|
int matType = get<0>(GetParam());
|
||
|
Size from = get<1>(GetParam());
|
||
|
int scale = get<2>(GetParam());
|
||
13 years ago
|
|
||
|
from.width = (from.width/scale)*scale;
|
||
|
from.height = (from.height/scale)*scale;
|
||
|
|
||
|
cv::Mat src(from, matType);
|
||
|
cv::Mat dst(from.height / scale, from.width / scale, matType);
|
||
|
|
||
|
declare.in(src, WARMUP_RNG).out(dst);
|
||
|
|
||
13 years ago
|
TEST_CYCLE() resize(src, dst, dst.size(), 0, 0, INTER_AREA);
|
||
13 years ago
|
|
||
|
//difference equal to 1 is allowed because of different possible rounding modes: round-to-nearest vs bankers' rounding
|
||
|
SANITY_CHECK(dst, 1);
|
||
|
}
|