We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 661f3e2 + 3c15913 commit 73e9c44Copy full SHA for 73e9c44
modules/core/include/opencv2/core/mat.hpp
@@ -1085,6 +1085,29 @@ class CV_EXPORTS Mat
1085
immediately below the main one.
1086
- `d>0` is a diagonal from the upper half. For example, d=1 means the diagonal is set
1087
immediately above the main one.
1088
+ For example:
1089
+ @code
1090
+ Mat m = (Mat_<int>(3,3) <<
1091
+ 1,2,3,
1092
+ 4,5,6,
1093
+ 7,8,9);
1094
+ Mat d0 = m.diag(0);
1095
+ Mat d1 = m.diag(1);
1096
+ Mat d_1 = m.diag(-1);
1097
+ @endcode
1098
+ The resulting matrices are
1099
1100
+ d0 =
1101
+ [1;
1102
+ 5;
1103
+ 9]
1104
+ d1 =
1105
+ [2;
1106
+ 6]
1107
+ d_1 =
1108
+ [4;
1109
+ 8]
1110
1111
*/
1112
Mat diag(int d=0) const;
1113
0 commit comments