From 3c15913f5334a9bc82d8c789f156c80aa239201c Mon Sep 17 00:00:00 2001 From: Fangjun KUANG Date: Mon, 13 Mar 2017 12:46:50 +0100 Subject: [PATCH] Impove the documentation for Mat::diag --- modules/core/include/opencv2/core/mat.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/modules/core/include/opencv2/core/mat.hpp b/modules/core/include/opencv2/core/mat.hpp index 331835d..792f97b 100644 --- a/modules/core/include/opencv2/core/mat.hpp +++ b/modules/core/include/opencv2/core/mat.hpp @@ -1085,6 +1085,29 @@ public: immediately below the main one. - `d>0` is a diagonal from the upper half. For example, d=1 means the diagonal is set immediately above the main one. + For example: + @code + Mat m = (Mat_(3,3) << + 1,2,3, + 4,5,6, + 7,8,9); + Mat d0 = m.diag(0); + Mat d1 = m.diag(1); + Mat d_1 = m.diag(-1); + @endcode + The resulting matrices are + @code + d0 = + [1; + 5; + 9] + d1 = + [2; + 6] + d_1 = + [4; + 8] + @endcode */ Mat diag(int d=0) const; -- 2.7.4