![]() array ( frames_bg ), 50, axis = 0 ) # MASK GENERATION def make_mask_frame ( t ): """ Computes the mask for the frame at time t """ # THRESHOLD THE PIXEL-TO-PIXEL DIFFERENCE # BETWEEN THE FRAME AND THE BACKGROUND im = pigsPolka. # I must have spent half an hour to find the right set of frames. crop ( x1 = 140, y1 = 41, x2 = 454, y2 = 314 )) # COMPUTE THE BACKGROUND # There is no single frame showing the background only (there # is always a little pig in the screen) so we use the median of # several carefully chosen frames to reconstitute the background. # Requires Scikit Images installed import numpy as np import skimage.morphology as skm import skimage.filter as skf from moviepy.editor import * # LOAD THE CLIP pigsPolka = ( VideoFileClip ( "pigs_in_a_polka.mp4" )). This way the end of the clip really is the beginning of the clip. to make the clip play once forwards, then once backwards. A way to avoid this is to time-symetrize the clip, i.e. As a consequence, you could see a disruption every time the animation was restarted. Surely you have noticed that in the previous GIFs, the end did not always look like the beginning. write_gif ( 'anna_kris.gif', fps = 15, fuzz = 3 ) speedx ( 0.2 ) # 'fuzz' (0-100) below is for gif compression composition. set_mask ( ImageClip ( mask, ismask = True )) composition = CompositeVideoClip (). ![]() 5 )) # coordinates p1,p2 define the edges of the mask mask = dw. ![]() Import as dw anna_kris = ( VideoFileClip ( "frozen_trailer.mp4", audio = False ). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |