fix curly braces, don't create directory on launch
This commit is contained in:
parent
5f0281f14f
commit
1beadbdc3d
1 changed files with 2 additions and 3 deletions
5
pc.py
5
pc.py
|
@ -27,7 +27,6 @@ from PIL import Image
|
||||||
video_fn = 'The Man with the Movie Camera.mkv'
|
video_fn = 'The Man with the Movie Camera.mkv'
|
||||||
video_dn = '.'.join(video_fn.split('.')[:-1])
|
video_dn = '.'.join(video_fn.split('.')[:-1])
|
||||||
src_dn = f'{video_dn}/src'
|
src_dn = f'{video_dn}/src'
|
||||||
os.makedirs(src_dn, exist_ok=True)
|
|
||||||
|
|
||||||
m = 16 # Matrix size
|
m = 16 # Matrix size
|
||||||
m2 = m ** 2
|
m2 = m ** 2
|
||||||
|
@ -73,7 +72,7 @@ def read_images():
|
||||||
os.system(f'ffmpeg -i "{video_fn}" -q:v 1 "{src_dn}/%08d.jpg"')
|
os.system(f'ffmpeg -i "{video_fn}" -q:v 1 "{src_dn}/%08d.jpg"')
|
||||||
cell_dn = f'{src_dn}_{cell_w}x{cell_h}'
|
cell_dn = f'{src_dn}_{cell_w}x{cell_h}'
|
||||||
os.makedirs(cell_dn, exist_ok=True)
|
os.makedirs(cell_dn, exist_ok=True)
|
||||||
src_fns = [f'src_dn/{fn}' for fn in os.listdir(src_dn) if fn[0] != '.']
|
src_fns = [f'{src_dn}/{fn}' for fn in os.listdir(src_dn) if fn[0] != '.']
|
||||||
src_fns = sorted(src_fns)
|
src_fns = sorted(src_fns)
|
||||||
n = len(src_fns)
|
n = len(src_fns)
|
||||||
data_fn = f'{video_dn}/{cx}x{cy}.npy'
|
data_fn = f'{video_dn}/{cx}x{cy}.npy'
|
||||||
|
@ -104,7 +103,7 @@ def write_images(data):
|
||||||
global cache_hits
|
global cache_hits
|
||||||
dst_dn = f'{video_dn}/dst_{m}x{m}x{cx}x{cy}_{kf}'
|
dst_dn = f'{video_dn}/dst_{m}x{m}x{cx}x{cy}_{kf}'
|
||||||
os.makedirs(dst_dn, exist_ok=True)
|
os.makedirs(dst_dn, exist_ok=True)
|
||||||
src_fns = [f'src_dn/{fn}' for fn in os.listdir(src_dn) if fn[0] != '.']
|
src_fns = [f'{src_dn}/{fn}' for fn in os.listdir(src_dn) if fn[0] != '.']
|
||||||
src_fns = sorted(src_fns)
|
src_fns = sorted(src_fns)
|
||||||
n = len(src_fns)
|
n = len(src_fns)
|
||||||
tree = cKDTree(data if kf == 1 else [data[i] for i in range(0, n, kf)])
|
tree = cKDTree(data if kf == 1 else [data[i] for i in range(0, n, kf)])
|
||||||
|
|
Loading…
Reference in a new issue