Why opencv does not support CV_32U Mat?

CV_32U ???

Many functions in NVIDIA CUDA require cv_ 32u(32-bit unsigned integer) image as
parameter, but opencv doesn’t support cv_ 32u, it’s really inconvenient.

NVIDIA 2D Image And Signal Performance Primitives (NPP): LabelMarkers
NVIDIA 2D Image And Signal Performance Primitives (NPP): FloodFill

You can cast CV_32S to unsigned integer. Like:

Mat img(H,W,CV_32S); //create a CV_32S image
uint32_t *ptr = (uint32_t)img.ptr(0); //access the data pointer as uint32_t

Anyway, the memory is managed the same way regardless of data type (so you can even cast it to 32 bit RGBA image for example).
Furthermore, the only difference between signed and unsigned int is the first bit which is considered a sign bit for signed int. So the data is the same between 0-10⁹.
The other difference can be the displaying - so you’ll have to write your own conversion utility to CV_8U.

For CUDA acces it’s the same: you create a CV_32S Mat and cast it to unsigned int in the CUDA function:

__global__ void cudaFunc(cv::cudev::PtrStepSz<unsigned int> src, cv::cudev::PtrStepSz<unsigned int> dst)

and call it: