Camera fps too low on Xavier

If you wait for 200ms for each frame, you cannot get more than 5 fps. I’d suggest to use 1ms for now.

You may check the available modes for your sensor with:

v4l2-ctl -d0 --list-formats-ext

and post these for better advice. (v4l2-ctl is provided by apt package v4l-utils)
You may be able to set width, height and fps according to the mode you want after cap.open().
Also note that you may have to perform a read for fps value read from CAP_PROP_FPS to be updated.

Also note that imshow is not very fast on jetson for high resolutions. You may try a videoWriter with a gstreamer pipeline to nvoverlaysink instead:

cv::VideoWriter gst_testsink;
gst_testsink.open("appsrc ! queue ! videoconvert ! video/x-raw, format=RGBA ! nvvidconv ! nvoverlaysink ", cv::CAP_GSTREAMER, 0, fps, cv::Size(width, height));

in the loop, you would remove imshow and waitKey and use instead:

while(1)
{
   if (!cap.read(img)) {
       std::cout<<"Capture read error"<<std::endl;
       break;
   }
   gst_testsink.write(img);
}
gst_testsink.release();
cap.release();