Hi all, i've been looking for codes that works with webcam using c++ and openCV.. I like to understand how to create an header file. Now my objective is to have the webcam to video left and right images..
Now my code is only capturing. How do i make it into video like talking to someone else and also can enlarge the images?
Something like an webcam which have the magnifier function.
This is my code.
CODE
#include <stdafx.h>
#include <iostream>
#include <cv.h>
#include <cvaux.h>
#include <highgui.h>
#include <cvcam.h>
using namespace std;
int main()
{
cout << "Hello EveryOne!!!\n"; // print to screen
//getchar(); // wait for a key to be pressed
CvCapture* capture1 = cvCaptureFromCAM(0);
CvCapture* capture2 = cvCaptureFromCAM(0);
IplImage* img1 = 0;
IplImage* img2 = 0;
if(!cvGrabFrame(capture1)){ // capture a frame
printf("Could not grab a frame from camera 1\n\7");
exit(0);
}
if(!cvGrabFrame(capture2)){ // capture a frame
printf("Could not grab a frame from camera 2\n\7");
exit(0);
}
img1=cvRetrieveFrame(capture1); // retrieve the captured frame
img2=cvRetrieveFrame(capture2);
// create a window
cvNamedWindow("Left");
cvMoveWindow("Left", 100, 300);
cvNamedWindow("Right");
cvMoveWindow("Right", 800, 300);
// show the image
cvShowImage("Left", img1 );
cvShowImage("Right", img2 );
// wait for a key
cvWaitKey(0);
//Release the image
cvReleaseCapture(&capture1);
cvReleaseCapture(&capture2);
return 0; // the main function returns zero
}