added size check to static Mat::diag()

This commit is contained in:
Vadim Pisarevsky 2011-08-10 12:40:41 +00:00
parent 25261e6ebc
commit 645bb0bfbc

View File

@ -338,6 +338,7 @@ inline Mat Mat::colRange(const Range& r) const
inline Mat Mat::diag(const Mat& d)
{
CV_Assert( d.cols == 1 );
Mat m(d.rows, d.rows, d.type(), Scalar(0)), md = m.diag();
d.copyTo(md);
return m;