patchGNU Octave - Patches: patch #8058, [image package new function]...


patch #8058: [image package new function] rgb2lab.m

Submitted by:  Ming Liu <liuming198904>
Submitted on:  Sat 25 May 2013 06:01:09 AM UTC  
Category: NonePriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Closed

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 22 Feb 2017 09:36:43 PM UTC, comment #2:

Thanks for submitting this patch, but since
rgb2lab has been added to Image Package,
I am closing this item.

Avinoam Kalma <avinoam>
Project Member
Sat 25 May 2013 03:50:50 PM UTC, comment #1:

I have several major issues with this submission:

1. You should compute the indexes once. For example, when you compute L, you have
L = Y;
L(L > 0.008856) = 116 * L(L > 0.008856).^(1/3) - 16;
L(L<= 0.008856) = 903.3 * L(L<= 0.008856) ;

Instead, compute Li = (L > 0.008856), then use Li or ~Li for all times you need it. Or really, you should compute Xi, Yi, and Zi (e.g. Yi = (Y > 0.008856)) first, then continue on.

2. You are converting signed values (a* and b) to uint8. What good is this? If you wish to encode the a and b* values using 8-bits (or 16-bits), follow the ICC spec. But this function should not automatically do that encoding (that should be a separate function). Just return the values as double-precision.

3. You are assuming the RGB data is a 3-dimensional array. What if you wanted to convert a single RGB value to Lab*?

4. This does not conform with the standard for converting sRGB to Lab*. You should really try to match that standard.

5. This should be part of the effort to add the color management functions to octave (i.e. makecform, applycform, etc.). The conversion from sRGB to Lab* should be added as part of those (to-be-added) functions.

Also, in your example, you suggest you can use imshow to display your (uint8) Lab* image. That is bogus - imshow expects RGB images.

Patrick Noffke <pnoffke>
Sat 25 May 2013 06:01:09 AM UTC, original submission:

simple colorspace transformation, rgb to lab
I = imread('test.png');
Ilab = rgb2lab(I);

Ming Liu <liuming198904>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #28164:  Ming_Liu_rgb2lab.patch added by liuming198904 (2KiB - application/octet-stream)
file #28165:  rgb2lab.m added by liuming198904 (2KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by avinoam (Posted a comment)
  • -unavailable- added by pnoffke (Posted a comment)
  • -unavailable- added by liuming198904 (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 22 Feb 2017 09:36:43 PM UTCavinoamOpen/ClosedOpen=>Closed
    Tue 28 May 2013 06:44:23 PM UTCjweCarbon-CopyRemoved -unavailable-=>-
    Sat 25 May 2013 06:01:09 AM UTCliuming198904Attached File-=>Added Ming_Liu_rgb2lab.patch, #28164
      Attached File-=>Added rgb2lab.m, #28165
      Carbon-Copy-=>Added -unavailable-

    Back to the top

    Powered by Savane 3.1-cleanup1