Cannot read CMYK jpeg images
Currently, we support only images in either gray or RGB color space. However, there are some JPEG images stored in different color spaces, such as CMYK or YCCK: https://www.freedesktop.org/wiki/Software/libjpeg
Currently these images cannot be read with bob.io.image.load
, we get the following exception:
RuntimeError: File - CMYK.jpg: C++ exception caught: 'unsupported number of planes (4) when reading file. Image depth must be 1 or 3.'
Unfortunately, libjpeg
does not provide a default color conversion to convert CMYK images into RGB (only YCCK <==> CMYK conversions are supported). Hence, in order to be able to read these types of images, we need to perform our own color conversion, i.e., here: https://gitlab.idiap.ch/bob/bob.io.image/blob/master/bob/io/image/cpp/jpeg.cpp#L152
Ideally, we would have a link to bob.ip.color
and implement the color conversion function (see e.g. here: http://www.rapidtables.com/convert/color/cmyk-to-rgb.htm) cmyk_to_rgb
and/or rgb_to_cmyk
in there. However, this would create a new dependency between packages, i.e., from bob.io.image
to bob.ip.color
. In fact, this might be a good idea anyways, i.e., in order to be able to get a color color image from any kind of image source (by automatically converting color types, if necessary).