1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
//
#include <cv.h>
#include <highgui.h>
#include <stdio.h>
#include <cvcam.h>
//
int frame=0;
//
void callback(IplImage* img)
{
int i,j,k,x,y;
int iwd=img->widthStep;
char *idt=img->imageData;
int channels = img->nChannels;
double t1=cvGetTickCount( );
frame++;
for (x=0;x<320;x++)
{
for (y=0;y<240;y++)
{
idt[y*iwd+x*channels]=0; // Pixel Bleu
//idt[y*iwd+x*channels+1]=0; // Pixel Vert
//idt[y*iwd+x*channels+2]=0; // Pixel Rouge
}
}
printf("Temps 1 %d %f \n",frame,cvGetTickCount( )-t1);
}
int main( int argc, char** argv )
{
int ncams = cvcamGetCamerasCount( );
cvcamSetProperty(0, CVCAM_PROP_ENABLE , CVCAMTRUE);
cvcamSetProperty(0, CVCAM_PROP_CALLBACK ,(void *)callback);
if( !cvcamInit() ) return 0;
cvcamStart();
cvWaitKey(0);
cvcamStop();
cvcamExit();
} |