Non-continuous GpuMat after cv::cuda::transpose
Opencv3.0x64 Cuda6.5 Windows7x64
I have a continuous cv::cuda::GpuMat of homogeneous points organized in col major format. IE:
X1, X2, X3 .....
Y1, Y2, Y3 .....
1, 1, 1 .....
I am trying to transpose this and manipulate it into this format:
X1
Y1
1
X2
Y2
1
X3
Y3
1
To do this, I should be able to transpose the matrix, reshape it then transpose it again. Unfortunately when I do this I seem to run into a bug with cv::cuda::transpose. After transposing the first matrix, I should have a "diff" matrix like this:
X1, Y1, 1,
X2, Y2, 1,
...........
With floating point values, this should give a step size of 12 bytes and be continuous. Unfortunately the resultant matrix has a step size of 512 bytes and is non-continuous. Because of this, I cannot reshape the matrix.
Is this a bug with cv::cuda::transpose? I've tried the following:
cv::cuda::transpose(diff,diff);
diff = diff.reshape(1,1);
and
cv::cuda::transpose(diff,diff);
diff = diff.clone().reshape(1,1);
and
cv::cuda::transpose(diff,diff);
diff = diff.colRange(0,3).clone();
diff = diff.reshape(1,1);
No matter what, reshape throws the exception:
error: (-13) The matrix is not continuous, thus its number of rows can not be changed in function cv::cuda::GpuMat::reshape"
I've downloaded it and the downloaded copy is correct with a step size of 12. Is this some kind of alignment requirement in cuda? How can I reshape the matrix to what I need without downloading it to the CPU?