1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-28 23:03:03 +04:00

add usageFlags to UMat static factories

- add abi compatible overloads
- add test case
This commit is contained in:
Dale Phurrough
2021-06-22 05:32:54 +02:00
parent 438e2dc228
commit 8be86cbdfd
4 changed files with 54 additions and 27 deletions
+14 -14
View File
@@ -951,11 +951,11 @@ UMat UMat::reshape(int new_cn, int new_rows) const
return hdr;
}
UMat UMat::diag(const UMat& d)
UMat UMat::diag(const UMat& d, UMatUsageFlags usageFlags)
{
CV_Assert( d.cols == 1 || d.rows == 1 );
int len = d.rows + d.cols - 1;
UMat m(len, len, d.type(), Scalar(0));
UMat m(len, len, d.type(), Scalar(0), usageFlags);
UMat md = m.diag();
if( d.cols == 1 )
d.copyTo(md);
@@ -1323,34 +1323,34 @@ UMat UMat::t() const
return m;
}
UMat UMat::zeros(int rows, int cols, int type)
UMat UMat::zeros(int rows, int cols, int type, UMatUsageFlags usageFlags)
{
return UMat(rows, cols, type, Scalar::all(0));
return UMat(rows, cols, type, Scalar::all(0), usageFlags);
}
UMat UMat::zeros(Size size, int type)
UMat UMat::zeros(Size size, int type, UMatUsageFlags usageFlags)
{
return UMat(size, type, Scalar::all(0));
return UMat(size, type, Scalar::all(0), usageFlags);
}
UMat UMat::zeros(int ndims, const int* sz, int type)
UMat UMat::zeros(int ndims, const int* sz, int type, UMatUsageFlags usageFlags)
{
return UMat(ndims, sz, type, Scalar::all(0));
return UMat(ndims, sz, type, Scalar::all(0), usageFlags);
}
UMat UMat::ones(int rows, int cols, int type)
UMat UMat::ones(int rows, int cols, int type, UMatUsageFlags usageFlags)
{
return UMat::ones(Size(cols, rows), type);
return UMat(rows, cols, type, Scalar(1), usageFlags);
}
UMat UMat::ones(Size size, int type)
UMat UMat::ones(Size size, int type, UMatUsageFlags usageFlags)
{
return UMat(size, type, Scalar(1));
return UMat(size, type, Scalar(1), usageFlags);
}
UMat UMat::ones(int ndims, const int* sz, int type)
UMat UMat::ones(int ndims, const int* sz, int type, UMatUsageFlags usageFlags)
{
return UMat(ndims, sz, type, Scalar(1));
return UMat(ndims, sz, type, Scalar(1), usageFlags);
}
}