0

I am using Visual Studio 2010 with OpenCV 2.3.1 Libraries. I just wanted to stream video from an IP camera and make some processing in it. While trying so, it worked properly when I ran the project in VS2010. But it is not working when I tried running it as an EXE file. But the same program is working for Non-IP cameras like USB Web cams (Both as project file and as an .EXE file)

I dropped the DLL files which are all needed to the folder where my .EXE file is located (The DLL files are opencv_calib3d231d.dll,opencv_core231d.dll, opencv_features2d231d.dll, opencv_flann231d.dll, opencv_highgui231d.dll, opencv_imgproc231d.dll, opencv_objdetect231d.dll, opencv_video231d.dll, tbb_debug.dll)

I am having an error saying "Bad Flag (parameter or structure field) (Unrecognized or unsupported array type) in unknown function, file C:\slave\WinInstallerMegaPack\src\opencv\modules\core\src\array.cpp, line 2482"

My code is

#include "stdafx.h"
#include<iostream>
#include"opencv2\opencv.hpp"
#include"opencv2\highgui\highgui.hpp"
#include"opencv\cv.h"

using namespace std;
using namespace cv;

int _tmain(int argc, _TCHAR* argv[])
{
    Mat f;
    const string s="http://<username:password>@<IP address:portno>/axis-  cgi/mjpg/video.cgi?.mjpg";
    VideoCapture cap;
    cap.open(s);

    if(!cap.isOpened())
         cout<<"Cannot be accessed";
    while(8)
    {
        cap>>f;
        imshow("Live stream",f);

        if(waitKey(30)==27)
            break;
    }

    return 0;
}

Somebody Please help me get rid of this... Thanks in Advance...

  • "But it is not working when I tried running it as an EXE file." - what exactly is the error you're getting in that case? Is it a DLL load problem? – Rup Jan 05 '15 at 12:59
  • I am having an error saying "Bad Flag (parameter or structure field) (Unrecognized or unsupported array type) in unknown function, file C:\slave\WinInstallerMegaPack\src\opencv\modules\core\src\array.cpp, line 2482" It is working very good for USB cameras. The problem is only with the IP cameras – Dhivakar kanagaraj Jan 05 '15 at 13:04
  • 1
    That isn't a "running" error, It sounds like a *compile-time* error. – WhozCraig Jan 05 '15 at 13:07
  • Then, How can this error be rectified from my program? – Dhivakar kanagaraj Jan 05 '15 at 13:18
  • please read the answer and answer-comments on http://stackoverflow.com/questions/16450102/cvvideocapture-works-for-webcams-but-not-ip-cameras they say openCV videocapture cant handle the password stuff for ip camera links. Maybe you can turn off the passwort protection? Look at the link and try the sample mjpeg-ip-cam link too – Micka Jan 05 '15 at 18:48
  • or try this one, they use password ip-cam too: http://stackoverflow.com/questions/21324785/ip-camera-access-using-opencv – Micka Jan 05 '15 at 18:49
  • Thank you very much @Micka for the clarity that you gave. But still I have an issue. The IP camera is accessible when I debugged my project in Visual Studio. But the 'VideoCapture' is not working while I am executing the .EXE file in the Debug folder. The 'VideoCapture::isOpened()' function returns _false_. I almost completed my project. Now I am trying to turn it in to a product. So I need the .EXE file to be executed without any issue. Could you please help me for that?@Micka,@Rup,@WhozCraig – Dhivakar kanagaraj Jan 06 '15 at 04:44
  • Thank you @Rup. the error I have is above – Dhivakar kanagaraj Jan 06 '15 at 04:48
  • 1
    Thank you. Thank you. And thanks a lot @Micka. I got my problem solved by just linking the _opencv_ffmpeg.dll_ to my program. Or dropping the dll file in to the folder where the .EXE file exists. Thank you once again. – Dhivakar kanagaraj Jan 06 '15 at 05:01

1 Answers1

0

Thank you. Thank you. And thanks a lot @Micka. I got my problem solved by just linking the opencv_ffmpeg.dll to my program. Or dropping the dll file in to the folder where the .EXE file exists. Thank you once again.