fixed Mat::diag (#1939)

This commit is contained in:
Maria Dimashova 2012-05-18 14:38:54 +00:00
parent 80f1b1478d
commit 28297c0224

View File

@ -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;
}