import os from options.test_options import TestOptions from shutil import move, copyfile from PIL import Image, ImageOps from shutil import copyfile, rmtree import numpy as np import cv2 import subprocess from time import sleep if __name__ == '__main__': opt = TestOptions().parse() opt.nThreads = 1 # test code only supports nThreads = 1 opt.batchSize = 1 # test code only supports batchSize = 1 opt.serial_batches = True # no shuffle opt.no_flip = True # no flip opt.experiment = opt.start_img.split("/")[-1].split(".")[0] render_dir = opt.results_dir + opt.name + "/exp:" + opt.experiment + "/" if os.path.exists(render_dir): rmtree(render_dir) mkdirs(render_dir) pil_image = Image.open(opt.start_img).convert('RGB') opencv_image = np.array(pil_image) opencv_image = opencv_image[:, :, ::-1].copy() opencv_image = cv2.GaussianBlur(opencv_image, (3,3), 1) opencv_image = cv2.Canny(opencv_image, 100, 200) cv2.imwrite(render_dir + "frame_00000.png", opencv_image)