我有一台IP摄像机可以传输rtsp 以下代码允许我显示rtsp流
int main(int, char**) {
cv::VideoCapture vcap;
cv::Mat image;
const std::string videoStreamAddress = "rtsp://my_rtspstream";
//open the video stream and make sure it's opened
if(!vcap.open(videoStreamAddress)) {
std::cout << "Error opening video stream or file" << std::endl;
return -1;
}
for(;;) {
if(!vcap.read(image)) {
std::cout << "No frame" << std::endl;
cv::waitKey();
}
cv::imshow("Output Window", image);
if(cv::waitKey(1) >= 0) break;
}
}
问题是我在相机看到的内容与opencv的窗口之间有大约450-600毫秒的延迟差异,而且我需要更少因为具有pt控制的相机。
你有任何方法吗?我应该用另一种东西代替opencv ??由于