Last active
August 9, 2018 05:12
-
-
Save p-geon/ec9d3650359701f9fdcc3ddd61fb4584 to your computer and use it in GitHub Desktop.
This file contains 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 characters
from tqdm import tqdm | |
import numpy as np | |
from skimage.io import imread, imsave | |
win_h = win_w = 640 | |
orig = imread(fname="image_A.png") | |
ours = imread(fname="image_B.png") | |
def main(): | |
for i in tqdm(range(1)): | |
h_bias, w_bias = np.random.randint(0, orig.shape[0]-win_h), np.random.randint(0, orig.shape[1]-win_w) | |
crop_orig = orig[h_bias:h_bias+win_h, w_bias:w_bias+win_w] | |
crop_ours = ours[h_bias:h_bias+win_h, w_bias:w_bias+win_w] | |
conc = np.concatenate([crop_orig, crop_ours], axis=1) | |
imsave(fname=f"./cropped/crop_{i:03d}_ours.png", arr=crop_ours) | |
imsave(fname=f"./cropped/crop_{i:03d}_orig.png", arr=crop_orig) | |
imsave(fname=f"./cropped/crop_{i:03d}_compare.png", arr=conc) | |
if __name__ == "__main__": | |
main(); print("\007") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment