kritiksoman / GIMP-ML

AI for GNU Image Manipulation Program
https://kritiksoman.github.io/GIMP-ML-Docs/index.html
MIT License
1.39k stars 127 forks source link

Colorize input array shape error #7

Closed ryx2 closed 4 years ago

ryx2 commented 4 years ago

When running "colorize" on an image after installing, got the following as error printout in terminal in ubuntu:

Traceback (most recent call last): File "/usr/lib/gimp/2.0/python/gimpfu.py", line 851, in _run res = apply(func, params[1:]) File "/home/raymond/GIMP-ML/gimp-plugins/colorize.py", line 92, in colorize cpy=getcolor(imgmat) File "/home/raymond/GIMP-ML/gimp-plugins/colorize.py", line 39, in getcolor img_yuv = rgb2yuv(p) File "/home/raymond/GIMP-ML/gimp-plugins/gimpenv/lib/python2.7/site-packages/skimage/color/colorconv.py", line 1611, in rgb2yuv return _convert(yuv_from_rgb, rgb) File "/home/raymond/GIMP-ML/gimp-plugins/gimpenv/lib/python2.7/site-packages/skimage/color/colorconv.py", line 598, in _convert arr = _prepare_colorarray(arr) File "/home/raymond/GIMP-ML/gimp-plugins/gimpenv/lib/python2.7/site-packages/skimage/color/colorconv.py", line 156, in _prepare_colorarray raise ValueError(msg) ValueError: the input array must be have a shape == (.., ..,[ ..,] 3)), got (854, 1440, 12)

ryx2 commented 4 years ago

4 channel png image, the error I get with a 3 channel jpg image is (X,X,9) for the last line

germanzhu commented 4 years ago

first, change your image to grayscale image