Merge pull request #8208 from csukuangfj:complex_support
authorFangjun KUANG <csukuangfj@gmail.com>
Wed, 15 Feb 2017 18:50:14 +0000 (19:50 +0100)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Wed, 15 Feb 2017 18:50:14 +0000 (21:50 +0300)
Add support for printing out cv::Complex. (#8208)

* Add support for printing out cv::Complex.

* Conform to the format of std::complex.

* Remove extra spaces.

* Remove extra spaces.

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

index 876def8..55e35fe 100644 (file)
@@ -184,6 +184,12 @@ std::ostream& operator << (std::ostream& out, const Mat& mtx)
 }
 
 template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const Complex<_Tp>& c)
+{
+    return out << "(" << c.re << "," << c.im << ")";
+}
+
+template<typename _Tp> static inline
 std::ostream& operator << (std::ostream& out, const std::vector<Point_<_Tp> >& vec)
 {
     return out << Formatter::get()->format(Mat(vec));