Last active
January 5, 2022 18:05
-
-
Save nicoptere/971d85d030ef23a730eefab65e2368ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import cv2 | |
import numpy as np | |
folder = "./cat/" | |
files = os.listdir(folder) | |
files.sort( ) | |
dst = np.ones( (143,143), np.float ) | |
for i, (f) in enumerate( files ): | |
img = cv2.imread(folder + f, cv2.IMREAD_UNCHANGED) | |
img = cv2.cvtColor( img, cv2.COLOR_BGR2GRAY ) | |
w = img.shape[1] | |
h = img.shape[0] | |
for x in range( 0, w, len( files ) ): | |
sx = i + x | |
dst[ 0:h, sx:sx +1 ] = img[0:h, x:x+1] | |
cv2.imwrite( 'out.png', dst) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment