I executed a simple C++ program in Visual Studio2010 using OpencV version 2.2 to start the camera and display the video simaltaneously.But the camera gets started and only the window came as output and not the video capture simaltaneously..Here is my code.Is there any error in camera..Do we need to install any softwares..Please suggest as soon as possible.
#include "stdafx.h" #include <cv.h> #include <highgui.h> #include <stdio.h> #include <conio.h> int main() { CvCapture* capture =0; capture = cvCaptureFromCAM(0); if(!capture) { printf("Capture failure\n"); return -1; } IplImage* frame=NULL; cvNamedWindow("Video"); cvNamedWindow ("Ball"); //iterate through each frames of the video while(true) { frame = cvQueryFrame(capture); if(!frame) break; //frame=cvCloneImage(frame); cvShowImage("Video", frame); //Clean up used images cvReleaseImage(&frame); //Wait 50mS int c = cvWaitKey(10); //If 'ESC' is pressed, break the loop if((char)c==27 ) break; } cvDestroyAllWindows() ; //cvReleaseCapture(&capture); return 0; }
and there is a warning in the output window is as:
OpenCV Error: Bad argument (unrecognized or unsupported array type) in unknown f unction, file ........\ocv\opencv\modules\core\src\array.cpp, line 995