pfnet / PaintsChainer

line drawing colorization using chainer
https://paintschainer.preferred.tech/
MIT License
3.77k stars 556 forks source link

fix a channel input #131

Open taizan opened 7 years ago

taizan commented 7 years ago

fill 255 to the image which has alpha channel

uyongw commented 7 years ago

With this PR, the image with a channel is correct now. But it seems has issue on image without a channel? Or does it miss to return the grayed image for RGB?

diff --git a/cgi-bin/paint_x2_unet/img2imgDataset.py b/cgi-bin/paint_x2_unet/img2imgDataset.py
index cc521de..3d424a7 100755
--- a/cgi-bin/paint_x2_unet/img2imgDataset.py
+++ b/cgi-bin/paint_x2_unet/img2imgDataset.py
@@ -36,6 +36,7 @@ def cvt2GRAY(img):
         return cv2.cvtColor(img2, cv2.COLOR_RGB2GRAY)
     else:
         # RGB image
+        return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)

 class ImageAndRefDataset(chainer.dataset.DatasetMixin):