Created
          July 7, 2023 06:34 
        
      - 
      
- 
        Save agness/d85cf2655567c0c331ff90c573dcbdf2 to your computer and use it in GitHub Desktop. 
Revisions
- 
        agness created this gist Jul 7, 2023 .There are no files selected for viewingThis 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,31 @@ #!/usr/bin/env python3 # Combines an array of image files into one bitmap with union (logical OR). # Requirements # pip3 install opencv-python import cv2 import numpy as np infiles = [ 'colour-7.png', 'colour-8.png', 'colour-9.png' ] outfile = 'colour-789.png' o = None for i in infiles: im = cv2.imread(i,cv2.IMREAD_GRAYSCALE) # load image p = np.array(im) >= 255 # binarize print(f'Opening file {i}:') print(p) if (o is None): o = p else: o = p + o # Logical OR # Save to outfile. cv2.imwrite(outfile, o * 255) print(f'Wrote file {outfile}.')