Ask Your Question

Revision history [back]

It looks like a typo, you are not passing out by reference (or pointer), therefore everything is working as expected inside gpuResize() but Mat out; in main does not occupy the same memory location as Mat out in static void gpuResize(Mat in, Mat out). You can check this is the problem by moving cout << "real size="<<out.size() <<endl; inside gpuResize().

For simplicity I would pass by reference, that is change

static void gpuResize(Mat in, Mat out)

to

static void gpuResize(Mat in, Mat &out)

It looks like a typo, you are not passing out by reference (or pointer), therefore everything is working as expected inside gpuResize() but Mat out; in main does not occupy the same memory location as Mat out in static void gpuResize(Mat in, Mat out). You can check this is the problem by moving cout << "real size="<<out.size() <<endl; inside gpuResize().

For simplicity I would pass by reference, that is change

static void gpuResize(Mat in, Mat out)

to

static void gpuResize(Mat in, Mat &out)