Untitled
unknown
plain_text
4 years ago
668 B
6
Indexable
path = "paper-materials/presentation" img = cv2.imread(f"{path}/doge.jpg", -1) / 255.0 h, w = img.shape[:-1] h //= 16 w //= 16 img = cv2.resize(img, (w, h)) ratio = 2 mask = np.zeros(img.shape, dtype=bool) mask[::ratio, ::ratio] = True masked_hr = img.copy() masked_hr[mask] = 0 lr = cv2.resize(img[::ratio, ::ratio], (w, h), interpolation=cv2.INTER_NEAREST) masked_val = lr.copy() masked_val[mask] = 0 save_img("dog_lr.png", path, img) save_img("lr.png", path, lr) save_img("mask.png", path, mask) save_img("masked_val.png", path, masked_val) save_img("onem_mask.png", path, 1 - mask)
Editor is loading...