added cv::repeat to T-API

This commit is contained in:
Ilya Lavrenov 2013-12-19 14:27:21 +04:00
parent 2431c72d1d
commit b3af0e3154

View File

@ -544,15 +544,36 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
} }
static bool ocl_repeat(InputArray _src, int ny, int nx, OutputArray _dst)
{
UMat src = _src.getUMat(), dst = _dst.getUMat();
for (int y = 0; y < ny; ++y)
for (int x = 0; x < nx; ++x)
{
Rect roi(x * src.cols, y * src.rows, src.cols, src.rows);
UMat hdr(dst, roi);
src.copyTo(hdr);
}
return true;
}
void repeat(InputArray _src, int ny, int nx, OutputArray _dst) void repeat(InputArray _src, int ny, int nx, OutputArray _dst)
{ {
Mat src = _src.getMat(); CV_Assert( _src.dims() <= 2 );
CV_Assert( src.dims <= 2 );
CV_Assert( ny > 0 && nx > 0 ); CV_Assert( ny > 0 && nx > 0 );
_dst.create(src.rows*ny, src.cols*nx, src.type()); Size ssize = _src.size();
Mat dst = _dst.getMat(); _dst.create(ssize.height*ny, ssize.width*nx, _src.type());
Size ssize = src.size(), dsize = dst.size();
if (ocl::useOpenCL() && _src.isUMat())
{
CV_Assert(ocl_repeat(_src, ny, nx, _dst));
return;
}
Mat src = _src.getMat(), dst = _dst.getMat();
Size dsize = dst.size();
int esz = (int)src.elemSize(); int esz = (int)src.elemSize();
int x, y; int x, y;
ssize.width *= esz; dsize.width *= esz; ssize.width *= esz; dsize.width *= esz;