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('https://poopr.org/images/2017/08/22/91615172-find-a-lump-on-cats-skin-632x475.jpg') cat_sk_image_lab = skimage.color.rgb2lab(cat) plt.imshow(cat_sk_image_lab) cat_cv_lab = cv2.cvtColor(cat, cv2.COLOR_BGR2LAB) plt.imshow(cat_cv_lab)
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.