Last active
January 5, 2022 18:05
-
-
Save nicoptere/971d85d030ef23a730eefab65e2368ad to your computer and use it in GitHub Desktop.
Revisions
-
nicoptere renamed this gist
Jan 2, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nicoptere created this gist
Jan 2, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ 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)