Exemple #1
0
# to a file, it must be commented once the tracking has been done
# (after the first run of the script for instance).
# Note that we save the list (ti,xi,yi), not the functions fx and fy
# (that we will need) because they have dependencies.

#txy, (fx,fy) = manual_tracking(clip, fps=6)
#with open("../../chaplin_txy.dat",'w+') as f:
#    pickle.dump(txy)



# IF THE MANUAL TRACKING HAS BEEN PREVIOUSLY DONE,
# LOAD THE TRACKING DATA AND CONVERT IT TO FUNCTIONS x(t),fy(t)

with open("../../chaplin_txy.dat",'r') as f:
    fx,fy = to_fxfy( pickle.load(f) )


# BLUR CHAPLIN'S HEAD IN THE CLIP

clip_blurred = clip.fx( vfx.headblur, fx, fy, 25)


# Generate the text, put in on a grey background

txt = TextClip("Hey you ! \n You're blurry!", color='grey70',
               size = clip.size, bg_color='grey20',
               font = "Century-Schoolbook-Italic", fontsize=40)
               
               
# Concatenate the Chaplin clip with the text clip, add audio
Exemple #2
0
# 手动跟踪标记头部
 
# 下面的三行代码,手动跟踪,然后把结果保存进文件,应该在一次运行之后就完成量跟踪标记
# 注意:我们保存的格式是一个(ti,xi,yi)list,不是函数fx和fy
 
#txy, (fx,fy) = manual_tracking(clip, fps=6)
#with open("../../chaplin_txy.dat",'w+') as f:
#    pickle.dump(txy)
 
 
 
# 已经完成手动跟踪人脸并标记的情况下
# fx(t),fy(t)的形式加载跟踪标记的数据
 
with open("../../chaplin_txy.dat",'r') as f:
    fx,fy = to_fxfy( pickle.load(f) )
 
 
# 在clip中,模糊卓别林的头部
 
clip_blurred = clip.fx( vfx.headblur, fx, fy, 25)
 
 
# 生成文本,灰色背景
 
txt = TextClip("Hey you ! \n You're blurry!", color='grey70',
               size = clip.size, bg_color='grey20',
               font = "Century-Schoolbook-Italic", fontsize=40)
               
               
# 把卓别林的vedio clip和TextClip连接起来,添加audio clip
Exemple #3
0
# the three next lines are for the manual tracking and its saving
# to a file, it must be commented once the tracking has been done
# (after the first run of the script for instance).
# Note that we save the list (ti,xi,yi), not the functions fx and fy
# (that we will need) because they have dependencies.

# txy, (fx,fy) = manual_tracking(clip, fps=6)
# with open("../../chaplin_txy.dat",'w+') as f:
#    pickle.dump(txy)

# IF THE MANUAL TRACKING HAS BEEN PREVIOUSLY DONE,
# LOAD THE TRACKING DATA AND CONVERT IT TO FUNCTIONS x(t),fy(t)

with open("../../chaplin_txy.dat", "r") as file:
    fx, fy = to_fxfy(pickle.load(file))

# BLUR CHAPLIN'S HEAD IN THE CLIP

clip_blurred = clip.fx(vfx.headblur, fx, fy, 25)

# Generate the text, put in on a grey background

txt = TextClip(
    "Hey you! \n You're blurry!",
    color="grey70",
    size=clip.size,
    bg_color="grey20",
    font="Century-Schoolbook-Italic",
    font_size=40,
)