I try to get the live stream from my IP camera by using OpenCv 2.4.11 on Windows. However, it raises error and when I debug the an access occured as
Unhandled exception at 0x0000000066E5377F (opencv_ffmpeg2411_64.dll) in opencvAxisExp.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
I use the code below to do so;
#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:pass@ip_address:port/axis-cgi/jpg/image.cgi?camera=1&resolution=320x240&compression=25 ";
const std::string videoStreamAddress = "http:/user:pass@ip_address:port/axis-cgi/mjpg/video.cgi";
//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;
}
}
Is this a dll error or what is missing here? Do you have any suggestion? Thanks for any comment.