Files
Litcraft_Python_B/create_mask_from_png.py

24 lines
616 B
Python

import cv2 as cv
import os
import numpy as np
from window_capture import WindowCapture
from config_file import UserConfigs
#uc = UserConfigs()
#wc = WindowCapture(None, None, uc)
#screen = wc.get_screenshot(False)
# load the original input image and display it to our screen
#filename = "equip/chests/chest_23_32"
path = "flappy/"
os.chdir(path)
for entry in os.listdir():
if entry.endswith('.png'):
nelk = entry[:len(entry)-4]
if nelk.find('-mask') == -1:
out = nelk + "-mask.png"
img = cv.imread(entry, cv.IMREAD_UNCHANGED)
cv.imwrite(out, img[:, :, 3])