Im running this code:
#include <iostream>
#include <sstream>
#include <ctime>
#include <string>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main()
{
//create matrix for storage
Mat feed, feed2;
//initialize capture
VideoCapture cap, cap2;
cap.open("http://192.168.1.128/videostream.asf?user=admin&pwd=");
cap2.open("http://192.168.1.110/webcam.mjpeg");
// check if we succeeded
if (!cap.isOpened()){
cerr << "Failed to open video capture" << std::endl;
cout << "cannot open camera";
return -1;
}
if (!cap2.isOpened()){
cerr << "Failed to open video capture" << std::endl;
cout << "cannot open camera";
return -1;
}
//create window to show image
namedWindow("VIDEO", 1);
//loop
while (true){
//copy webcam stream to image
cap >> feed;
cap2 >> feed2;
resize(feed, feed, Size(1270, 700), 0, 0, INTER_CUBIC);
resize(feed2, feed2, Size(320, 170), 0, 0, INTER_CUBIC);
feed2.copyTo(feed(cv::Rect(874,463,feed2.cols, feed2.rows)));
//small_image.copyTo(big_image(cv::Rect(x,y,small_image.cols, small_image.rows)));
//webcamstream
imshow("VIDEO", feed);
//exit it key pressed
if (waitKey(30) >= 0){
break;
}
//delay33ms
waitKey(10);
//
}//endloop
}//main
It runs but after a while it always freezes showind the bellow on the cmd windows:
***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****
init done [mjpeg @ 0022ec00] error dc
[mjpeg @ 0022ec00] error y=9 x=28
Would anyone know how I can start debbuging this to see where the issues could be? I'm suspecting on of the stream is not stable enough, it might sending frames that are or get corrupted and I suspect this may be causing some short of issue.