diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-01 22:43:23 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-01 22:43:23 +0200 |
| commit | 5edd1efbc7b3c02d16b23401cc47a88f50fdf4d5 (patch) | |
| tree | 23c985f34d7a28a0120fff68dcc42d8756ca52f3 /canny-cv.py | |
| parent | f8d0c6bd65a827be534d2d105917829fcb4a0f82 (diff) | |
test canny?
Diffstat (limited to 'canny-cv.py')
| -rw-r--r-- | canny-cv.py | 29 |
1 files changed, 16 insertions, 13 deletions
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() |
