(augs)
To extract dense_flow images
    :param augs:the detailed augments:
        video_name: the video name which is like: 'v_xxxxxxx',if different ,please have a modify.
        save_dir: the destination path's final direction name.
        step: num of frames between each two extracted frames
        bound: bi-bound parameter
    :return: no returns
To extract dense_flow images
    :param augs:the detailed augments:
        video_name: the video name which is like: 'v_xxxxxxx',if different ,please have a modify.
        save_dir: the destination path's final direction name.
        step: num of frames between each two extracted frames
        bound: bi-bound parameter
    :return: no returns
To extract dense_flow images : param augs : the detailed augments : video_name : the video name which is like : v_xxxxxxx if different please have a modify . save_dir : the destination path s final direction name . step : num of frames between each two extracted frames bound : bi - bound parameter : return : no returns
def dense_flow(augs):
    '''
    To extract dense_flow images
    :param augs:the detailed augments:
        video_name: the video name which is like: 'v_xxxxxxx',if different ,please have a modify.
        save_dir: the destination path's final direction name.
        step: num of frames between each two extracted frames
        bound: bi-bound parameter
    :return: no returns
    '''
    video_name,save_dir,step,bound=augs
    video_path=os.path.join(videos_root,video_name.split('_')[1],video_name)

    # provide two video-read methods: cv2.VideoCapture() and skvideo.io.vread(), both of which need ffmpeg support

    # videocapture=cv2.VideoCapture(video_path)
    # if not videocapture.isOpened():
    #     print 'Could not initialize capturing! ', video_name
    #     exit()
    try:
        videocapture=skvideo.io.vread(video_path)
    except:
        print '{} read error! '.format(video_name)
        return 0
    print video_name
    # if extract nothing, exit!
    if videocapture.sum()==0:
        print 'Could not initialize capturing',video_name
        exit()
    len_frame=len(videocapture)
    frame_num=0
    image,prev_image,gray,prev_gray=None,None,None,None
    num0=0
    while True:
        #frame=videocapture.read()
        if num0>=len_frame:
            break
        frame=videocapture[num0]
        num0+=1
        if frame_num==0:
            image=np.zeros_like(frame)
            gray=np.zeros_like(frame)
            prev_gray=np.zeros_like(frame)
            prev_image=frame
            prev_gray=cv2.cvtColor(prev_image,cv2.COLOR_RGB2GRAY)
            frame_num+=1
            # to pass the out of stepped frames
            step_t=step
            while step_t>1:
                #frame=videocapture.read()
                num0+=1
                step_t-=1
            continue

        image=frame
        gray=cv2.cvtColor(image,cv2.COLOR_RGB2GRAY)
        frame_0=prev_gray
        frame_1=gray
        ##default choose the tvl1 algorithm
        dtvl1=cv2.createOptFlow_DualTVL1()
        flowDTVL1=dtvl1.calc(frame_0,frame_1,None)
        save_flows(flowDTVL1,image,save_dir,frame_num,bound) #this is to save flows and img.
        prev_gray=gray
        prev_image=image
        frame_num+=1
        # to pass the out of stepped frames
        step_t=step
        while step_t>1:
            #frame=videocapture.read()
            num0+=1
            step_t-=1
def dense_flow ( augs ) : video_name , save_dir , step , bound = augs video_path = os . path . join ( videos_root , video_name . split ( '_' ) [ 1 ] , video_name ) # provide two video-read methods: cv2.VideoCapture() and skvideo.io.vread(), both of which need ffmpeg support # videocapture=cv2.VideoCapture(video_path) # if not videocapture.isOpened(): #     print 'Could not initialize capturing! ', video_name #     exit() try : videocapture = skvideo . io . vread ( video_path ) except : print '{} read error! ' . format ( video_name ) return 0 print video_name # if extract nothing, exit! if videocapture . sum ( ) == 0 : print 'Could not initialize capturing' , video_name exit ( ) len_frame = len ( videocapture ) frame_num = 0 image , prev_image , gray , prev_gray = None , None , None , None num0 = 0 while True : #frame=videocapture.read() if num0 >= len_frame : break frame = videocapture [ num0 ] num0 += 1 if frame_num == 0 : image = np . zeros_like ( frame ) gray = np . zeros_like ( frame ) prev_gray = np . zeros_like ( frame ) prev_image = frame prev_gray = cv2 . cvtColor ( prev_image , cv2 . COLOR_RGB2GRAY ) frame_num += 1 # to pass the out of stepped frames step_t = step while step_t > 1 : #frame=videocapture.read() num0 += 1 step_t -= 1 continue image = frame gray = cv2 . cvtColor ( image , cv2 . COLOR_RGB2GRAY ) frame_0 = prev_gray frame_1 = gray ##default choose the tvl1 algorithm dtvl1 = cv2 . createOptFlow_DualTVL1 ( ) flowDTVL1 = dtvl1 . calc ( frame_0 , frame_1 , None ) save_flows ( flowDTVL1 , image , save_dir , frame_num , bound ) #this is to save flows and img. prev_gray = gray prev_image = image frame_num += 1 # to pass the out of stepped frames step_t = step while step_t > 1 : #frame=videocapture.read() num0 += 1 step_t -= 1