2012-03-15 22:36:01 +08:00
|
|
|
#include "perf_precomp.hpp"
|
|
|
|
|
2017-11-05 21:48:40 +08:00
|
|
|
namespace opencv_test
|
|
|
|
{
|
2012-03-15 22:36:01 +08:00
|
|
|
|
|
|
|
CV_ENUM(InpaintingMethod, INPAINT_NS, INPAINT_TELEA)
|
2017-11-05 21:48:40 +08:00
|
|
|
typedef tuple<Size, InpaintingMethod> InpaintArea_InpaintingMethod_t;
|
2012-03-15 22:36:01 +08:00
|
|
|
typedef perf::TestBaseWithParam<InpaintArea_InpaintingMethod_t> InpaintArea_InpaintingMethod;
|
2024-03-02 18:43:58 +08:00
|
|
|
typedef perf::TestBaseWithParam<InpaintingMethod> Perf_InpaintingMethod;
|
2012-03-15 22:36:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
PERF_TEST_P(InpaintArea_InpaintingMethod, inpaint,
|
|
|
|
testing::Combine(
|
2013-01-16 15:57:24 +08:00
|
|
|
testing::Values(::perf::szSmall24, ::perf::szSmall32, ::perf::szSmall64),
|
2013-04-15 23:39:49 +08:00
|
|
|
InpaintingMethod::all()
|
2012-03-15 22:36:01 +08:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2012-11-28 18:13:24 +08:00
|
|
|
declare.in(src, mask).out(result).time(120);
|
2012-03-15 22:36:01 +08:00
|
|
|
|
|
|
|
TEST_CYCLE() inpaint(src, mask, result, 10.0, inpaintingMethod);
|
|
|
|
|
|
|
|
Mat inpaintedArea = result(inpaintArea);
|
|
|
|
SANITY_CHECK(inpaintedArea);
|
|
|
|
}
|
2017-11-05 21:48:40 +08:00
|
|
|
|
2024-03-02 18:43:58 +08:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2017-11-05 21:48:40 +08:00
|
|
|
} // namespace
|