Skip to content

Instantly share code, notes, and snippets.

@nicoptere
Last active January 5, 2022 18:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicoptere/971d85d030ef23a730eefab65e2368ad to your computer and use it in GitHub Desktop.
Save nicoptere/971d85d030ef23a730eefab65e2368ad to your computer and use it in GitHub Desktop.
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