mirror of
https://github.com/opencv/opencv.git
synced 2024-12-01 23:30:06 +08:00
dcaf923517
Conflicts: 3rdparty/ffmpeg/ffmpeg_version.cmake cmake/OpenCVFindLibsGrfmt.cmake cmake/templates/cvconfig.h.cmake modules/bioinspired/doc/retina/index.rst modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst modules/calib3d/src/precomp.hpp modules/contrib/src/inputoutput.cpp modules/contrib/src/precomp.hpp modules/core/include/opencv2/core/internal.hpp modules/core/include/opencv2/core/types_c.h modules/core/src/drawing.cpp modules/core/src/precomp.hpp modules/core/src/system.cpp modules/features2d/doc/common_interfaces_of_descriptor_matchers.rst modules/features2d/doc/common_interfaces_of_feature_detectors.rst modules/features2d/include/opencv2/features2d/features2d.hpp modules/features2d/src/precomp.hpp modules/flann/src/precomp.hpp modules/gpu/doc/camera_calibration_and_3d_reconstruction.rst modules/gpu/doc/image_filtering.rst modules/gpu/doc/image_processing.rst modules/gpu/doc/video.rst modules/gpu/perf/perf_imgproc.cpp modules/gpu/perf4au/main.cpp modules/gpu/src/imgproc.cpp modules/gpu/src/precomp.hpp modules/gpu/test/test_imgproc.cpp modules/highgui/CMakeLists.txt modules/highgui/test/test_precomp.hpp modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst modules/imgproc/src/precomp.hpp modules/java/generator/src/cpp/Mat.cpp modules/legacy/src/precomp.hpp modules/ml/doc/k_nearest_neighbors.rst modules/ml/src/precomp.hpp modules/nonfree/doc/feature_detection.rst modules/nonfree/src/precomp.hpp modules/objdetect/include/opencv2/objdetect/objdetect.hpp modules/objdetect/src/cascadedetect.cpp modules/objdetect/src/hog.cpp modules/objdetect/src/precomp.hpp modules/objdetect/test/test_latentsvmdetector.cpp modules/ocl/src/hog.cpp modules/ocl/src/opencl/objdetect_hog.cl modules/ocl/src/precomp.hpp modules/photo/src/precomp.hpp modules/stitching/src/precomp.hpp modules/superres/perf/perf_precomp.hpp modules/superres/src/optical_flow.cpp modules/superres/src/precomp.hpp modules/superres/test/test_precomp.hpp modules/ts/include/opencv2/ts.hpp modules/video/src/precomp.hpp modules/videostab/src/precomp.hpp modules/world/src/precomp.hpp
123 lines
3.6 KiB
C++
123 lines
3.6 KiB
C++
#include "perf_precomp.hpp"
|
|
|
|
using namespace std;
|
|
using namespace cv;
|
|
using namespace perf;
|
|
using std::tr1::make_tuple;
|
|
using std::tr1::get;
|
|
|
|
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,
|
|
testing::Values(
|
|
MatInfo_Size_Size_t(CV_8UC1, szVGA, szqHD),
|
|
MatInfo_Size_Size_t(CV_8UC1, szVGA, sz720p),
|
|
MatInfo_Size_Size_t(CV_8UC4, szVGA, sz720p)
|
|
)
|
|
)
|
|
{
|
|
int matType = get<0>(GetParam());
|
|
Size from = get<1>(GetParam());
|
|
Size to = get<2>(GetParam());
|
|
|
|
cv::Mat src(from, matType), dst(to, matType);
|
|
cvtest::fillGradient(src);
|
|
declare.in(src).out(dst);
|
|
|
|
TEST_CYCLE_MULTIRUN(10) resize(src, dst, to);
|
|
|
|
#ifdef ANDROID
|
|
SANITY_CHECK(dst, 5);
|
|
#else
|
|
SANITY_CHECK(dst, 1 + 1e-6);
|
|
#endif
|
|
}
|
|
|
|
PERF_TEST_P(MatInfo_Size_Size, resizeDownLinear,
|
|
testing::Values(
|
|
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)
|
|
)
|
|
)
|
|
{
|
|
int matType = get<0>(GetParam());
|
|
Size from = get<1>(GetParam());
|
|
Size to = get<2>(GetParam());
|
|
|
|
cv::Mat src(from, matType), dst(to, matType);
|
|
cvtest::fillGradient(src);
|
|
declare.in(src).out(dst);
|
|
|
|
TEST_CYCLE_MULTIRUN(10) resize(src, dst, to);
|
|
|
|
#ifdef ANDROID
|
|
SANITY_CHECK(dst, 5);
|
|
#else
|
|
SANITY_CHECK(dst, 1 + 1e-6);
|
|
#endif
|
|
}
|
|
|
|
|
|
typedef tr1::tuple<MatType, Size, int> MatInfo_Size_Scale_t;
|
|
typedef TestBaseWithParam<MatInfo_Size_Scale_t> MatInfo_Size_Scale;
|
|
|
|
PERF_TEST_P(MatInfo_Size_Scale, ResizeAreaFast,
|
|
testing::Combine(
|
|
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4),
|
|
testing::Values(szVGA, szqHD, sz720p, sz1080p),
|
|
testing::Values(2)
|
|
)
|
|
)
|
|
{
|
|
int matType = get<0>(GetParam());
|
|
Size from = get<1>(GetParam());
|
|
int scale = get<2>(GetParam());
|
|
|
|
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);
|
|
|
|
int runs = 15;
|
|
TEST_CYCLE_MULTIRUN(runs) resize(src, dst, dst.size(), 0, 0, INTER_AREA);
|
|
|
|
//difference equal to 1 is allowed because of different possible rounding modes: round-to-nearest vs bankers' rounding
|
|
SANITY_CHECK(dst, 1);
|
|
}
|
|
|
|
|
|
typedef TestBaseWithParam<tr1::tuple<MatType, Size, double> > MatInfo_Size_Scale_Area;
|
|
|
|
PERF_TEST_P(MatInfo_Size_Scale_Area, ResizeArea,
|
|
testing::Combine(
|
|
testing::Values(CV_8UC1, CV_8UC4),
|
|
testing::Values(szVGA, szqHD, sz720p),
|
|
testing::Values(2.4, 3.4, 1.3)
|
|
)
|
|
)
|
|
{
|
|
int matType = get<0>(GetParam());
|
|
Size from = get<1>(GetParam());
|
|
double scale = get<2>(GetParam());
|
|
|
|
cv::Mat src(from, matType);
|
|
|
|
Size to(cvRound(from.width * scale), cvRound(from.height * scale));
|
|
cv::Mat dst(to, matType);
|
|
|
|
declare.in(src, WARMUP_RNG).out(dst);
|
|
declare.time(100);
|
|
|
|
TEST_CYCLE() resize(src, dst, dst.size(), 0, 0, INTER_AREA);
|
|
|
|
//difference equal to 1 is allowed because of different possible rounding modes: round-to-nearest vs bankers' rounding
|
|
SANITY_CHECK(dst, 1);
|
|
}
|