Forwarded from dnaugsuz
做…什么? extract subtitle 还是 text montage 生成
Forwarded from dnaugsuz
这个不支持 HTML,后端是 PIL
自定义字库因为 PIL 是支持的,但一般绘制效率不怎么样,只有 14fps 左右
提升效率比较困难,因为 OpenCV 不支持自定义字体,所以只能 C++ 再加上 freetype 之类的栅格化库来弄
ImageDraw.text 但总体抽象还好,是通过 solveLayout / solveItemColors 可以算出 (x, y, color) 的 Iterable自定义字库因为 PIL 是支持的,但一般绘制效率不怎么样,只有 14fps 左右
提升效率比较困难,因为 OpenCV 不支持自定义字体,所以只能 C++ 再加上 freetype 之类的栅格化库来弄
Forwarded from 任桑 今天开始做魔王
大概做法是按分辨率区间,把图片转存一个二维矩阵,然后计算每个元素的熵,从熵匹配到文字
Forwarded from dnaugsuz
是的,但我没做这方面的工作,都是
scipy.signal.argrelextrma 直接拿 indices 的peakutils 也可以用,不过我测试了效果不好Forwarded from dnaugsuz
总体来看关键帧提取效果还可以,只不过经常提取多了,一些死嵌字幕的视频不至于漏掉起止点的程度
Forwarded from dnaugsuz
支持先自动提取关键帧,然后再自动合并,手工分拣,再自动 unpack 回多文件的模式
这个模式不需要提取关键帧因为早就提取好了
./vcat_subtitle_imgs.py
./extract_subtitles.py -h
……
这个模式不需要提取关键帧因为早就提取好了
./vcat_subtitle_imgs.py
Usage: dst src... | unpack dst
./extract_subtitles.py -h
……
--only-images use frame images from --crop-debug as inputForwarded from dnaugsuz
我们这个是给定一个 seq: iter,然后手动 next(seq) 的
目的大概是允许对抽象的「可给一个位置、颜色在图像上画的东西」都能被使用
至于是否能直接对色块,提取绘制项目的话还是不行的(目前是只能提取绘制颜色,我用这个特效实现不绘制背景色)
不过实现也很简单啊,毕竟只用修改
目的大概是允许对抽象的「可给一个位置、颜色在图像上画的东西」都能被使用
至于是否能直接对色块,提取绘制项目的话还是不行的(目前是只能提取绘制颜色,我用这个特效实现不绘制背景色)
不过实现也很简单啊,毕竟只用修改
drawTextMontage(img, areas, font, draw_color) 就好了t0 = time()#Python #code
t1 = None
def nextPitch():
try: return next(pitchz)
except StopIteration: raise NonlocalReturn("done")
def doSplit():
synth.noteSwitch(nextPitch())
def giveSegment():
nonlocal t1
t2 = time()
reducer.accept( (t1-t0, t2-t0, synth.last_pitch) )
t1 = t2 #< new start
def onEvent(event):
nonlocal t1
if event.type == pygame.KEYDOWN:
key = chr(event.key)
if key == 'a':
t1 = time()
doSplit()
elif key == 's': giveSegment(); doSplit()
elif event.type == pygame.KEYUP:
key = chr(event.key)
if key == 'a':
synth.noteoff()
giveSegment()
elif key == ' ': onPausePlay()