Add support to print `cv::UMat`.
authorFangjun KUANG <csukuangfj@gmail.com>
Mon, 20 Feb 2017 15:22:46 +0000 (16:22 +0100)
committerGitHub <noreply@github.com>
Mon, 20 Feb 2017 15:22:46 +0000 (16:22 +0100)
Now a user can use `std::cout` to print an object of `cv::UMat` just like `cv::Mat`.

modules/core/include/opencv2/core/cvstd.inl.hpp

index 876def8..d08b72b 100644 (file)
@@ -183,6 +183,12 @@ std::ostream& operator << (std::ostream& out, const Mat& mtx)
     return out << Formatter::get()->format(mtx);
 }
 
+static inline
+std::ostream& operator << (std::ostream& out, const UMat& m)
+{
+    return out << m.getMat(ACCESS_READ);
+}
+
 template<typename _Tp> static inline
 std::ostream& operator << (std::ostream& out, const std::vector<Point_<_Tp> >& vec)
 {