I am doing CUDA with OpenCV to process livestream from a usb webcam. currently I am doing something like this:
cv::videoCapture cap(0);
cv::Mat h_frame;
while(cap.read(h_frame)){
cv::cuda::gpuMat d_frame(h_frame);
//process d_frame;
}
Is it possible to get rid of h_frame
and directly read to d_frame
:
//Imaginary code
cv::cuda::gpuVideoCapture cap(0);
cv::cuda::gpuMat d_frame;
while(cap.read(d_frame)){
//process d_frame;
}
Or even using CUDA directly. I mean like reading the camera output as stream of bytes (directly to the GPU) then acquiring it by gpuMat
in somehow?
It's not possible at this time.
You need to use whatever method you wish to capture the USB data to system memory. From there you can transfer from system memory to GPU memory.