Opencv with rtsp source and backgroundsubtractor in Xavier AGX

Maybe the difference is resolution and pixels/s. The online sample has very small resolution, while probably your IP cam has much higher resolution and opencv videoio may be the bottleneck.
Also note that imshow is CPU only and not efficient on Jetsons. You may use a VideoWriter with a gstreamer pipeline to another display sink, or jetson-utils VideoOutput.

For this kind of GPU processing, you may try to use nvivafilter plugin after H264 decoding with frames in NVMM memory.
You may have a look to this example or this one for opencv GPU processing RGBA frames in NVMM memory (you may run the BG substractor on RGB only, not sure what it would do on alpha),
For NV12 processing being faster, this example may also help, but this might not be your case.

1 Like