inpaint perf test added
authorKirill Kornyakov <no@email>
Thu, 20 Oct 2011 11:00:29 +0000 (11:00 +0000)
committerKirill Kornyakov <no@email>
Thu, 20 Oct 2011 11:00:29 +0000 (11:00 +0000)
modules/imgproc/perf/perf_inpaint.cpp [new file with mode: 0644]

diff --git a/modules/imgproc/perf/perf_inpaint.cpp b/modules/imgproc/perf/perf_inpaint.cpp
new file mode 100644 (file)
index 0000000..ebab577
--- /dev/null
@@ -0,0 +1,48 @@
+#include "perf_precomp.hpp"\r
+\r
+#include <opencv2/highgui/highgui.hpp>\r
+\r
+using namespace std;\r
+using namespace cv;\r
+using namespace perf;\r
+\r
+CV_ENUM(InpaintingMethod, INPAINT_NS, INPAINT_TELEA)\r
+\r
+typedef std::tr1::tuple<Size, InpaintingMethod> InpaintArea_InpaintingMethod_t;\r
+typedef perf::TestBaseWithParam<InpaintArea_InpaintingMethod_t> InpaintArea_InpaintingMethod;\r
+\r
+\r
+/*\r
+//! restores the damaged image areas using one of the available intpainting algorithms\r
+CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask,\r
+                           OutputArray dst, double inpaintRange, int flags );\r
+*/\r
+PERF_TEST_P( InpaintArea_InpaintingMethod, inpaint,\r
+             testing::Combine(\r
+                 SZ_ALL_SMALL,\r
+                 testing::Values( (int)INPAINT_NS, (int)INPAINT_TELEA ))\r
+           )\r
+{\r
+    Mat src = imread( getDataPath("gpu/hog/road.png") );\r
+\r
+    Size sz = std::tr1::get<0>(GetParam());\r
+    int inpaintingMethod = std::tr1::get<1>(GetParam());\r
+\r
+    Mat mask(src.size(), CV_8UC1, Scalar(0));\r
+\r
+    Rect inpaintArea(src.cols/3, src.rows/3, sz.width, sz.height);\r
+    mask(inpaintArea).setTo(255);\r
+\r
+    declare.time(30);\r
+\r
+    Mat result;\r
+    TEST_CYCLE(100)\r
+    {\r
+        inpaint(src, mask, result, 10.0, inpaintingMethod);\r
+\r
+        //rectangle(result, inpaintArea, Scalar(255));\r
+        //char buf[256];\r
+        //sprintf(buf, "frame_%d_%d.jpg", sz.width, inpaintingMethod);\r
+        //imwrite(buf, result);\r
+    }\r
+}\r