***** Kumar
May **, **** at 21:57
Hey I have some trouble in obtaining live feed using open-cv
#include "highgui.h"
#include "cv.h"
int main()
{
char c;
CvCapture* camera = cvCreateCameraCapture(-1);
cvNamedWindow("live feed",CV_WINDOW_AUTOSIZE);
IplImage* frame;
while(1)
{
if(!frame)
break;
frame = cvQueryFrame(camera);
cvShowImage("live feed",frame);
c = cvWaitKey(33);
if(c==27)
break;
}
}
Its breaking without scanning.Can you tell what is wrong.
jayrambhia
May **, **** at 15:25
scanning ?
I think your camera is not working properly. and your code is also incorrect.
#include<opencv2/highgui/highgui.hpp>
#include<stdio.h>
int main()
{
CvCapture* cam = cvCreateCameraCapture(-1);
cvNamedWindow("livefeed",CV_WINDOW_AUTOSIZE);
IplImage* frame;
if (!frame)
{
printf("frame NULL");
}
else
{
printf("frame not NULL");
}
return (0);
}
try this code. compare it with your code. and see where you have done the mistake.