def testHomographies(self): ilog = None # pv.ImageLog() flow = pv.OpticalFlow() video = pv.Video(TAZ_VIDEO) i = 0 prev_frame = None for frame in video: flow.update(frame) flow.annotateFrame(frame) if ilog != None: print("Processing Frame:", i) if hasattr(frame, 'to_prev'): prev_im = frame.to_prev(frame) ilog(prev_im, 'back', format='jpg') if prev_frame != None: forward_im = prev_frame.to_next(prev_frame) ilog(forward_im, 'forward', format='jpg') ilog(frame, "current", format='jpg') i += 1 if i > 10: break prev_frame = frame if ilog != None: ilog.show()
def testOpticalFlow(self): ilog = None # pv.ImageLog() flow = pv.OpticalFlow() video = pv.Video(TAZ_VIDEO) i = 0 for frame in video: flow.update(frame) flow.annotateFrame(frame) if ilog != None: print("Processing Frame:", i) ilog(frame, format='jpg') i += 1 if i > 10: break if ilog != None: ilog.show()
def __init__(self, imageBuffer, thresh=20, soft_thresh=False): AbstractBGModel.__init__(self, imageBuffer, thresh, soft_thresh) self._flow = pv.OpticalFlow() if imageBuffer.isFull(): self._initFlow() #if a non-full buffer is given, then we