problem in cv::capture
Hello, I have a problem in project visual studio 2015 opencv 3.2 Same code code works without any problem in opencv 2.4
void Example_video1()
{
//const std::string videoStreamAddress = "http://<username:password>@<ip_address>/video.cgi?.mjpg";
const std::string videoStreamAddress = "http://<username:password>@<ip_address>/video.cgi?.mjpg";
cv::namedWindow("Example3", cv::WINDOW_AUTOSIZE);
cv::VideoCapture cap;
cap.open(string("c:\\one.mp4"));
//cout << frame .total()<< endl;
int i = 1;
Mat frame;
for (;;)
{
cap >> frame; // get a new frame from file
//cap.read(frame);
if (frame.empty())
{
cout << "Empty" << endl;
break;
}
else
cout << "Frame: " << i << endl;
i++;
imshow("Example3", frame);
if (waitKey(30) >= 0) break;
}
waitKey(0);
}
i get this exception in this line cap >> frame; // get a new frame from file Exception thrown at 0x00007FF8004368D8 in ConsoleApplication2.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000ABBB00EA40.
Kindly advice
Check if file is opened :
File is opened success First frame is only displayed success After first frame exception happen i tried the code with OpenCV 2.4 without any problem
Regards
Check in vs2015 if you link release lib with release configuration and debug lib with debug configuration
Problem is solved The crash was in below line using waitKey is like below is the problem
Replaced with this line
may be your problem is solved but that's not a good explantion