mergeImages.py (478B)
1 ###### Based on: http://stackoverflow.com/a/7589374/4929236 ##### 2 3 import cv2 4 import numpy as np 5 import os 6 7 x = 0 8 dir_count = len([name for name in os.listdir('./pages') if os.path.isfile(name)]) 9 10 for file in os.listdir("./pages"): 11 if file.endswith(".jpg"): 12 img = cv2.imread(file) 13 if x > 0: 14 if x+1 != dir_count: 15 vis = np.concatenate((last_img, img), axis=0) 16 cv2.imwrite('out.png', vis) 17 last_img = img 18 x += 1