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 43 44 45
|
// fct qui repmlie la matrice tabseq du fd -> ff ( N°frame,%gazon ,type(1/0))
tabseq remplirmat( QString ch,int fd,int ff)
{
CvCapture *capture ; IplImage *frame; int key;tabseq ts={0};
capture = cvCaptureFromAVI(ch.toUtf8().constData());
int fps = ( int )cvGetCaptureProperty( capture, CV_CAP_PROP_FPS );
int j=0;
cvGrabFrame(capture);
frame= cvRetrieveFrame(capture);
int k=cvSetCaptureProperty( capture, 1,fd );
while( key != 'q' )
{
if(fd==ff) break ;
frame = cvQueryFrame( capture );
if (fd%10==0)
{
if( !frame ) break;
float gr=grassratio(frame);
ts.t[j][0]=fd;
ts.t[j][1]=(int)gr;
if((int)gr<=10)
ts.t[j][2]=1;
else
ts.t[j][2]=0;
j++ ;
}
fd++;
key = cvWaitKey( 1000 / fps );
}
cvReleaseCapture( &capture );
return(ts);
} |
Partager