how to add left and right image for webcam using the win32 to program?

Hi,
I'm new to the c++ with win32.. I do not know how to add the headers and source files. Some of the sample program i downloaded works when i click the .exe file but when i open the .cpp files and run it, it says that cannot open include file: fstream.h..

Why is that so since i can run the sample .exe.. I like to know how the header and source file works..

fstream.h is the old header. Using modern C++ you should #include <fstream> ( without .h )
So how do i program such that the webcam can show left and right image? Somthing like this..

#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", CV_WINDOW_AUTOSIZE);
cvMoveWindow("Left", 100, 200);

cvNamedWindow("Right", CV_WINDOW_AUTOSIZE);
cvMoveWindow("Right", 200, 400);

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

}



Instead of capture of it, i want it to do it like video.. How should i do that?
does anyone know how to do it?
Topic archived. No new replies allowed.