Commit 28297c02 authored by Maria Dimashova's avatar Maria Dimashova

fixed Mat::diag (#1939)

parent 80f1b147
......@@ -322,7 +322,10 @@ inline Mat Mat::diag(const Mat& d)
CV_Assert( d.cols == 1 || d.rows == 1 );
int len = d.rows + d.cols - 1;
Mat m(len, len, d.type(), Scalar(0)), md = m.diag();
d.copyTo(md);
if( d.cols == 1 )
d.copyTo(md);
else
transpose(d, md);
return m;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment