Skip to content

Instantly share code, notes, and snippets.

Last active January 5, 2022 18:05
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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