taking a video from usb cam
-
Hi, It is a code for a robot i want code take vedio from usb cam and make it frams(pics) as i could use it later @ another code the code is in C++ i found one but there is a compiler error it is little but i canot fixed it
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"IplImage* src = NULL;
int _tmain(int argc, _TCHAR* argv[])
{int key;
CvCapture* capture = NULL;if(NULL==(capture = cvCaptureFromCAM(-1)))
{
printf("\nError on cvCaptureFromCAM");
return -1;
}//-----
cvNamedWindow("Capture", CV_WINDOW_AUTOSIZE);
cvNamedWindow("Capture2", CV_WINDOW_AUTOSIZE);cvMoveWindow("Capture", 50, 50);
cvMoveWindow("Capture2", 320, 50);for(;;){
if(NULL==(src=cvQueryFrame(capture))){ printf("\\nError on cvQueryFrame"); break; } cvShowImage("Capture", src); key = cvWaitKey(10); if(key==0x1b) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Capture");return 0;
}
-
Hi, It is a code for a robot i want code take vedio from usb cam and make it frams(pics) as i could use it later @ another code the code is in C++ i found one but there is a compiler error it is little but i canot fixed it
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"IplImage* src = NULL;
int _tmain(int argc, _TCHAR* argv[])
{int key;
CvCapture* capture = NULL;if(NULL==(capture = cvCaptureFromCAM(-1)))
{
printf("\nError on cvCaptureFromCAM");
return -1;
}//-----
cvNamedWindow("Capture", CV_WINDOW_AUTOSIZE);
cvNamedWindow("Capture2", CV_WINDOW_AUTOSIZE);cvMoveWindow("Capture", 50, 50);
cvMoveWindow("Capture2", 320, 50);for(;;){
if(NULL==(src=cvQueryFrame(capture))){ printf("\\nError on cvQueryFrame"); break; } cvShowImage("Capture", src); key = cvWaitKey(10); if(key==0x1b) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Capture");return 0;
}
It's hard to tell what the problem is. Where are the "cv.h" and "highgui.h" files? Can you post the complete error message here?
-
Hi, It is a code for a robot i want code take vedio from usb cam and make it frams(pics) as i could use it later @ another code the code is in C++ i found one but there is a compiler error it is little but i canot fixed it
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"IplImage* src = NULL;
int _tmain(int argc, _TCHAR* argv[])
{int key;
CvCapture* capture = NULL;if(NULL==(capture = cvCaptureFromCAM(-1)))
{
printf("\nError on cvCaptureFromCAM");
return -1;
}//-----
cvNamedWindow("Capture", CV_WINDOW_AUTOSIZE);
cvNamedWindow("Capture2", CV_WINDOW_AUTOSIZE);cvMoveWindow("Capture", 50, 50);
cvMoveWindow("Capture2", 320, 50);for(;;){
if(NULL==(src=cvQueryFrame(capture))){ printf("\\nError on cvQueryFrame"); break; } cvShowImage("Capture", src); key = cvWaitKey(10); if(key==0x1b) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Capture");return 0;
}
-
It's hard to tell what the problem is. Where are the "cv.h" and "highgui.h" files? Can you post the complete error message here?
-
Hi, It is a code for a robot i want code take vedio from usb cam and make it frams(pics) as i could use it later @ another code the code is in C++ i found one but there is a compiler error it is little but i canot fixed it
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"IplImage* src = NULL;
int _tmain(int argc, _TCHAR* argv[])
{int key;
CvCapture* capture = NULL;if(NULL==(capture = cvCaptureFromCAM(-1)))
{
printf("\nError on cvCaptureFromCAM");
return -1;
}//-----
cvNamedWindow("Capture", CV_WINDOW_AUTOSIZE);
cvNamedWindow("Capture2", CV_WINDOW_AUTOSIZE);cvMoveWindow("Capture", 50, 50);
cvMoveWindow("Capture2", 320, 50);for(;;){
if(NULL==(src=cvQueryFrame(capture))){ printf("\\nError on cvQueryFrame"); break; } cvShowImage("Capture", src); key = cvWaitKey(10); if(key==0x1b) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Capture");return 0;
}