forked from p-szm/posenet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
blend.py
28 lines (21 loc) · 813 Bytes
/
blend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import argparse
import glob
import os
import sys
from posenet.utils import progress_bar
parser = argparse.ArgumentParser()
parser.add_argument('dir1')
parser.add_argument('dir2')
parser.add_argument('output_dir')
args = parser.parse_args()
files1 = glob.glob('{}/*.png'.format(args.dir1))
files2 = glob.glob('{}/*.png'.format(args.dir2))
if not all(os.path.basename(files1[i]) == os.path.basename(f) for i, f in enumerate(files2)):
print('Files don\'t match')
sys.exit(1)
if not os.path.exists(args.output_dir):
os.makedirs(args.output_dir)
for i, f in enumerate(files1):
out = os.path.join(args.output_dir, os.path.basename(files1[i]))
os.system('convert {} {} -evaluate-sequence mean {}'.format(files1[i], files2[i], out))
# To colorise: convert image.png +level-colors "red", red.png