I have a doubt with opencv with cuda and the backgroundsubtractor in the Xavier AGX.
I’m using the next code:
int main(int argc, char** argv ) {
VideoCapture cap(0);
if(!cap.isOpened()) {
return -1;
}
cv::Ptr<cv::cuda::BackgroundSubtractorMOG2> pBackSub = cv::cuda::createBackgroundSubtractorMOG2(5, 750, false);
while(true) {
Mat img;
cap >> img;
cv::cuda::GpuMat gpu;
cv::cuda::GpuMat fgMask;
gpu.upload(img);
pBackSub->apply(gpu, fgMask, 0.2);
Mat mask;
fgMask.download(mask);
imshow("image", mask);
waitKey(12);
}
return 0;
}
With this test code the subtractor works fine, but when I change the videocapture to a rtsp source I start to see the mask with a lot of noise and the camera is stopped, so it should be a black image as I see in the example above.
Besides, if I test that code in other desktop pc I don’t have this problem.
Does anyone know what is happening?
Thanks in advance