Guest User

Untitled

a guest
Mar 16th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. #include <opencvcv.h>
  2. #include <opencv2highguihighgui.hpp>
  3. #include <opencv2imgprocimgproc.hpp>
  4. #include <iostream>
  5. #include <stdio.h>
  6.  
  7. using namespace std;
  8. using namespace cv;
  9.  
  10. int main()
  11. {
  12. Mat frame;
  13. namedWindow("video", 1);
  14. VideoCapture cap("http://IPADDRESS/video.mjpg");
  15. if(!cap.isOpened())
  16. {
  17. cout<<"Camera not found"<<endl;
  18. getchar();
  19. return -1;
  20. }
  21. while ( cap.isOpened() )
  22. {
  23. cap >> frame;
  24. if(frame.empty()) break;
  25.  
  26. imshow("video", frame);
  27. if(waitKey(30) >= 0) break;
  28. }
  29. return 0;
  30. }
  31.  
  32. int main(int, char**) {
  33. cv::VideoCapture vcap;
  34. cv::Mat image;
  35.  
  36. // This works on a D-Link CDS-932L
  37. const std::string videoStreamAddress = "http://ID:PASSWORD@IPADDRESS:PORTNO/mjpeg.cgi?user=ID&password=ID:PASSWORD&channel=0&.mjpg";
  38. //open the video stream and make sure it's opened
  39. if(!vcap.open(videoStreamAddress)) {
  40. std::cout << "Error opening video stream or file" << std::endl;
  41. return -1;
  42. }
  43.  
  44. for(;;) {
  45. if(!vcap.read(image)) {
  46. std::cout << "No frame" << std::endl;
  47. cv::waitKey();
  48. }
  49. cv::imshow("Output Window", image);
  50.  
  51. if(cv::waitKey(1) >= 0) break;
  52. }
  53.  
  54. }
  55.  
  56. #include <stdio.h>
  57. #include <opencv2/opencv.hpp>
  58. #include <iostream>
  59. int main(int, char**) {
  60. cv::VideoCapture vcap;
  61. cv::Mat image;
  62.  
  63. // This works on a D-Link CDS-932L
  64.  
  65. const std::string videoStreamAddress = "http://USER:PWD@IPADDRESS:8088/mjpeg.cgi?user=USERNAME&password=PWD&channel=0&.mjpg";
  66. //open the video stream and make sure it's opened
  67. if(!vcap.open(videoStreamAddress)) {
  68. std::cout << "Error opening video stream or file" << std::endl;
  69. return -1;
  70. }
  71.  
  72. for(;;) {
  73. if(!vcap.read(image)) {
  74. std::cout << "No frame" << std::endl;
  75. cv::waitKey();
  76. }
  77. cv::imshow("Output Window", image);
  78.  
  79. if(cv::waitKey(1) >= 0) break;
  80. }
  81.  
  82. }
  83.  
  84. http://<USERNAME>:<PASSWORD>@<IP_ADDRESS>/<the value of src>
  85.  
  86. http://uname:login@192.168.0.0/mjpg/video.mjpg
  87.  
  88. VideoCapture capture;
  89. Mat image;
  90. if (!capture.open("http://192.168.1.103/video.cgi?.mjpg")) {
  91. cout << "Error opening video stream or file" << endl;
  92. return -1;
  93. }
  94. ....
Add Comment
Please, Sign In to add comment