From 5edd1efbc7b3c02d16b23401cc47a88f50fdf4d5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 1 May 2018 22:43:23 +0200 Subject: test canny? --- canny-cv.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'canny-cv.py') diff --git a/canny-cv.py b/canny-cv.py index df4526a..f8b5dc3 100644 --- a/canny-cv.py +++ b/canny-cv.py @@ -63,12 +63,14 @@ if __name__ == '__main__': img_path = model.get_image_paths() print('%04d: process image... %s' % (i, img_path)) ims = visualizer.save_images(webpage, visuals, img_path, aspect_ratio=opt.aspect_ratio) + + im = visuals['fake_B'] + tmp_path = render_dir + "frame_{:05d}_tmp.png".format(i+1) + edges_path = render_dir + "frame_{:05d}.png".format(i+1) + render_path = render_dir + "ren_{:05d}.png".format(i+1) + if dataset.name() == 'RecursiveDatasetDataLoader': # print(visuals.keys()) - im = visuals['fake_B'] - tmp_path = render_dir + "frame_{:05d}_tmp.png".format(i+1) - edges_path = render_dir + "frame_{:05d}.png".format(i+1) - render_path = render_dir + "ren_{:05d}.png".format(i+1) # s = 256 # p = 8 # im = imresize(im, (s-p, s-p), interp='bicubic') @@ -92,15 +94,16 @@ if __name__ == '__main__': image_pil.save(tmp_path) os.rename(tmp_path, render_path) - image_pil = Image.fromarray(im, mode='RGB') - image_pil = crop_image(image_pil, (0.50, 0.50), 0.5) - im = np.asarray(image_pil).astype('uint8') - #print(im.shape, im.dtype) - opencv_image = im[:, :, ::-1].copy() - opencv_image = cv2.GaussianBlur(opencv_image, (blur,blur), sigma) - opencv_image = cv2.Canny(opencv_image, canny_lo, canny_hi) - cv2.imwrite(tmp_path, opencv_image) - os.rename(tmp_path, edges_path) + image_pil = Image.fromarray(im, mode='RGB') + image_pil = crop_image(image_pil, (0.50, 0.50), 0.5) + im = np.asarray(image_pil).astype('uint8') + #print(im.shape, im.dtype) + opencv_image = im[:, :, ::-1].copy() + opencv_image = cv2.GaussianBlur(opencv_image, (blur,blur), sigma) + opencv_image = cv2.Canny(opencv_image, canny_lo, canny_hi) + cv2.imwrite(tmp_path, opencv_image) + os.rename(tmp_path, edges_path) + webpage.save() -- cgit v1.2.3-70-g09d2