mirror of
https://github.com/opencv/opencv.git
synced 2025-06-27 15:01:50 +08:00
Extended set of existing performance test to OpenVX HAL suitable execution modes
This commit is contained in:
parent
41d55c5095
commit
2492c299f3
26
modules/core/perf/perf_lut.cpp
Normal file
26
modules/core/perf/perf_lut.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace perf;
|
||||
|
||||
typedef perf::TestBaseWithParam<Size> SizePrm;
|
||||
|
||||
PERF_TEST_P( SizePrm, LUT,
|
||||
testing::Values(szQVGA, szVGA, sz1080p)
|
||||
)
|
||||
{
|
||||
Size sz = GetParam();
|
||||
|
||||
int maxValue = 255;
|
||||
|
||||
Mat src(sz, CV_8UC1);
|
||||
randu(src, 0, maxValue);
|
||||
Mat lut(1, 256, CV_8UC1);
|
||||
randu(lut, 0, maxValue);
|
||||
Mat dst(sz, CV_8UC1);
|
||||
|
||||
TEST_CYCLE() LUT(src, lut, dst);
|
||||
|
||||
SANITY_CHECK(dst, 0.1);
|
||||
}
|
@ -38,3 +38,26 @@ PERF_TEST_P(fast, detect, testing::Combine(
|
||||
|
||||
SANITY_CHECK_KEYPOINTS(points);
|
||||
}
|
||||
|
||||
PERF_TEST_P(fast, detect_ovx, testing::Combine(
|
||||
testing::Values(FAST_IMAGES),
|
||||
FastType::all()
|
||||
))
|
||||
{
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
int type = get<1>(GetParam());
|
||||
Mat frame = imread(filename, IMREAD_GRAYSCALE);
|
||||
|
||||
if (frame.empty())
|
||||
FAIL() << "Unable to load source image " << filename;
|
||||
|
||||
declare.in(frame);
|
||||
|
||||
Ptr<FeatureDetector> fd = FastFeatureDetector::create(20, false, type);
|
||||
ASSERT_FALSE(fd.empty());
|
||||
vector<KeyPoint> points;
|
||||
|
||||
TEST_CYCLE() fd->detect(frame, points);
|
||||
|
||||
SANITY_CHECK_KEYPOINTS(points);
|
||||
}
|
||||
|
96
modules/imgproc/perf/perf_accumulate.cpp
Normal file
96
modules/imgproc/perf/perf_accumulate.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace perf;
|
||||
using std::tr1::get;
|
||||
|
||||
#ifdef HAVE_OPENVX
|
||||
PERF_TEST_P(Size_MatType, Accumulate,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szQVGA, ::perf::szVGA, ::perf::sz1080p),
|
||||
testing::Values(CV_16SC1, CV_32FC1)
|
||||
)
|
||||
)
|
||||
#else
|
||||
PERF_TEST_P( Size_MatType, Accumulate,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szQVGA, ::perf::szVGA, ::perf::sz1080p),
|
||||
testing::Values(CV_32FC1)
|
||||
)
|
||||
)
|
||||
#endif
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int dstType = get<1>(GetParam());
|
||||
|
||||
Mat src(sz, CV_8UC1);
|
||||
Mat dst(sz, dstType);
|
||||
|
||||
declare.time(100);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() accumulate(src, dst);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENVX
|
||||
PERF_TEST_P(Size_MatType, AccumulateSquare,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szQVGA, ::perf::szVGA, ::perf::sz1080p),
|
||||
testing::Values(CV_16SC1, CV_32FC1)
|
||||
)
|
||||
)
|
||||
#else
|
||||
PERF_TEST_P( Size_MatType, AccumulateSquare,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szQVGA, ::perf::szVGA, ::perf::sz1080p),
|
||||
testing::Values(CV_32FC1)
|
||||
)
|
||||
)
|
||||
#endif
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int dstType = get<1>(GetParam());
|
||||
|
||||
Mat src(sz, CV_8UC1);
|
||||
Mat dst(sz, dstType);
|
||||
|
||||
declare.time(100);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() accumulateSquare(src, dst);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENVX
|
||||
PERF_TEST_P(Size_MatType, AccumulateWeighted,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szQVGA, ::perf::szVGA, ::perf::sz1080p),
|
||||
testing::Values(CV_8UC1, CV_32FC1)
|
||||
)
|
||||
)
|
||||
#else
|
||||
PERF_TEST_P( Size_MatType, AccumulateWeighted,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szQVGA, ::perf::szVGA, ::perf::sz1080p),
|
||||
testing::Values(CV_32FC1)
|
||||
)
|
||||
)
|
||||
#endif
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int dstType = get<1>(GetParam());
|
||||
|
||||
Mat src(sz, CV_8UC1);
|
||||
Mat dst(sz, dstType);
|
||||
|
||||
declare.time(100);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() accumulateWeighted(src, dst, 0.314);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
@ -42,6 +42,33 @@ PERF_TEST_P( TestFilter2d, Filter2d,
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
PERF_TEST_P(TestFilter2d, Filter2d_ovx,
|
||||
Combine(
|
||||
Values(Size(320, 240), sz1080p),
|
||||
Values(3, 5),
|
||||
Values(BORDER_CONSTANT, BORDER_REPLICATE)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz;
|
||||
int borderMode, kSize;
|
||||
sz = get<0>(GetParam());
|
||||
kSize = get<1>(GetParam());
|
||||
borderMode = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, CV_8UC1);
|
||||
Mat dst(sz, CV_16SC1);
|
||||
|
||||
Mat kernel(kSize, kSize, CV_16SC1);
|
||||
randu(kernel, -3, 10);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst).time(20);
|
||||
|
||||
TEST_CYCLE() filter2D(src, dst, CV_16SC1, kernel, Point(kSize / 2, kSize / 2), 0., borderMode);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
PERF_TEST_P( Image_KernelSize, GaborFilter2d,
|
||||
Combine(
|
||||
Values("stitching/a1.png", "cv/shared/pic5.png"),
|
||||
|
@ -27,6 +27,27 @@ PERF_TEST_P(Size_MatType, pyrDown, testing::Combine(
|
||||
SANITY_CHECK(dst, eps, error_type);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType, pyrDown_ovx, testing::Combine(
|
||||
testing::Values(sz1080p, sz720p, szVGA, szQVGA, szODD),
|
||||
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16SC1, CV_16SC3, CV_16SC4, CV_32FC1, CV_32FC3, CV_32FC4)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int matType = get<1>(GetParam());
|
||||
const double eps = CV_MAT_DEPTH(matType) <= CV_32S ? 1 : 1e-5;
|
||||
perf::ERROR_TYPE error_type = CV_MAT_DEPTH(matType) <= CV_32S ? ERROR_ABSOLUTE : ERROR_RELATIVE;
|
||||
|
||||
Mat src(sz, matType);
|
||||
Mat dst((sz.height + 1) / 2, (sz.width + 1) / 2, matType);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() pyrDown(src, dst, cv::Size(), BORDER_REPLICATE);
|
||||
|
||||
SANITY_CHECK(dst, eps, error_type);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType, pyrUp, testing::Combine(
|
||||
testing::Values(sz720p, szVGA, szQVGA, szODD),
|
||||
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16SC1, CV_16SC3, CV_16SC4, CV_32FC1, CV_32FC3, CV_32FC4)
|
||||
|
@ -50,6 +50,36 @@ PERF_TEST_P( TestWarpAffine, WarpAffine,
|
||||
#endif
|
||||
}
|
||||
|
||||
PERF_TEST_P(TestWarpAffine, WarpAffine_ovx,
|
||||
Combine(
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
InterType::all(),
|
||||
BorderMode::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz, szSrc(512, 512);
|
||||
int borderMode, interType;
|
||||
sz = get<0>(GetParam());
|
||||
interType = get<1>(GetParam());
|
||||
borderMode = get<2>(GetParam());
|
||||
Scalar borderColor = Scalar::all(150);
|
||||
|
||||
Mat src(szSrc, CV_8UC1), dst(sz, CV_8UC1);
|
||||
cvtest::fillGradient(src);
|
||||
if (borderMode == BORDER_CONSTANT) cvtest::smoothBorder(src, borderColor, 1);
|
||||
Mat warpMat = getRotationMatrix2D(Point2f(src.cols / 2.f, src.rows / 2.f), 30., 2.2);
|
||||
declare.in(src).out(dst);
|
||||
|
||||
TEST_CYCLE() warpAffine(src, dst, warpMat, sz, interType, borderMode, borderColor);
|
||||
|
||||
#ifdef ANDROID
|
||||
SANITY_CHECK(dst, interType == INTER_LINEAR ? 5 : 10);
|
||||
#else
|
||||
SANITY_CHECK(dst, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
PERF_TEST_P( TestWarpPerspective, WarpPerspective,
|
||||
Combine(
|
||||
Values( szVGA, sz720p, sz1080p ),
|
||||
@ -88,6 +118,44 @@ PERF_TEST_P( TestWarpPerspective, WarpPerspective,
|
||||
#endif
|
||||
}
|
||||
|
||||
PERF_TEST_P(TestWarpPerspective, WarpPerspective_ovx,
|
||||
Combine(
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
InterType::all(),
|
||||
BorderMode::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz, szSrc(512, 512);
|
||||
int borderMode, interType;
|
||||
sz = get<0>(GetParam());
|
||||
interType = get<1>(GetParam());
|
||||
borderMode = get<2>(GetParam());
|
||||
Scalar borderColor = Scalar::all(150);
|
||||
|
||||
Mat src(szSrc, CV_8UC1), dst(sz, CV_8UC1);
|
||||
cvtest::fillGradient(src);
|
||||
if (borderMode == BORDER_CONSTANT) cvtest::smoothBorder(src, borderColor, 1);
|
||||
Mat rotMat = getRotationMatrix2D(Point2f(src.cols / 2.f, src.rows / 2.f), 30., 2.2);
|
||||
Mat warpMat(3, 3, CV_64FC1);
|
||||
for (int r = 0; r<2; r++)
|
||||
for (int c = 0; c<3; c++)
|
||||
warpMat.at<double>(r, c) = rotMat.at<double>(r, c);
|
||||
warpMat.at<double>(2, 0) = .3 / sz.width;
|
||||
warpMat.at<double>(2, 1) = .3 / sz.height;
|
||||
warpMat.at<double>(2, 2) = 1;
|
||||
|
||||
declare.in(src).out(dst);
|
||||
|
||||
TEST_CYCLE() warpPerspective(src, dst, warpMat, sz, interType, borderMode, borderColor);
|
||||
|
||||
#ifdef ANDROID
|
||||
SANITY_CHECK(dst, interType == INTER_LINEAR ? 5 : 10);
|
||||
#else
|
||||
SANITY_CHECK(dst, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear,
|
||||
Combine(
|
||||
Values( Size(640,480), Size(1920,1080), Size(2592,1944) ),
|
||||
|
@ -97,6 +97,58 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize, OpticalFlowPyrLK_full, testing::Combine(
|
||||
SANITY_CHECK(err, 2);
|
||||
}
|
||||
|
||||
typedef tr1::tuple<std::string, int, tr1::tuple<int, int>, int> Path_Idx_NPoints_WSize_t;
|
||||
typedef TestBaseWithParam<Path_Idx_NPoints_WSize_t> Path_Idx_NPoints_WSize;
|
||||
|
||||
PERF_TEST_P(Path_Idx_NPoints_WSize, OpticalFlowPyrLK_ovx, testing::Combine(
|
||||
testing::Values<std::string>("cv/optflow/frames/VGA_%02d.png", "cv/optflow/frames/720p_%02d.png"),
|
||||
testing::Range(1, 3),
|
||||
testing::Values(make_tuple(9, 9), make_tuple(15, 15)),
|
||||
testing::Values(7, 11)
|
||||
)
|
||||
)
|
||||
{
|
||||
string filename1 = getDataPath(cv::format(get<0>(GetParam()).c_str(), get<1>(GetParam())));
|
||||
string filename2 = getDataPath(cv::format(get<0>(GetParam()).c_str(), get<1>(GetParam()) + 1));
|
||||
Mat img1 = imread(filename1);
|
||||
Mat img2 = imread(filename2);
|
||||
if (img1.empty()) FAIL() << "Unable to load source image " << filename1;
|
||||
if (img2.empty()) FAIL() << "Unable to load source image " << filename2;
|
||||
|
||||
int nPointsX = min(get<0>(get<2>(GetParam())), img1.cols);
|
||||
int nPointsY = min(get<1>(get<2>(GetParam())), img1.rows);
|
||||
int winSize = get<3>(GetParam());
|
||||
|
||||
int maxLevel = 2;
|
||||
TermCriteria criteria(TermCriteria::COUNT|TermCriteria::EPS, 7, 0.001);
|
||||
int flags = 0;
|
||||
double minEigThreshold = 1e-4;
|
||||
|
||||
Mat frame1, frame2;
|
||||
cvtColor(img1, frame1, COLOR_BGR2GRAY, 1);
|
||||
cvtColor(img2, frame2, COLOR_BGR2GRAY, 1);
|
||||
|
||||
vector<Point2f> inPoints;
|
||||
vector<Point2f> outPoints;
|
||||
vector<uchar> status;
|
||||
|
||||
FormTrackingPointsArray(inPoints, frame1.cols, frame1.rows, nPointsX, nPointsY);
|
||||
outPoints.resize(inPoints.size());
|
||||
status.resize(inPoints.size());
|
||||
|
||||
declare.in(frame1, frame2, inPoints).out(outPoints);
|
||||
|
||||
TEST_CYCLE_N(30)
|
||||
{
|
||||
calcOpticalFlowPyrLK(frame1, frame2, inPoints, outPoints, status, cv::noArray(),
|
||||
Size(winSize, winSize), maxLevel, criteria,
|
||||
flags, minEigThreshold);
|
||||
}
|
||||
|
||||
SANITY_CHECK(outPoints, 0.3);
|
||||
SANITY_CHECK(status);
|
||||
}
|
||||
|
||||
typedef tr1::tuple<std::string, int, int, tr1::tuple<int,int>, int, bool> Path_Idx_Cn_NPoints_WSize_Deriv_t;
|
||||
typedef TestBaseWithParam<Path_Idx_Cn_NPoints_WSize_Deriv_t> Path_Idx_Cn_NPoints_WSize_Deriv;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user