Skip to content

Instantly share code, notes, and snippets.

@nicoptere
Last active January 5, 2022 18:05
Show Gist options
  • Select an option

  • Save nicoptere/971d85d030ef23a730eefab65e2368ad to your computer and use it in GitHub Desktop.

Select an option

Save nicoptere/971d85d030ef23a730eefab65e2368ad to your computer and use it in GitHub Desktop.

Revisions

  1. nicoptere renamed this gist Jan 2, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. nicoptere created this gist Jan 2, 2022.
    16 changes: 16 additions & 0 deletions scanner.py
    Original 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)