tracking/utils.py
def save_video(source, output_name='output.avi'):
    """save a video from a source channel

    Arguments:
        source {int or str} -- camera source or path of video
    """

    import numpy as np
    import cv2

    cap = cv2.VideoCapture(source)

    # Define the codec and create VideoWriter object
    #fourcc = cv2.cv.CV_FOURCC(*'DIVX')
    #out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))
    out = cv2.VideoWriter(output_name, -1, 20.0, (640,480))

    while(cap.isOpened()):
        ret, frame = cap.read()
        if ret==True:
            frame = cv2.flip(frame,0)

            # write the flipped frame
            out.write(frame)

            cv2.imshow('frame',frame)
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
        else:
            break

    # Release everything if job is finished
    cap.release()
    out.release()
    cv2.destroyAllWindows()
    return()
save a video from a source channel

    Arguments:
        source {int or str} -- camera source or path of video
    
save a video from a source channel
Arguments:
source {int or str} -- camera source or path of video
save a video from a source channel Arguments : source { int or str } -- camera source or path of video
def save_video(source, output_name='output.avi'):
    import numpy as np
    import cv2
    cap = cv2.VideoCapture(source)
    out = cv2.VideoWriter(output_name, -1, 20.0, (640,480))
    while(cap.isOpened()):
        ret, frame = cap.read()
        if ret==True:
            frame = cv2.flip(frame,0)
            out.write(frame)
            cv2.imshow('frame',frame)
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
        else:
            break
    cap.release()
    out.release()
    cv2.destroyAllWindows()
    return()
def save_video ( source , output_name = 'output.avi' ) : import numpy as np import cv2 cap = cv2 . VideoCapture ( source ) out = cv2 . VideoWriter ( output_name , - 1 , 20.0 , ( 640 , 480 ) ) while ( cap . isOpened ( ) ) : ret , frame = cap . read ( ) if ret == True : frame = cv2 . flip ( frame , 0 ) out . write ( frame ) cv2 . imshow ( 'frame' , frame ) if cv2 . waitKey ( 1 ) & 0xFF == ord ( 'q' ) : break else : break cap . release ( ) out . release ( ) cv2 . destroyAllWindows ( ) return ( )
save a video from a source channel
Arguments:
source {int or str} -- camera source or path of video
save a video from a source channel Arguments : source { int or str } -- camera source or path of video
"""save a video from a source channel

    Arguments:
        source {int or str} -- camera source or path of video
    """ # Define the codec and create VideoWriter object #fourcc = cv2.cv.CV_FOURCC(*'DIVX') #out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480)) # write the flipped frame # Release everything if job is finished
source
output_name