1 | initial version |
since you're just starting with opencv, try to avoid the old c-api, support for that is fading away quickly. try to use proper c++ for this, avoid IplImages and cv*Functions in general:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
using namespace cv;
int main()
{
VideoCapture cap(0);
if ( ! cap.isOpened() )
return;
Size size( cap.get(CV_CAP_PROP_FRAME_WIDTH) / 2,
cap.get(CV_CAP_PROP_FRAME_HEIGHT) / 2 );
Mat frame;
while ( cap.read(frame) )
{
imshow("lalala",frame);
int k = waitKey(10);
if ( k==27 )
break;
}
return 0;
}
2 | No.2 Revision |
since you're just starting with opencv, try to avoid the old c-api, support for that is fading away quickly. try to use proper c++ for this, avoid IplImages and cv*Functions in general:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
using namespace cv;
int main()
{
VideoCapture cap(0);
if ( ! cap.isOpened() )
return;
Size size( cap.get(CV_CAP_PROP_FRAME_WIDTH) / 2,
cap.get(CV_CAP_PROP_FRAME_HEIGHT) / 2 );
Mat frame;
while ( 1 )
{
if ( cap.read(frame) )
{
// processing here
imshow("lalala",frame);
}
int k = waitKey(10);
if ( k==27 )
break;
}
return 0;
}
3 | No.3 Revision |
since you're just starting with opencv, try to avoid the old c-api, support for that is fading away quickly. try to use proper c++ for this, avoid IplImages and cv*Functions in general:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
using namespace cv;
int main()
{
VideoCapture cap(0);
if ( ! cap.isOpened() )
return;
Size size( cap.get(CV_CAP_PROP_FRAME_WIDTH) / 2,
cap.get(CV_CAP_PROP_FRAME_HEIGHT) / 2 );
Mat frame;
while ( 1 )
{
if ( cap.read(frame) )
{
// processing here
imshow("lalala",frame);
}
int k = waitKey(10);
if ( k==27 )
) // 'esc' pressed
break;
}
return 0;
}