Cannot Access IP camera while running an .EXE file - c++

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...

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.

Related

OpenCV - Webcam imshow not displaying live feed, gray screen instead

I am working with OpenCV version 3.2.0 in Visual Studio 2015 and have been able to access my webcam until all of a sudden when I was working on it this morning. I can't figure out where this problem is coming from. I now get:
It doesn't throw any errors but it also doesn't show any input through the webcam
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
VideoCapture cap;
cap.open(0);
if (!cap.isOpened())
{
printf("--(!)Error opening video capture\n");
return -3;
}
Mat image;
namedWindow("Image", CV_WINDOW_AUTOSIZE);
while (1)
{
cap.read(image);
imshow("Image", image);
waitKey(30);
}
return 0;
}
Has anyone encountered this error before?
Edit:
Things I have looked at:
My webcams that I have work in things like Google Hangouts so I don't think it's a webcam issue.
Also, I uninstalled Visual Studio 2015 and installed Visual Studio 2017 to see if reinstalling would work and still get the same results.
Edit:
I am getting the error <information not available, no symboles loaded for opencv_world320d.dll> when I create a new VideoCapture object. I am pretty sure I have everything included correctly.
Configuration Properties -> C/C++ -> Additional Include Directories:
$(OPENCV_BUILD)\include
Configuration Properties -> Linker -> General:
$(OPENCV_BUILD)\x64\vc14\lib
Configuration Properties -> Linker -> Input:
opencv_world320d.lib
I encountered the same problem after obtaining Opencv via compiling and building source using CMake. Then, I deleted them and installed Opencv from prebuilt binaries. I have run the code again and there was no problem.
As suggested by #michael scolfield, it was a problem with my antivirus blocking my webcam. I couldn't figure out how to exclude my Visual Studio directory so I just tried uninstalling it and it worked. It would be nice to have antivirus and have this working so I'll need to figure that out. But for temps this will work.

Using Qt to configure OpenCV library failed

I'm new to Qt creator. Yesterday, I followed the official instructions to configure OpenCV library but it failed. I tried everything on the Internet but it just didn't work. Detailed are listed as belows:
test code is simple, I only want to ensure whether the library works:
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
int main(int argc, char *argv[])
{
cout << "Hello World!" << endl;
return 0;
}
My project configuration is like below :
I thought there might be a problem in debugger. I configure the debugger and I'm quite sure it's ok. The picture is here:
But it just doesn't work. When I click build and run, it says:
C1083: cannot open containing files: "opencv2/opencv.hpp": No such
file or directory.
What's strange is when I include <files> in the editor, the automatic code completion can detect the existence of the OpenCV library and hint after <opencv2/> that there are opencv.hpp, core.hpp .etc. and in the Include Hierarchy, the opencv.hpp exists.
So what might be the problem?

c++ win32 console application is not recognized as an internal or external command operable program or batch file

so I just installed vs2015, and I'm having issues starting a project. For my intro school programming class, we are learning with the win32 console. I started up my own project at home so I could work on my projects at home, but I'm having issues starting. Thanks in advance for any help. Link to image
Your issue is annoying yet simple to fix, before I answer it you're using visual studio 2015 which means by default you would have been "given " a header file and your main would have looked like the following.
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
You can modify the main function, as in remove every thing but int main() but I would suggest not doing this.
The answer to your question is, your program will not compile because you are not using #include "stdafx.h"
simply put that in and your projects will work assuming you code them right...
Also after looking at your picture more closely ( next time post your code here)
I see that your only source file showing is named R4.Que? Rename it R4.cpp

Error executing openCV aplication on WINDOWS 7

Im using eclipse with opencv and i have this simple project:
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat im = imread(argc == 2 ? argv[1] : "lena.jpg", 1);
if (im.empty())
{
cout << "Cannot open image!" << endl;
return -1;
}
imshow("image", im);
waitKey(0);
return 0;
}
It apears to be correct acording to eclipse and it compiles just fine. But if i try to run it on debug mode from eclipse nothing happend and if i try to execute the .exe i get this error:
EDIT: These images are in spanish, but the error is exactly the same that the one in this post: opencv 2.4 error in windows 7 64 bit
I am runing it on a virtual machine with windows 7 x86.
PS: Sry for my english!
There's a chance that when Eclipse runs your application it looks for lena.jpg in a directory where this file is not present.
Make sure you put the JPG in the same folder as your source files and also in the same folder as the .exe.
Your code seems legit, and this problem shouldn't be happening. The best way to figure out what's really going on is to use the debugger and find out which of the calls trigger the error.

Difficulties configuring openCV library in Visual C++

I'm trying to configure my Visual C++ to use the openCV libraries. I've followed the instructions on OpenCV website http://opencv.willowgarage.com/wiki/VisualC%2B%2B...
// OpenCV_Helloworld.cpp : Defines the entry point for the console application.
// Created for build/install tutorial, Microsoft Visual Studio and OpenCV 2.2.0
#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
int _tmain(int argc, _TCHAR* argv[])
{
// Open the file.
IplImage *img = cvLoadImage("photo.jpg");
if (!img) {
printf("Error: Couldn't open the image file.\n");
return 1;
}
// Display the image.
cvNamedWindow("Image:", CV_WINDOW_AUTOSIZE);
cvShowImage("Image:", img);
// Wait for the user to press a key in the GUI window.
cvWaitKey(0);
// Free the resources.
cvDestroyWindow("Image:");
cvReleaseImage(&img);
return 0;
}
I have altered the include and library directories in VC++ directories inside the Property Pages, and have added the additional dependencies. However, when I try and load an image with the same header files as the sample code, it says that cvLoadImage is undefined, as is cvNamedWindow
IplImage *img = cvLoadImage("JellyFish.jpg");
Any suggestions as to where I might have my problem?
You might try making sure your Code Generation for your project is Multi-threaded DLL (or Multi-threaded Debug DLL).
You need to configure using CMake. Get OpenCV 2.2 and try the following step by step guide.
http://kaushalsolanki.com/2011/01/compile-and-set-up-opencv-for-visual-studio-2010-with-64-bits-support-ipp-7-0-and-tbb/
I encountered the same error but i finally fixed it
I am using opencv 2.3
what I did was I changed all the additional dependencies
from opencv_core220d.lib to opencv_core231d.lib
we need to change all of the dependencies in the same way
and then i copied all the *.dll files from my bin>>debug folder to
where i had new project that is
helloworld>>helloworld
for example
C:\opencv\build\bin\debug copy all *.dll files to
C:\opencv\Projects\helloworld\helloworld