Saturday, 12 April 2014

capture webcam opencv

berikut ini program untuk capture camera webcam menggunakan library opencv....selamat mencoba

------------------------------------------------------------------------------------------------------------
#include <cv.h>
#include <highgui.h>
#include <cxcore.h>

using namespace std;
using namespace cv;


void main()
{
int key = 0;
CvCapture *capture = cvCaptureFromCAM (0);
//keluar pke keyboard ‘q’
while( key !='q' )
{
IplImage *frame = cvQueryFrame(capture);
if( !frame ) break;
cvShowImage( "colour", frame );
char c = cvWaitKey(33);
if( c == 27 ) break;
key = cvWaitKey( 0 );
}
// cvDestroyWindow( “Example2″ );
cvReleaseCapture( &capture );
//return 0;
}
------------------------------------------------------------------------------------------------------------
hasil

No comments:

Post a Comment