torch / image

An Image toolbox for Torch.
Other
208 stars 141 forks source link

The range of output values for rgb2lab #184

Closed JiayunLi closed 8 years ago

JiayunLi commented 8 years ago

Hi, I am trying to convert the RGB image into LAB space. I guess the input should be a 3D tensor (nChanels * dimx * dimy). And the output L values should be in the range 0-100. But I actually got some very big values like 9900. I am confused with the range of LAB outputs. Can someone help me with this?

soumith commented 8 years ago

the input RGB values should be between 0 and 1.

th> a=image.lena()
                                                                      [0.0218s]
th> a:min()
0
                                                                      [0.0023s]
th> a:max()
1
                                                                      [0.0014s]
th> b=image.rgb2lab(a)
                                                                      [0.0860s]
th> b:min()
-35.633055333252
                                                                      [0.0014s]
th> b:max()
95.089314060849
                                                                      [0.0015s]
th>