Lab-image values on both of a and b axises exceeds the range

83 views Asked by At

i converted a color image to Lab-color space, and when i displayed the values of the Lab-image, i found that the values of the pixels on the a-axis and b-axis are greater than 128!! while the values on the a-axis and b-axis should range from -128 to +128

please let me know why the values on the a-axis and b-axis exceeds the range?

Code:

Log.D(TAG, "main", "labImg.size(): " + labImg.size());
    Log.D(TAG, "main", "dst.dump() \n" + labImg.dump());
    Log.D(TAG, "main", "Luminance:dst.get(0, 9)[0]: " + labImg.get(0, 9)[0]);
    Log.D(TAG, "main", "a-axis:dst.get(0, 9)[1]: " + labImg.get(0, 9)[1]);
    Log.D(TAG, "main", "b-axis:dst.get(0, 9)[2]: " + labImg.get(0, 9)[2]);

output:

[82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20;
82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20;
82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20;
82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20;
82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20;
82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20;
82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20;
82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20;
82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20;
82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20, 82, 207, 20]
3: Debug: MainClass -> main: Luminance:dst.get(0, 9)[0]: 82.0
4: Debug: MainClass -> main: a-axis:dst.get(0, 9)[1]: 207.0
5: Debug: MainClass -> main: b-axis:dst.get(0, 9)[2]: 20.0
1

There are 1 answers

1
beaker On BEST ANSWER

Results for L*a*b* conversion on 8-bit images is automatically scaled:

  • RGB <-> CIE Lab* (CV_BGR2Lab, CV_RGB2Lab, CV_Lab2BGR, CV_Lab2RGB).
    ...
    This outputs 0 <= L <= 100, -127 <= a <= 127, -127 <= b <= 127. The values are then converted to the destination data type:

  • 8-bit images
    L <- L*255/100, a <- a + 128, b <- b + 128

http://docs.opencv.org/java/2.4.9/org/opencv/imgproc/Imgproc.html#cvtColor(org.opencv.core.Mat,%20org.opencv.core.Mat,%20int)