Created
February 10, 2012 01:58
-
-
Save kiyotakagoto/1785448 to your computer and use it in GitHub Desktop.
XYZ色空間からL*a*b*色空間へ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 参考:http://www005.upp.so-net.ne.jp/fumoto/linkp25.htm | |
sub xyz_to_Lab { | |
my $xyz_href = shift; | |
my ($Xn, $Yn, $Zn) = ( 98.072, 100, 118.225); | |
#my ($Xn, $Yn, $Zn) = ( 95.045, 100, 108.892); | |
my $Lab = { | |
L => 116 * ( ($xyz_href->{X} / $Yn) ** (1/3) ) - 16, | |
a => 500 * ( ($xyz_href->{X} / $Xn) ** (1/3) - ($xyz_href->{Y} / $Yn) ** (1/3) ), | |
b => 200 * ( ($xyz_href->{Y} / $Yn) ** (1/3) - ($xyz_href->{Z} / $Zn) ** (1/3) ), | |
}; | |
return $Lab; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment