I am trying to write a program in OpenCV that just displays the video from an axis camera, which is a type of ip camera. My problem is that OpenCV gives me an error and crashes.
The error is:
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /home/pi/opencv-2.4.5/modules/core/src/array.cpp, line 2482
terminate called after throwing an instance of 'cv::Exception'
what(): /home/pi/opencv-2.4.5/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMatAborted
My code is:
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main()
{
Mat img;
namedWindow("IMG", CV_WINDOW_AUTOSIZE);
while(true)
{
img = imread("http://10.17.14.11/jpg/image.jpg");
if(img.empty())cout<<"The image is empty\n";//This cout is printed
imshow("IMG", img);
if(waitkey(1) >=0)break;
}
}
I have tried using a VideoCapture with the address
"http://10.17.14.11/mjpg/video.mjpg"
but I got the same error. I also put both of these URLs into my web browser and they were valid.
Thank you.
EDIT
Could the reason for VideoCapture not working be that I don't have ffmpeg installed?