Ejemplo n.º 1
0
 def push(self,imgcurr):
     if (self.imgprev==None):
         self.imgprev=imgcurr.copy()
     assert(self.imgprev.shape==imgcurr.shape)
     criteria=zcv.cvTermCriteria( zcv.CV_TERMCRIT_EPS+zcv.CV_TERMCRIT_ITER,self.maxiter,self.eps)
     zcv.cvCalcOpticalFlowHS( self.imgprev, imgcurr, self.use_previous, self.imgvelx, self.imgvely, self.lambdav, criteria );
     self.imgprev=imgcurr.copy()
     return numpy.dstack([self.imgvelx,self.imgvely])
Ejemplo n.º 2
0
 def push(self,imgcurr):
     if (not self.imgprev):
         self.imgprev=imgcurr
     assert(self.imgprev.shape==imgcurr.shape)
     prevpyr=NumPy2XIplFast(self.imgprev)
     currpyr=NumPy2XIplFast(imgcurr)
     prevfeatures=NumPy2XIplFast(self.imgprev)
     currfeatures=NumPy2XIplFast(imgcurr)
     count=0
     criteria=zcv.cvTermCriteria( zcv.CV_TERMCRIT_EPS+zcv.CV_TERMCRIT_ITER,10,1.0)
     velx=NumPy2XIplFast(self.imgvel[0])
     vely=NumPy2XIplFast(self.imgvel[1])
     zcv.cvCalcOpticalFlowPyrLK( self.imgprev, imgcurr, self.use_previous, velx, vely, self.lambdav, criteria );
     self.imgprev=imgcurr
     return self.imgvel