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()
Forwarded from 是One's dream
使用requests 自定义 headers 可以让参数在文件内自己读取么
该怎么写
该怎么写
Forwarded from dnaugsuz
with open("my_cfg.txt", "r") as cfgf:
confg = dict(tuple(line.split("=")) for line in cfgf.readlines()) See:
dict(tuple(line.split("=")) for line in "a=1\nb=2".split("\n") ) #{'a': '1', 'b': '2'}Forwarded from dnaugsuz
当然也可以
text = "a=1\nb=2"
#{'a': '1', 'b': '2'}
text = "a=1\nb=2"
dict( (k,v) for k, v in map(lambda line: line.split("="), text.split("\n")) ) #{'a': '1', 'b': '2'}
Forwarded from 是One's dream
dict(tuple(line.split("=")) for line in "a=1\nb=2".split("\n") )