Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/134.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过opencv和c+从ip摄像头传输视频+; 我试图用OpenCV代码从C++访问Web CAM流,但是失败了,显示出无法打开流的错误。下面提到的代码在将URL替换为0时访问web cam。 可以从VLC和python代码访问相同的摄像头 #include <stdio.h> #include <opencv2/highgui/highgui.hpp> #include <opencv2/opencv.hpp> #include <iostream> int main(int, char**) { VideoCapture cap("rtsp://admin:admin@10.11.18.185:554/cam/realmonitor?channel=1&subtype=0"); // open the video camera using http protocol with the URL specified while (!cap.isOpened()) // if not success, exit program { cout << "cap not open" << endl; continue; //return -1; } Mat frame; namedWindow("MyVideo", CV_WINDOW_AUTOSIZE); while (1) { cap.read(frame); imshow("MyVideo", frame); if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop { cout << "esc key is pressed by user" << endl; exit(0); } } } #包括 #包括 #包括 #包括 int main(int,char**){ 视频捕捉帽(“rtsp://admin:admin@10.11.18.185:554/cam/realmonitor?channel=1&subtype=0“;//使用指定URL的http协议打开摄像机 而(!cap.isopend())//如果不成功,退出程序 { 视频捕获库需要一组特定的格式来接收视频流_C++_Opencv_Video Streaming_Rtsp_Ip Camera - Fatal编程技术网

通过opencv和c+从ip摄像头传输视频+; 我试图用OpenCV代码从C++访问Web CAM流,但是失败了,显示出无法打开流的错误。下面提到的代码在将URL替换为0时访问web cam。 可以从VLC和python代码访问相同的摄像头 #include <stdio.h> #include <opencv2/highgui/highgui.hpp> #include <opencv2/opencv.hpp> #include <iostream> int main(int, char**) { VideoCapture cap("rtsp://admin:admin@10.11.18.185:554/cam/realmonitor?channel=1&subtype=0"); // open the video camera using http protocol with the URL specified while (!cap.isOpened()) // if not success, exit program { cout << "cap not open" << endl; continue; //return -1; } Mat frame; namedWindow("MyVideo", CV_WINDOW_AUTOSIZE); while (1) { cap.read(frame); imshow("MyVideo", frame); if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop { cout << "esc key is pressed by user" << endl; exit(0); } } } #包括 #包括 #包括 #包括 int main(int,char**){ 视频捕捉帽(“rtsp://admin:admin@10.11.18.185:554/cam/realmonitor?channel=1&subtype=0“;//使用指定URL的http协议打开摄像机 而(!cap.isopend())//如果不成功,退出程序 { 视频捕获库需要一组特定的格式来接收视频流

通过opencv和c+从ip摄像头传输视频+; 我试图用OpenCV代码从C++访问Web CAM流,但是失败了,显示出无法打开流的错误。下面提到的代码在将URL替换为0时访问web cam。 可以从VLC和python代码访问相同的摄像头 #include <stdio.h> #include <opencv2/highgui/highgui.hpp> #include <opencv2/opencv.hpp> #include <iostream> int main(int, char**) { VideoCapture cap("rtsp://admin:admin@10.11.18.185:554/cam/realmonitor?channel=1&subtype=0"); // open the video camera using http protocol with the URL specified while (!cap.isOpened()) // if not success, exit program { cout << "cap not open" << endl; continue; //return -1; } Mat frame; namedWindow("MyVideo", CV_WINDOW_AUTOSIZE); while (1) { cap.read(frame); imshow("MyVideo", frame); if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop { cout << "esc key is pressed by user" << endl; exit(0); } } } #包括 #包括 #包括 #包括 int main(int,char**){ 视频捕捉帽(“rtsp://admin:admin@10.11.18.185:554/cam/realmonitor?channel=1&subtype=0“;//使用指定URL的http协议打开摄像机 而(!cap.isopend())//如果不成功,退出程序 { 视频捕获库需要一组特定的格式来接收视频流,c++,opencv,video-streaming,rtsp,ip-camera,C++,Opencv,Video Streaming,Rtsp,Ip Camera,从保存的文件读取时,我们在文件扩展名-.mp4、.avi等中指定相同的文件扩展名。 如果未指定此扩展,视频捕获将无法捕获帧 尝试使用: VideoCapture(“rtsp://admin:admin@10.11.18.185:554/cam/realmonitor?channel=1&subtype=0/video?x.mjpeg”);您是否使用VLC在RTSP上传输您的相机?不,我只是在VLC中测试流式url是否工作。consle或其他内容中是否有错误消息。?

从保存的文件读取时,我们在文件扩展名-
.mp4
.avi
等中指定相同的文件扩展名。 如果未指定此扩展,视频捕获将无法捕获帧

尝试使用:


VideoCapture(“rtsp://admin:admin@10.11.18.185:554/cam/realmonitor?channel=1&subtype=0/video?x.mjpeg”);

您是否使用VLC在RTSP上传输您的相机?不,我只是在VLC中测试流式url是否工作。consle或其他内容中是否有错误消息。?