You are on page 1of 4

Some copy and pastables:

Additional Include Directories: $(OPENCV_BUILD)\include


Additional Library Directories: $(OPENCV_BUILD)\x86\vc10\lib
**UPDATE**
Version 2.4.6 Additional Dependencies:
opencv_core246d.lib
opencv_imgproc246d.lib
opencv_highgui246d.lib
opencv_ml246d.lib
opencv_video246d.lib
opencv_features2d246d.lib
opencv_calib3d246d.lib
2.4.3 Additional Dependencies:
opencv_core243d.lib
opencv_imgproc243d.lib
opencv_highgui243d.lib
opencv_ml243d.lib
opencv_video243d.lib
opencv_features2d243d.lib
opencv_calib3d243d.lib
Release Additional Dependencies (same thing but without 'd' at the end):
opencv_core243.lib
opencv_imgproc243.lib
opencv_highgui243.lib
opencv_ml243.lib
opencv_video243.lib
opencv_features2d243.lib
opencv_calib3d243.lib

#include <opencv\highgui.h>
#include <opencv\cv.h>
#include <iostream>
using namespace cv;
using namespace std;
string intToString(int number){
std::stringstream ss;
ss << number;

return ss.str();
}
int main(int argc, char* argv[])
{
VideoCapture cap(0); // open the video camera no. 0
if (!cap.isOpened()) // if not success, exit program
{
cout << "ERROR INITIALIZING VIDEO CAPTURE" << endl;
return -1;
}
char* windowName = "Webcam Feed";
namedWindow(windowName,CV_WINDOW_AUTOSIZE); //create a window to display
our webcam feed
while (1) {
Mat frame;
bool bSuccess = cap.read(frame); // read a new frame from camera
feed
if (!bSuccess) //test if frame successfully read
{
cout << "ERROR READING FRAME FROM CAMERA FEED" << endl;
break;
}
imshow(windowName, frame); //show the frame in "MyVideo" window
//listen for 10ms for a key to be pressed
switch(waitKey(10)){
case 27:
//'esc' has been pressed (ASCII value for 'esc' is 27)
//exit program.
return 0;
}
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////
////////////

#include <opencv\highgui.h>
#include <opencv\cv.h>
#include <iostream>
using namespace cv;
using namespace std;
string intToString(int number){
std::stringstream ss;
ss << number;
return ss.str();
}
int main(int argc, char* argv[])
{
VideoCapture cap(0); // open the video camera no. 0
cv::VideoWriter writer;
if (!cap.isOpened()) // if not success, exit program
{
cout << "ERROR INITIALIZING VIDEO CAPTURE" << endl;
return -1;
}
char* windowName = "Webcam Feed";
namedWindow(windowName,CV_WINDOW_AUTOSIZE); //create a window to display
our webcam feed
//filename string
string filename = "D:\myVideo.avi";
//fourcc integer
int fcc = CV_FOURCC('D','I','V','3');
//frames per sec integer
int fps = 10;
//frame size

cv::Size frameSize(cap.get(CV_CAP_PROP_FRAME_WIDTH),cap.get(CV_CAP_PROP_
FRAME_HEIGHT));
writer = VideoWriter(filename,fcc,fps,frameSize);
if(!writer.isOpened()){
cout<<"ERROR OPENING FILE FOR WRITE"<<endl;
getchar();
return -1;
}
Mat frame;
while (1) {

bool bSuccess = cap.read(frame); // read a new frame from camera


feed
if (!bSuccess) //test if frame successfully read
{
cout << "ERROR READING FRAME FROM CAMERA FEED" << endl;
break;
}
writer.write(frame);
imshow(windowName, frame); //show the frame in "MyVideo" window
//listen for 10ms for a key to be pressed
switch(waitKey(10)){
case 27:
//'esc' has been pressed (ASCII value for 'esc' is 27)
//exit program.
return 0;
}
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////
////////////

You might also like