Skip to content

Commit 73e9c44

Browse files
committed
Merge pull request opencv#8370 from csukuangfj:patch-7
2 parents 661f3e2 + 3c15913 commit 73e9c44

File tree

1 file changed

+23
-0
lines changed
  • modules/core/include/opencv2/core

1 file changed

+23
-0
lines changed

modules/core/include/opencv2/core/mat.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,29 @@ class CV_EXPORTS Mat
10851085
immediately below the main one.
10861086
- `d>0` is a diagonal from the upper half. For example, d=1 means the diagonal is set
10871087
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+
@code
1100+
d0 =
1101+
[1;
1102+
5;
1103+
9]
1104+
d1 =
1105+
[2;
1106+
6]
1107+
d_1 =
1108+
[4;
1109+
8]
1110+
@endcode
10881111
*/
10891112
Mat diag(int d=0) const;
10901113

0 commit comments

Comments
 (0)