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 | |
| parent | f8d0c6bd65a827be534d2d105917829fcb4a0f82 (diff) | |
test canny?
| -rw-r--r-- | canny-cv.py | 29 | ||||
| -rw-r--r-- | test-canny.sh | 11 |
2 files changed, 27 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() diff --git a/test-canny.sh b/test-canny.sh new file mode 100644 index 0000000..57b56b6 --- /dev/null +++ b/test-canny.sh @@ -0,0 +1,11 @@ +python canny-cv.py \ + --dataroot /home/ubuntu/Desktop/thumbs/wood/B/train/ \ + --name woodcanny \ + --loadSize 256 \ + --fineSize 256 \ + --how_many 200 \ + --model test \ + --which_model_netG unet_256 \ + --which_direction AtoB \ + --dataset_mode aligned \ + --norm batch |
