mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Fix GpuMat to correctly calculate dataend when using GpuMat::create().
Add output to createMat() to be used by locateROI test cases.
This commit is contained in:
@@ -91,7 +91,13 @@ namespace cvtest
|
||||
|
||||
GpuMat createMat(Size size, int type, bool useRoi)
|
||||
{
|
||||
Size size0 = size;
|
||||
Size size0; Point ofs;
|
||||
return createMat(size, type, size0, ofs, useRoi);
|
||||
}
|
||||
|
||||
GpuMat createMat(Size size, int type, Size& size0, Point& ofs, bool useRoi)
|
||||
{
|
||||
size0 = size;
|
||||
|
||||
if (useRoi)
|
||||
{
|
||||
@@ -100,9 +106,10 @@ namespace cvtest
|
||||
}
|
||||
|
||||
GpuMat d_m(size0, type);
|
||||
|
||||
if (size0 != size)
|
||||
d_m = d_m(Rect((size0.width - size.width) / 2, (size0.height - size.height) / 2, size.width, size.height));
|
||||
if (size0 != size) {
|
||||
ofs = Point((size0.width - size.width) / 2, (size0.height - size.height) / 2);
|
||||
d_m = d_m(Rect(ofs, size));
|
||||
}
|
||||
|
||||
return d_m;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user