Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rgb2lab in MatLab and OpenCV provide different results

Tags:

opencv

matlab

I converted a RGB-image both in MatLab and OpenCV to the Lab-colorspace to do some color manipulation in Lab-space. In MatLab I get good results, but in OpenCV the result image is messy.

I checked the results of the conversion rgb2lab for the RGB-value [0 255 0] in MatLab and OpenCV, the results are the same. But when converting back (lab2rgb) I get different results in MatLab and OpenCV. Any idea why?

The Lab-value is [88 10 68]:

  • in Matlab I get [255 212 81] as RGB-value by using lab2srgb
  • in OpenCV I get [255 166 23] by using CV_Lab2RGB
like image 864
Fei Avatar asked Sep 12 '25 08:09

Fei


1 Answers

I think there was an error in OpenCV 1.x, because after installing OpenCV 2.1 yesterday, my algorithm is working fine and I get results I was expecting.

like image 185
Fei Avatar answered Sep 14 '25 00:09

Fei