File size: 823 Bytes
8ea8b32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import json, numpy as np, sys
sys.path.insert(0,'/workspaces/studio')
import render as R
items=json.load(open('/workspaces/studio/items.json'))
for k,it in enumerate(items,1):
    c=R.Clip(it,k,9,'/tmp/work/zi/06_7.webp','/tmp/work/chk/'+it['id'])
    for name,t in [('q',0.2),('typing',c.T['done']-0.1),('final',c.dur-0.05)]:
        ch=int(round(c.card_h(t)))
        a=np.asarray(c.content(t,int(t*30),ch).getchannel('A'))
        rows=(a>20).any(axis=1); cols=np.where((a>20).any(axis=0))[0]
        bands=[];s=None
        for y,v in enumerate(rows):
            if v and s is None: s=y
            if not v and s is not None: bands.append((s,y)); s=None
        if s is not None: bands.append((s,len(rows)))
        print(it['id'],name,'h',ch,'x',cols.min(),cols.max(),'bands',bands)
    print(' dur',round(c.dur,2))