File size: 1,719 Bytes
dffe123 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #include "perf_precomp.hpp"
namespace opencv_test
{
CV_ENUM(InpaintingMethod, INPAINT_NS, INPAINT_TELEA)
typedef tuple<Size, InpaintingMethod> InpaintArea_InpaintingMethod_t;
typedef perf::TestBaseWithParam<InpaintArea_InpaintingMethod_t> InpaintArea_InpaintingMethod;
typedef perf::TestBaseWithParam<InpaintingMethod> Perf_InpaintingMethod;
PERF_TEST_P(InpaintArea_InpaintingMethod, inpaint,
testing::Combine(
testing::Values(::perf::szSmall24, ::perf::szSmall32, ::perf::szSmall64),
InpaintingMethod::all()
)
)
{
Mat src = imread(getDataPath("gpu/hog/road.png"));
Size sz = get<0>(GetParam());
int inpaintingMethod = get<1>(GetParam());
Mat mask(src.size(), CV_8UC1, Scalar(0));
Mat result(src.size(), src.type());
Rect inpaintArea(src.cols/3, src.rows/3, sz.width, sz.height);
mask(inpaintArea).setTo(255);
declare.in(src, mask).out(result).time(120);
TEST_CYCLE() inpaint(src, mask, result, 10.0, inpaintingMethod);
Mat inpaintedArea = result(inpaintArea);
SANITY_CHECK(inpaintedArea);
}
PERF_TEST_P(Perf_InpaintingMethod, inpaintDots, InpaintingMethod::all())
{
Mat src = imread(getDataPath("gpu/hog/road.png"));
int inpaintingMethod = GetParam();
Mat mask(src.size(), CV_8UC1, Scalar(0));
Mat result(src.size(), src.type());
for (int i = 0; i < src.size().height; i += 16) {
for (int j = 0; j < src.size().width; j += 16) {
mask.at<unsigned char>(i, j) = 255;
}
}
declare.in(src, mask).out(result).time(120);
TEST_CYCLE() inpaint(src, mask, result, 10.0, inpaintingMethod);
SANITY_CHECK_NOTHING();
}
} // namespace
|