From e5ffbf949814ef1810367878d6d3b367be5fe701 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Fri, 9 Nov 2012 07:53:31 +0400 Subject: [PATCH] Fix stream output operator for Vec This fixes output for 8U and 8S vector depths. They were mistakenly printed as characters instead of numbers. --- .../core/include/opencv2/core/operations.hpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index 4b6e60616..847daf8c2 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -3873,10 +3873,21 @@ template inline std::ostream& operator<<(std::ostream& out, const template inline std::ostream& operator<<(std::ostream& out, const Vec<_Tp, n>& vec) { out << "["; - for (int i = 0; i < n - 1; ++i) { - out << vec[i] << ", "; + + if(Vec<_Tp, n>::depth < CV_32F) + { + for (int i = 0; i < n - 1; ++i) { + out << (int)vec[i] << ", "; + } + out << (int)vec[n-1] << "]"; + } + else + { + for (int i = 0; i < n - 1; ++i) { + out << vec[i] << ", "; + } + out << vec[n-1] << "]"; } - out << vec[n-1] << "]"; return out; }