DeltaE CIE94 구현

DeltaE_CIE94 구현
CIE94에 따른 색상 차이 계산

1 소스 코드[ | ]

<?php
function xmp_print($arr) { echo '<xmp>'; print_r($arr); echo '</xmp>'; }

function deltaE_CIE94G($Lab1, $Lab2) {
	list($L1, $a1, $b1) = $Lab1;
	list($L2, $a2, $b2) = $Lab2;

	$C1 = sqrt( $a1*$a1 + $b1*$b1 );
	$C2 = sqrt( $a2*$a2 + $b2*$b2 );
	$C_ab = $C1 - $C2;
	$H_ab = sqrt( pow($a1-$a2,2) + pow($b1-$b2,2) - pow($C_ab,2) );

	$S_C = 1 + 0.045*$C1;
	$S_H = 1 + 0.015*$C1;
	return sqrt( pow( $L2-$L1, 2) + pow( $C_ab/$S_C, 2) + pow( $H_ab/$S_H, 2) );
}

function deltaE_CIE94T($Lab1, $Lab2) {
	list($L1, $a1, $b1) = $Lab1;
	list($L2, $a2, $b2) = $Lab2;

	$C1 = sqrt( $a1*$a1 + $b1*$b1 );
	$C2 = sqrt( $a2*$a2 + $b2*$b2 );
	$C_ab = $C1 - $C2;
	$H_ab = sqrt( pow($a1-$a2,2) + pow($b1-$b2,2) - pow($C_ab,2) );

	$S_C = 1 + 0.048*$C1;
	$S_H = 1 + 0.014*$C1;
	return sqrt( pow( ($L2-$L1)/2, 2) + pow( $C_ab/$S_C, 2) + pow( $H_ab/$S_H, 2) );
}

$white = array(100.000, 0.005, -0.010);
$yellow = array(97.138, -21.556, 94.482);
$red = array(53.233, 80.109, 67.220);
$black = array(0, 0, 0);

$white_yellow = deltaE_CIE94G($white, $yellow);
$yellow_red = deltaE_CIE94G($yellow, $red);
$red_black = deltaE_CIE94G($red, $black);
xmp_print("(graphic arts) white_yellow = [$white_yellow]");
xmp_print("(graphic arts) yellow_red = [$yellow_red]");
xmp_print("(graphic arts) red_black = [$red_black]");

$white_yellow = deltaE_CIE94T($white, $yellow);
$yellow_red = deltaE_CIE94T($yellow, $red);
$red_black = deltaE_CIE94T($red, $black);
xmp_print("(textiles) white_yellow = [$white_yellow]");
xmp_print("(textiles) yellow_red = [$yellow_red]");
xmp_print("(textiles) red_black = [$red_black]");

2 실행 결과[ | ]

(graphic arts) white_yellow = [96.914207822818]
(graphic arts) yellow_red = [61.320305555622]
(graphic arts) red_black = [56.29967595317]
(textiles) white_yellow = [96.879263082948]
(textiles) yellow_red = [49.677698117817]
(textiles) red_black = [31.784259695576]

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}