#NEWLINE# def combine_pyramid_and_save( g_video , orig_video , enlarge_multiple , fps , save_filename = 'media/output.avi' ) : #NEWLINE# #INDENT# 'Combine a gaussian video representation with the original and save to file' #NEWLINE# ( width , height ) = get_frame_dimensions ( orig_video [ 0 ] ) #NEWLINE# fourcc = cv2 . VideoWriter_fourcc ( * 'MJPG' ) #NEWLINE# print ( ( 'Outputting to %s' % save_filename ) ) #NEWLINE# writer = cv2 . VideoWriter ( save_filename , fourcc , fps , ( width , height ) , 1 ) #NEWLINE# for x in range ( 0 , g_video . shape [ 0 ] ) : #NEWLINE# #INDENT# img = numpy . ndarray ( shape = g_video [ x ] . shape , dtype = 'float' ) #NEWLINE# img [ : ] = g_video [ x ] #NEWLINE# for i in range ( enlarge_multiple ) : #NEWLINE# #INDENT# img = cv2 . pyrUp ( img ) #NEWLINE# #UNINDENT# img [ : height , : width ] = ( img [ : height , : width ] + orig_video [ x ] ) #NEWLINE# res = cv2 . convertScaleAbs ( img [ : height , : width ] ) #NEWLINE# writer . write ( res )