How to use cv::cudev::GpuMat_ correctly?

I have found a problem when using cv::cuda::GpuMat since I am uploading originally an image of type Mat1b (which is Mat_<uchar> )

Since apparently a Mat1b does not exist for CUDA versions, I am trying to use what I suppose is the equivalent: the cv::cudev::GpuMat_ template

However when doing

cv::cudev::GpuMat_<uchar> GPUother_image;

I got the following error

error: aggregate ‘cv::cudev::GpuMat_<unsigned char> GPUother_image’ has incomplete type and cannot be defined
     cv::cudev::GpuMat_<uchar> GPUother_image;

How can I solve this problem and use GpuMat_ correctly?

I have never used the thin wrappers before but it seems that both:

cv::cudev::GpuMat_<uchar> gpuMat1b(mat1b);


cv::cudev::GpuMat_<uchar> gpuMat1b;


Mat1b mat1b(3, 3);

are working for me. Maybe you are missing the header

#include <opencv2/cudev/ptr2d/gpumat.hpp>

Just out of interest why do you want to use cv::cudev::GpuMat_ instead of GpuMat?

cross-post and solution:

there is a GpuMat_? I didn’t know that.
And is cv::cudev::GpuMat_ gpuMat1b(mat1b); similar to gpuMat1b.upload(mat1b)??

as for the reason, in my group project, the requirements are to use Mat1b or equivalent

No sorry there is not, the markup “<>” killed <uchar>. I have corrected my previous post.

Yes they are equivalent. Furthermore if you are simply using Mat1b because you have to you might as well use standard GpuMat, which can be created from a Mat1b.

cv::cudaGpuMat gpuMat(mat1b);