Converting RGB images to LAB using scikit-image


I’m trying to convert an RGB image into the LAB color space using skimage, but the result seems to be just noise. The same operation using opencv seems to work.

cat = io.imread('')
cat_sk_image_lab = skimage.color.rgb2lab(cat)
cat_cv_lab = cv2.cvtColor(cat, cv2.COLOR_BGR2LAB)

enter image description here

Asked By: waspinator



The display issues are due to the ranges of Lab values which are: L (0-100), a (-128-127), b (-128-127). This really should be documented–our mistake.

To display a Lab picture, you can rescale the various bands to the desired range (0-1):

lab = skimage.color.rgb2lab(cat)
lab_scaled = (lab + [0, 128, 128]) / [100, 255, 255]


The OpenCV docs describe doing exactly this conversion for you, if using 8-bit images.

Answered By: Stefan van der Walt
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.