是否可以从USB网络摄像头直接读取到GPU内存

Hum*_*awi 2 opencv cuda

我正在使用OpenCV进行CUDA处理来自USB网络摄像头的直播。目前我正在做这样的事情:

cv::videoCapture cap(0);
cv::Mat h_frame;
while(cap.read(h_frame)){
    cv::cuda::gpuMat d_frame(h_frame);
    //process d_frame;
}
Run Code Online (Sandbox Code Playgroud)

是否有可能摆脱h_frame并直接阅读d_frame

//Imaginary code
cv::cuda::gpuVideoCapture cap(0);
cv::cuda::gpuMat d_frame;
while(cap.read(d_frame)){
    //process d_frame;
}
Run Code Online (Sandbox Code Playgroud)

甚至直接使用CUDA。我的意思是像将摄像头输出读取为字节流(直接发送到GPU),然后gpuMat以某种方式获取它一样?

Rob*_*lla 5

目前无法执行。

您需要使用希望将USB数据捕获到系统内存的任何方法。从那里您可以从系统内存转移到GPU内存。