def testMotionDetectFD(self): ilog = None # pv.ImageLog() md = pv.MotionDetector(method=pv.BG_SUBTRACT_FD, minArea=200) video = pv.Video(BUGS_VIDEO) i = 0 for frame in video: _ = md.detect(frame) _ = md.getStandardizedRects() _ = md.getBoundingRects() _ = md.getPolygons(return_all=True) if ilog != None: print("Processing Frame:", i) key_frame = md.getKeyFrame() md.annotateFrame(key_frame) if key_frame != None: ilog(key_frame, format='jpg') i += 1 if i > 20: break if ilog != None: ilog.show()
def testMotionDetectMCFD(self): ilog = None # pv.ImageLog() #flow = pv.OpticalFlow() #This is now encapsulated in MCFD object md = pv.MotionDetector(method=pv.BG_SUBTRACT_MCFD, minArea=200, rect_type=pv.STANDARDIZED_RECTS) video = pv.Video(TOYCAR_VIDEO) i = 0 for frame in video: #flow.update(frame) #no longer required, this is encapsulated md.detect(frame) if ilog != None: print("Processing Frame:", i) #flow.annotateFrame(frame) #this is encapsulated in the md.annotateFrame method key_frame = md.getKeyFrame() md.annotateFrame(key_frame) if key_frame != None: ilog(key_frame, format='jpg') i += 1 #if i > 20: break if ilog != None: ilog.show()