summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--canny-cv.py29
-rw-r--r--test-canny.sh11
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