TA的每日心情 | 开心 2019-9-8 20:55 |
---|
签到天数: 874 天 [LV.10]以坛为家III
至尊会员
- 积分
- 231928
|
本帖最后由 Blue_Smith 于 2017-6-12 13:54 编辑
目前想到了一个简单的办法,就是手动制作一个左半部分是纯黑、右半部分是纯白的 mask。实现如下:- def Merge(clip1, clip2):
- halfWidth = clip1.width >> 1
- max = (1 << clip1.format.bits_per_sample) - 1
- neutral = (max >> 1) + 1;
- black = [0, neutral, neutral] #black in 8 bit yuv pc range is [0, 128, 128]
- white = [max, neutral, neutral] #white in 8 bit yuv pc range is [255, 128, 128]
- mask = core.std.BlankClip(clip1, width=halfWidth, height=clip1.height, color=black)
- mask = core.std.AddBorders(mask, left=0, right=clip1.width-halfWidth, top=0, bottom=0, color=white)
- merge = core.std.MaskedMerge(clip1, clip2, mask, planes=[0, 1, 2], first_plane=True)
- return core.text.Text(merge, text="svp", alignment=7).text.Text(text="repeat count", alignment=9)
复制代码 |
|