Ask Your Question

Revision history [back]

May I ask why I get the wrong answer about rgb2luv

I use python. Today I try to convert an image(rgb) to luv.

The Doc

However , I am confused with the result.So I have a trial.

import cv2

import numpy as np

im=np.array([[[0.78039217, 0.73333335, 0.73333335]]],dtype=float32)

im_xyz=cv2.cvtColor(im,cv2.COLOR_RGB2XYZ) #the result is array([[[ 0.71641064, 0.74334133, 0.79932952]]], dtype=float32)

im_luv=cv2.cvtColor(im,cv2.COLOR_RGB2LUV)#array([[[ 76.84296417, 6.9851861 , 1.50677502]]], dtype=float32)

However,I use the matlab to rgb2luv,the result is 89.0798 , 3.5388 , 0.7616. So I try the xyz to luv, the value of L is also is 89.08016438386028. Why the result of the function cvtColor(im,cv2.COLOR_RGB2LUV) is not 89? 3Qs a lot.

click to hide/show revision 2
No.2 Revision

May I ask why I get the wrong answer about rgb2luv

I use python. Today I try to convert an image(rgb) to luv.

The Doc

However , I am confused with the result.So I have a trial.

import cv2

cv2 import numpy as np

np im=np.array([[[0.78039217, 0.73333335, 0.73333335]]],dtype=float32)

0.73333335]]],dtype=float32) im_xyz=cv2.cvtColor(im,cv2.COLOR_RGB2XYZ) #the result is array([[[ 0.71641064, 0.74334133, 0.79932952]]], dtype=float32)

dtype=float32) im_luv=cv2.cvtColor(im,cv2.COLOR_RGB2LUV)#array([[[ 76.84296417, 6.9851861 , 1.50677502]]], dtype=float32)

dtype=float32)

However,I use the matlab to rgb2luv,the result is 89.0798 , 3.5388 , 0.7616. So I try the xyz to luv, the value of L is also is 89.08016438386028. Why the result of the function cvtColor(im,cv2.COLOR_RGB2LUV) is not 89? 3Qs a lot.