bad precission with CMMatchFloatBitmap and CWMatchColors
bad precission with CMMatchFloatBitmap and CWMatchColors
- Subject: bad precission with CMMatchFloatBitmap and CWMatchColors
- From: Klaus Karcher <email@hidden>
- Date: Mon, 29 Dec 2008 01:19:57 +0100
Hi,
I've got some weird results using CMMatchFloatBitmap and CWMatchColors
with simple RGB gamma + matrix profiles.
To figure out what's going wrong, I've written a command line tool to
compare the results of
* CMMatchFloatBitmap Lab -> RGB,
* CWMatchColors Lab -> RGB,
* CMConvertXYZFloatBitmap Lab -> XYZ + CMMatchFloatBitmap XYZ -> RGB and
* direct conversions using clapack routines
While the LAPACK solutions are plausible and consistent with
independently calculated results (e.g. ArgyllCMS icclu), all other
methods cause huge round trip errors (Delta E mean > 2, Delta E max > 16).
CMMatchFloatBitmap XYZ -> RGB causes the most significant errors (Delta
E mean 6.3, Delta E max 16.9), but also the other methods are by far not
as precise as expected: Even when I exclude Lab values that exceed the
UInt16 domain, there are still Delta E's > 3.5 with CMMatchFloatBitmap
Lab -> RGB.
Can someone please have a look at my code an tell me what I'm doing
wrong? Or confirm potential bugs in Apple's ColorSync API?
My test tool is here: <http://digitalproof.info/colorsync-dev/convert.zip>,
console output: see attachment.
TIA, Klaus
--
Klaus Karcher * Eichenallee 18
26203 Wardenburg * Germany
Tel. +49 441 8859770
Profile: testRGB
Rgamma: 1.800781
Ggamma: 1.800781
Bgamma: 1.800781
Red: X: 0.650284, Y: 0.320297, Z: 0.000000
Green: X: 0.178040, Y: 0.602036, Z: 0.067825
Blue: X: 0.135880, Y: 0.077667, Z: 0.077667
---------------------------------------------------------------------------
RGB input: R: 1.00000, G: 0.00000, B: 0.00000
Lab input: L: 63.37, a: 96.37, b: 109.26
LAPACK result (clipped): R: 1.00000, G: 0.00392, B: 0.00000
roundtrip: L: 63.37, a: 96.36, b: 109.26
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.98506, G: 0.02133, B: 0.01744
roundtrip: L: 62.71, a: 95.33, b: 107.02
Delta E: 2.55
CWMatchColors Lab -> RGB result: R: 0.98505, G: 0.02130, B: 0.01743
roundtrip: L: 62.71, a: 95.33, b: 107.02
Delta E: 2.55
CMMatchFloatBitmap XYZ -> RGB result: R: 0.97977, G: 0.15419, B: 0.03746
roundtrip: L: 64.14, a: 89.20, b: 102.31
Delta E: 10.02
---------------------------------------------------------------------------
RGB input: R: 0.00000, G: 1.00000, B: 0.00000
Lab input: L: 81.95, a: -137.46, b: 81.90
LAPACK result (clipped): R: 0.00329, G: 1.00000, B: 0.00243
roundtrip: L: 81.95, a: -137.45, b: 81.90
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.14290, G: 0.98221, B: 0.06435
roundtrip: L: 81.46, a: -127.64, b: 79.69
Delta E: 10.08
Lab clipped to UInt16: L: 81.95, a: -128.00, b: 81.90
CWMatchColors Lab -> RGB result: R: 0.14289, G: 0.98221, B: 0.06436
roundtrip: L: 81.46, a: -127.64, b: 79.69
Delta E: 10.08
Delta E to clipped Lab: 2.29
CMMatchFloatBitmap XYZ -> RGB result: R: 0.13484, G: 0.97398, B: 0.12906
roundtrip: L: 81.00, a: -126.73, b: 73.98
Delta E: 13.37
---------------------------------------------------------------------------
RGB input: R: 0.00000, G: 0.00000, B: 1.00000
Lab input: L: 33.50, a: 46.87, b: -109.02
LAPACK result (clipped): R: 0.00340, G: 0.00193, B: 1.00000
roundtrip: L: 33.50, a: 46.86, b: -109.01
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.04845, G: 0.03204, B: 0.97852
roundtrip: L: 33.42, a: 45.89, b: -106.66
Delta E: 2.56
CWMatchColors Lab -> RGB result: R: 0.04843, G: 0.03203, B: 0.97852
roundtrip: L: 33.42, a: 45.89, b: -106.66
Delta E: 2.56
CMMatchFloatBitmap XYZ -> RGB result: R: 0.07405, G: 0.16019, B: 1.00000
roundtrip: L: 38.36, a: 33.70, b: -100.86
Delta E: 16.23
---------------------------------------------------------------------------
RGB input: R: 0.00000, G: 1.00000, B: 1.00000
Lab input: L: 85.99, a: -95.64, b: -24.15
LAPACK result (clipped): R: 0.00408, G: 1.00000, B: 1.00000
roundtrip: L: 85.99, a: -95.63, b: -24.15
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.05681, G: 0.98314, B: 0.96606
roundtrip: L: 84.93, a: -94.70, b: -22.05
Delta E: 2.53
CWMatchColors Lab -> RGB result: R: 0.05673, G: 0.98314, B: 0.96608
roundtrip: L: 84.93, a: -94.70, b: -22.05
Delta E: 2.53
CMMatchFloatBitmap XYZ -> RGB result: R: 0.14720, G: 0.96562, B: 0.97743
roundtrip: L: 84.48, a: -87.58, b: -23.91
Delta E: 8.21
---------------------------------------------------------------------------
RGB input: R: 1.00000, G: 0.00000, B: 1.00000
Lab input: L: 69.33, a: 99.32, b: -47.25
LAPACK result (clipped): R: 1.00000, G: 0.00435, B: 1.00000
roundtrip: L: 69.33, a: 99.32, b: -47.24
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.97940, G: 0.08472, B: 1.00000
roundtrip: L: 68.99, a: 96.42, b: -47.90
Delta E: 3.00
CWMatchColors Lab -> RGB result: R: 0.97939, G: 0.08473, B: 0.99417
roundtrip: L: 68.93, a: 96.38, b: -47.32
Delta E: 2.97
CMMatchFloatBitmap XYZ -> RGB result: R: 0.97414, G: 0.07422, B: 1.00000
roundtrip: L: 68.66, a: 96.50, b: -48.44
Delta E: 3.14
---------------------------------------------------------------------------
RGB input: R: 1.00000, G: 1.00000, B: 0.00000
Lab input: L: 96.92, a: -11.39, b: 107.71
LAPACK result (clipped): R: 1.00000, G: 1.00000, B: 0.00260
roundtrip: L: 96.92, a: -11.39, b: 107.70
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.97441, G: 0.97798, B: 0.05106
roundtrip: L: 95.35, a: -11.62, b: 104.62
Delta E: 3.47
CWMatchColors Lab -> RGB result: R: 0.97441, G: 0.97798, B: 0.05104
roundtrip: L: 95.35, a: -11.62, b: 104.62
Delta E: 3.47
CMMatchFloatBitmap XYZ -> RGB result: R: 0.97005, G: 0.96722, B: 0.12892
roundtrip: L: 94.83, a: -10.50, b: 98.13
Delta E: 9.84
---------------------------------------------------------------------------
RGB input: R: 1.00000, G: 1.00000, B: 1.00000
Lab input: L: 100.00, a: 0.00, b: 0.00
LAPACK result (clipped): R: 1.00000, G: 1.00000, B: 1.00000
roundtrip: L: 100.00, a: 0.00, b: 0.00
Delta E: 0.00
CMMatchFloatBitmap Lab -> RGB result: R: 1.00000, G: 1.00000, B: 1.00000
roundtrip: L: 100.00, a: 0.00, b: 0.00
Delta E: 0.00
CWMatchColors Lab -> RGB result: R: 0.99670, G: 1.00000, B: 1.00000
roundtrip: L: 99.93, a: -0.35, b: -0.13
Delta E: 0.38
CMMatchFloatBitmap XYZ -> RGB result: R: 0.97375, G: 0.98630, B: 0.97745
roundtrip: L: 98.71, a: -1.51, b: 0.42
Delta E: 2.03
---------------------------------------------------------------------------
RGB input: R: 0.00000, G: 0.00000, B: 0.00000
Lab input: L: -0.00, a: 0.00, b: 0.00
LAPACK result: R: 0.00000, G: 0.00000, B: 0.00000
roundtrip: L: -0.00, a: 0.00, b: 0.00
Delta E: 0.00
CMMatchFloatBitmap Lab -> RGB result: R: 0.00000, G: 0.00000, B: 0.00000
roundtrip: L: -0.00, a: 0.00, b: 0.00
Delta E: 0.00
Lab clipped to UInt16: L: 0.00, a: 0.00, b: 0.00
CWMatchColors Lab -> RGB result: R: 0.00000, G: 0.00000, B: 0.00371
roundtrip: L: 0.00, a: 0.00, b: -0.00
Delta E: 0.00
Delta E to clipped Lab: 0.00
CMMatchFloatBitmap XYZ -> RGB result: R: 0.00000, G: 0.00000, B: 0.00000
roundtrip: L: -0.00, a: 0.00, b: 0.00
Delta E: 0.00
---------------------------------------------------------------------------
RGB input: R: 0.50000, G: 0.00000, B: 0.00000
Lab input: L: 36.36, a: 63.57, b: 62.69
LAPACK result (clipped): R: 0.50004, G: 0.00196, B: 0.00000
roundtrip: L: 36.36, a: 63.57, b: 62.69
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.49810, G: 0.03465, B: 0.02142
roundtrip: L: 36.52, a: 62.50, b: 61.26
Delta E: 1.80
CWMatchColors Lab -> RGB result: R: 0.49810, G: 0.03465, B: 0.02144
roundtrip: L: 36.52, a: 62.50, b: 61.25
Delta E: 1.80
CMMatchFloatBitmap XYZ -> RGB result: R: 0.48954, G: 0.13257, B: 0.02626
roundtrip: L: 38.63, a: 52.69, b: 61.20
Delta E: 11.22
---------------------------------------------------------------------------
RGB input: R: 0.00000, G: 0.50000, B: 0.00000
Lab input: L: 48.61, a: -90.68, b: 54.03
LAPACK result: R: 0.00165, G: 0.50004, B: 0.00122
roundtrip: L: 48.62, a: -90.68, b: 54.03
Delta E: 0.00
CMMatchFloatBitmap Lab -> RGB result: R: 0.03229, G: 0.50027, B: 0.04765
roundtrip: L: 48.76, a: -88.93, b: 51.32
Delta E: 3.23
CWMatchColors Lab -> RGB result: R: 0.03229, G: 0.50027, B: 0.04767
roundtrip: L: 48.76, a: -88.93, b: 51.31
Delta E: 3.23
CMMatchFloatBitmap XYZ -> RGB result: R: 0.13150, G: 0.48621, B: 0.05214
roundtrip: L: 48.64, a: -73.96, b: 51.49
Delta E: 16.92
---------------------------------------------------------------------------
RGB input: R: 0.00000, G: 0.00000, B: 0.50000
Lab input: L: 16.65, a: 30.92, b: -71.92
LAPACK result: R: 0.00170, G: 0.00097, B: 0.50004
roundtrip: L: 16.66, a: 30.92, b: -71.92
Delta E: 0.00
CMMatchFloatBitmap Lab -> RGB result: R: 0.03613, G: 0.02077, B: 0.50423
roundtrip: L: 17.47, a: 30.86, b: -71.17
Delta E: 1.11
CWMatchColors Lab -> RGB result: R: 0.03613, G: 0.02077, B: 0.50423
roundtrip: L: 17.47, a: 30.86, b: -71.17
Delta E: 1.11
CMMatchFloatBitmap XYZ -> RGB result: R: 0.10956, G: 0.07219, B: 0.49511
roundtrip: L: 21.28, a: 28.27, b: -63.31
Delta E: 10.13
---------------------------------------------------------------------------
RGB input: R: 0.00000, G: 0.50000, B: 0.50000
Lab input: L: 51.28, a: -63.09, b: -15.93
LAPACK result: R: 0.00204, G: 0.50004, B: 0.50003
roundtrip: L: 51.28, a: -63.09, b: -15.93
Delta E: 0.00
CMMatchFloatBitmap Lab -> RGB result: R: 0.02327, G: 0.50057, B: 0.50320
roundtrip: L: 51.39, a: -62.49, b: -16.21
Delta E: 0.67
CWMatchColors Lab -> RGB result: R: 0.02321, G: 0.50056, B: 0.50320
roundtrip: L: 51.39, a: -62.49, b: -16.21
Delta E: 0.67
CMMatchFloatBitmap XYZ -> RGB result: R: 0.14868, G: 0.48482, B: 0.49722
roundtrip: L: 51.37, a: -49.38, b: -15.17
Delta E: 13.73
---------------------------------------------------------------------------
RGB input: R: 0.50000, G: 0.00000, B: 0.50000
Lab input: L: 40.29, a: 65.52, b: -31.17
LAPACK result: R: 0.50004, G: 0.00218, B: 0.50004
roundtrip: L: 40.29, a: 65.52, b: -31.16
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.49752, G: 0.03838, B: 0.50333
roundtrip: L: 40.47, a: 64.40, b: -31.39
Delta E: 1.16
CWMatchColors Lab -> RGB result: R: 0.49752, G: 0.03838, B: 0.50336
roundtrip: L: 40.48, a: 64.40, b: -31.40
Delta E: 1.16
CMMatchFloatBitmap XYZ -> RGB result: R: 0.49123, G: 0.05414, B: 0.49514
roundtrip: L: 40.27, a: 63.03, b: -30.52
Delta E: 2.57
---------------------------------------------------------------------------
RGB input: R: 0.50000, G: 0.50000, B: 0.00000
Lab input: L: 58.49, a: -7.51, b: 71.05
LAPACK result: R: 0.50004, G: 0.50004, B: 0.00130
roundtrip: L: 58.49, a: -7.51, b: 71.05
Delta E: 0.00
CMMatchFloatBitmap Lab -> RGB result: R: 0.49821, G: 0.50054, B: 0.04685
roundtrip: L: 58.49, a: -7.78, b: 68.17
Delta E: 2.89
CWMatchColors Lab -> RGB result: R: 0.49819, G: 0.50054, B: 0.04688
roundtrip: L: 58.49, a: -7.78, b: 68.16
Delta E: 2.90
CMMatchFloatBitmap XYZ -> RGB result: R: 0.49406, G: 0.49537, B: 0.05217
roundtrip: L: 58.07, a: -7.54, b: 67.18
Delta E: 3.90
---------------------------------------------------------------------------
RGB input: R: 0.50000, G: 0.50000, B: 0.50000
Lab input: L: 60.52, a: 0.00, b: 0.00
LAPACK result: R: 0.50003, G: 0.50003, B: 0.50003
roundtrip: L: 60.52, a: 0.00, b: 0.00
Delta E: 0.00
CMMatchFloatBitmap Lab -> RGB result: R: 0.49778, G: 0.50126, B: 0.50321
roundtrip: L: 60.55, a: -0.44, b: -0.43
Delta E: 0.62
CWMatchColors Lab -> RGB result: R: 0.49778, G: 0.50126, B: 0.50321
roundtrip: L: 60.55, a: -0.44, b: -0.43
Delta E: 0.62
CMMatchFloatBitmap XYZ -> RGB result: R: 0.49380, G: 0.48894, B: 0.49723
roundtrip: L: 59.70, a: 0.89, b: -0.86
Delta E: 1.48
---------------------------------------------------------------------------
RGB input: R: 1.00000, G: 0.50000, B: 0.50000
Lab input: L: 77.01, a: 56.98, b: 28.42
LAPACK result (clipped): R: 1.00000, G: 0.50005, B: 0.50003
roundtrip: L: 77.01, a: 56.97, b: 28.42
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.97679, G: 0.50101, B: 0.50466
roundtrip: L: 76.26, a: 54.74, b: 26.45
Delta E: 3.07
CWMatchColors Lab -> RGB result: R: 0.97676, G: 0.50100, B: 0.50465
roundtrip: L: 76.26, a: 54.74, b: 26.45
Delta E: 3.07
CMMatchFloatBitmap XYZ -> RGB result: R: 0.98843, G: 0.49537, B: 0.49728
roundtrip: L: 76.42, a: 56.46, b: 27.86
Delta E: 0.96
---------------------------------------------------------------------------
RGB input: R: 0.50000, G: 1.00000, B: 0.50000
Lab input: L: 87.79, a: -73.31, b: 38.58
LAPACK result (clipped): R: 0.50004, G: 1.00000, B: 0.50004
roundtrip: L: 87.79, a: -73.30, b: 38.58
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.49516, G: 1.00000, B: 0.50471
roundtrip: L: 87.73, a: -73.85, b: 37.88
Delta E: 0.89
CWMatchColors Lab -> RGB result: R: 0.49514, G: 0.99200, B: 0.50472
roundtrip: L: 87.31, a: -72.84, b: 37.31
Delta E: 1.44
CMMatchFloatBitmap XYZ -> RGB result: R: 0.49343, G: 0.96962, B: 0.49604
roundtrip: L: 86.07, a: -70.45, b: 36.74
Delta E: 3.81
---------------------------------------------------------------------------
RGB input: R: 0.50000, G: 0.50000, B: 1.00000
Lab input: L: 65.16, a: 14.73, b: -56.09
LAPACK result (clipped): R: 0.50004, G: 0.50004, B: 1.00000
roundtrip: L: 65.16, a: 14.73, b: -56.09
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.49427, G: 0.50143, B: 0.96751
roundtrip: L: 64.72, a: 12.86, b: -53.10
Delta E: 3.55
CWMatchColors Lab -> RGB result: R: 0.49424, G: 0.50144, B: 0.96754
roundtrip: L: 64.72, a: 12.85, b: -53.10
Delta E: 3.55
CMMatchFloatBitmap XYZ -> RGB result: R: 0.49847, G: 0.48818, B: 0.98454
roundtrip: L: 64.36, a: 15.88, b: -55.61
Delta E: 1.47
---------------------------------------------------------------------------
RGB input: R: 0.50000, G: 1.00000, B: 1.00000
Lab input: L: 90.40, a: -56.75, b: -16.55
LAPACK result (clipped): R: 0.50005, G: 1.00000, B: 1.00000
roundtrip: L: 90.40, a: -56.74, b: -16.55
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.49465, G: 0.97766, B: 0.97812
roundtrip: L: 89.06, a: -55.30, b: -16.22
Delta E: 2.00
CWMatchColors Lab -> RGB result: R: 0.49465, G: 0.97766, B: 0.97812
roundtrip: L: 89.06, a: -55.30, b: -16.22
Delta E: 2.00
CMMatchFloatBitmap XYZ -> RGB result: R: 0.49914, G: 0.98047, B: 0.97745
roundtrip: L: 89.26, a: -55.17, b: -15.82
Delta E: 2.08
---------------------------------------------------------------------------
RGB input: R: 1.00000, G: 0.50000, B: 1.00000
Lab input: L: 80.22, a: 62.26, b: -30.11
LAPACK result (clipped): R: 1.00000, G: 0.50005, B: 1.00000
roundtrip: L: 80.23, a: 62.26, b: -30.11
Delta E: 0.01
CMMatchFloatBitmap Lab -> RGB result: R: 0.98134, G: 0.50202, B: 0.97832
roundtrip: L: 79.52, a: 60.19, b: -28.84
Delta E: 2.53
CWMatchColors Lab -> RGB result: R: 0.98131, G: 0.50202, B: 0.97830
roundtrip: L: 79.52, a: 60.19, b: -28.84
Delta E: 2.53
CMMatchFloatBitmap XYZ -> RGB result: R: 0.97292, G: 0.48455, B: 0.98454
roundtrip: L: 78.68, a: 61.61, b: -30.91
Delta E: 1.86
---------------------------------------------------------------------------
RGB input: R: 1.00000, G: 1.00000, B: 0.50000
Lab input: L: 97.82, a: -7.93, b: 55.88
LAPACK result (clipped): R: 1.00000, G: 1.00000, B: 0.50004
roundtrip: L: 97.82, a: -7.93, b: 55.87
Delta E: 0.00
CMMatchFloatBitmap Lab -> RGB result: R: 0.97359, G: 0.98000, B: 0.50500
roundtrip: L: 96.35, a: -8.41, b: 53.09
Delta E: 3.19
CWMatchColors Lab -> RGB result: R: 0.97359, G: 0.98000, B: 0.50498
roundtrip: L: 96.35, a: -8.41, b: 53.09
Delta E: 3.18
CMMatchFloatBitmap XYZ -> RGB result: R: 0.98849, G: 0.96553, B: 0.49603
roundtrip: L: 96.03, a: -4.89, b: 54.00
Delta E: 4.00
---------------------------------------------------------------------------
RGB input: R: 0.50000, G: 0.50000, B: 0.50000
Lab input: L: 60.52, a: 0.00, b: 0.00
LAPACK result: R: 0.50003, G: 0.50003, B: 0.50003
roundtrip: L: 60.52, a: 0.00, b: 0.00
Delta E: 0.00
CMMatchFloatBitmap Lab -> RGB result: R: 0.49778, G: 0.50126, B: 0.50321
roundtrip: L: 60.55, a: -0.44, b: -0.43
Delta E: 0.62
CWMatchColors Lab -> RGB result: R: 0.49778, G: 0.50126, B: 0.50321
roundtrip: L: 60.55, a: -0.44, b: -0.43
Delta E: 0.62
CMMatchFloatBitmap XYZ -> RGB result: R: 0.49380, G: 0.48894, B: 0.49723
roundtrip: L: 59.70, a: 0.89, b: -0.86
Delta E: 1.48
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Colorsync-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden