Confusion if PtrStepSZ is compatible with CUDA 7.5

asked 2016-10-06 09:26:59 -0600

sarthakahuja11 gravatar image

updated 2016-10-06 10:13:11 -0600

LBerger gravatar image

Actually the problem is I am recieving a Mat Image in a function and i want it to split it into 3 channels, hence I am not sure if I pass a Mat image function in the cpp file, then in the .cu file converting into a unsigned char pointer than in the final kernel making it a PtrStepSz

These are my function calls:

Mat imghsv,dstimg,dstimg1,dstimg2;
void gpu_inRange(imghsv, dstimg,dstimg1, dstimg2);
.
.
..

extern "C" void gpu_inRange(unsigned char *h_imghsv, unsigned char *dstimg, unsigned char *dstimg1, unsigned char *dstimg2)
.
..
..

gpu_inRange_kernel<<>>(d_imghsv,dstimg,dstimg1,dstimg2);
.
.
.
.
.
..
void gpu_inRange_kernel(const PtrStepSz imghsv,PtrStepSzb dstimg, PtrStepSzb dstimg1, PtrStepSzb dstimg2)

. ... .. Right now I'm pretty uncertain if this will work or not. As I guess there are too many conflicting data types plus I have'nt used these before. I think if change the unsigned char* into a GpuMat , then will it work? As it is mentioned in the Documentation " The GpuMat class is convertible to cuda::PtrStepSz and cuda::PtrStep so it can be passed directly to the kernel"

So is the following declaration better?

extern "C" void gpu_inRange(cv::cuda::GpuMat h_imghsv, cv::cuda::GpuMat dstimg, cv::cuda::GpuMat dstimg1, cv::cuda::GpuMat dstimg2)

I started learning CUDA few months back and still I am figuring few things. It would be really great if you could help me with this. Thanks a ton! :)

edit retag flag offensive close merge delete