Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <opencvcv.h>
- #include <opencv2highguihighgui.hpp>
- #include <opencv2imgprocimgproc.hpp>
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- using namespace cv;
- int main()
- {
- Mat frame;
- namedWindow("video", 1);
- VideoCapture cap("http://IPADDRESS/video.mjpg");
- if(!cap.isOpened())
- {
- cout<<"Camera not found"<<endl;
- getchar();
- return -1;
- }
- while ( cap.isOpened() )
- {
- cap >> frame;
- if(frame.empty()) break;
- imshow("video", frame);
- if(waitKey(30) >= 0) break;
- }
- return 0;
- }
- int main(int, char**) {
- cv::VideoCapture vcap;
- cv::Mat image;
- // This works on a D-Link CDS-932L
- const std::string videoStreamAddress = "http://ID:PASSWORD@IPADDRESS:PORTNO/mjpeg.cgi?user=ID&password=ID:PASSWORD&channel=0&.mjpg";
- //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;
- }
- }
- #include <stdio.h>
- #include <opencv2/opencv.hpp>
- #include <iostream>
- int main(int, char**) {
- cv::VideoCapture vcap;
- cv::Mat image;
- // This works on a D-Link CDS-932L
- const std::string videoStreamAddress = "http://USER:PWD@IPADDRESS:8088/mjpeg.cgi?user=USERNAME&password=PWD&channel=0&.mjpg";
- //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;
- }
- }
- http://<USERNAME>:<PASSWORD>@<IP_ADDRESS>/<the value of src>
- http://uname:login@192.168.0.0/mjpg/video.mjpg
- VideoCapture capture;
- Mat image;
- if (!capture.open("http://192.168.1.103/video.cgi?.mjpg")) {
- cout << "Error opening video stream or file" << endl;
- return -1;
- }
- ....
Add Comment
Please, Sign In to add comment