From 133d889e33905c79d44fdc7035904674d24d0cda Mon Sep 17 00:00:00 2001
From: Alexander Alekhin <alexander.alekhin@itseez.com>
Date: Thu, 24 Oct 2013 01:29:39 +0400
Subject: [PATCH] ocl: show diff

---
 modules/ocl/test/utility.cpp | 17 +++++++++++++++++
 modules/ocl/test/utility.hpp |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/modules/ocl/test/utility.cpp b/modules/ocl/test/utility.cpp
index dea14a910..43dbac68c 100644
--- a/modules/ocl/test/utility.cpp
+++ b/modules/ocl/test/utility.cpp
@@ -231,4 +231,21 @@ double checkRectSimilarity(Size sz, std::vector<Rect>& ob1, std::vector<Rect>& o
     return final_test_result;
 }
 
+void showDiff(const Mat& gold, const Mat& actual, double eps)
+{
+    Mat diff;
+    absdiff(gold, actual, diff);
+    threshold(diff, diff, eps, 255.0, cv::THRESH_BINARY);
+
+    namedWindow("gold", WINDOW_NORMAL);
+    namedWindow("actual", WINDOW_NORMAL);
+    namedWindow("diff", WINDOW_NORMAL);
+
+    imshow("gold", gold);
+    imshow("actual", actual);
+    imshow("diff", diff);
+
+    waitKey();
+}
+
 } // namespace cvtest
diff --git a/modules/ocl/test/utility.hpp b/modules/ocl/test/utility.hpp
index 2ec7001ac..5ad97b08a 100644
--- a/modules/ocl/test/utility.hpp
+++ b/modules/ocl/test/utility.hpp
@@ -52,7 +52,7 @@ extern int LOOP_TIMES;
 
 namespace cvtest {
 
-//void showDiff(cv::InputArray gold, cv::InputArray actual, double eps);
+void showDiff(const Mat& gold, const Mat& actual, double eps);
 
 cv::ocl::oclMat createMat_ocl(cv::RNG& rng, Size size, int type, bool useRoi);
 cv::ocl::oclMat loadMat_ocl(cv::RNG& rng, const Mat& m, bool useRoi);