ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IERGB2CIELAB or IeCielab2rgb wrong ?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
klausdoege Posted - Jan 03 2017 : 07:23:34
Hello,
i try to check the correct convert from RGB to Lab and back.
But i becomme different results siehe attached file.
For example RGB(0,0,10) ->LAb -> RGB = RGB(0,0,7)
Here my Test procedure.
What can i do ?


procedure TForm1.Button1Click(Sender: TObject);
var
  x,y,z, R, G, B, v: integer;
  ielab: TCielab;
  iergb: hyiedefs.TRGB;
begin
     memo3.Clear;

     for R := 0 to 15 do
      for G := 0 to 15 do
        for B := 0 to 15 do
        begin
          iergb.r := r;
          iergb.g := g;
          iergb.b := b;
          ielab := IERGB2CIELAB(iergb);
          rgbcolor := IeCielab2rgb(ielab);
          if (iergb.r <> rgbcolor.r) or
             (iergb.g <> rgbcolor.g) or
             (iergb.b <> rgbcolor.b) then
         begin
            memo3.Lines.Add('RGB :'+ inttostr(r)+','+inttostr(g)+','+
                                     inttostr(b)+' <> '+
                                     inttostr(rgbcolor.r)+','+
                                     inttostr(rgbcolor.g)+','+
                                     inttostr(rgbcolor.b));
         end;






Klaus
www.klausdoege.de
4   L A T E S T    R E P L I E S    (Newest First)
klausdoege Posted - Jan 13 2017 : 04:46:49
Hi Nigel,
it's only my testing, but i have make a new test with more values.
And then is your formula the best, with minimum difference.
My idea with +0.2 it's not better.
Sorry but forget it. All is OK so.


Klaus
www.klausdoege.de
xequte Posted - Jan 09 2017 : 19:34:13
Hi Klaus

Is this change based on your testing, or format documentation?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
klausdoege Posted - Jan 09 2017 : 08:19:28
Hi Nigel,
i have function IERGB2CIELAB(rgb: TRGB): TCIELAB;
change, now it's a much better.
Here my changing, i have add only 0.2 to L.


 if (Y > 0.008856) then
  begin
    fY := IEPower2(Y, 1.0/3.0);
    // ################## +0.2 
    L := 116.0*fY - 16.0 +0.2;
  end
  else
  begin
    fY := 7.787*Y + 16.0/116.0;
    // ############# + 0.2
    L := 903.3*Y+ 0.2;
  end;



Klaus
www.klausdoege.de
xequte Posted - Jan 03 2017 : 21:26:03
Hi Klaus

If you look at the source for IECIELAB2RGB, you will note that it is subject to rounding errors, so exact 1:1 conversion is not possible.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com