Check your Colorchecker

Extract color patches CIELAB values in one step

If all you need is just to extract CIELAB values from your TIF image, the colorchecker2cielab package provides two quick ways to do so. The first way requires you to open a Jupyter notebook, import the cielab_extractor() function and run the command. The table with 140 CIELAB values is saved to an excel file in the same folder as the tif file.

from colorchecker2cielab import cielab_extractor
tif_file = '/home/frank/Work/DATA/colorchecker2cielab-data/sk-C-1833_135MB.tif' 
LABs = cielab_extractor(tif_file)
Writing Colorchecker CIELAB values to excel file: 
'/home/frank/Work/DATA/colorchecker2cielab-data/sk-C-1833_135MB_CIELABs.xlsx'

       L*     a*     b*
A1  95.56  -0.76   2.22
B1  49.37  -0.39   0.36
C1   7.72   0.42   0.26
D1  95.96  -0.89   1.92
E1  49.36  -0.41   0.37
F1   7.41   0.45   0.24
G1  95.85  -0.95   1.88
H1  49.37  -0.44   0.34
I1   7.38   0.17   0.26
J1  95.91  -0.92   1.84
K1  49.38  -0.42   0.28
L1   7.58   0.50   0.63
M1  49.43  -0.45   0.21
N1  95.71  -0.90   1.94
A2   7.52   0.31   0.18
B2  34.13  50.45  -7.86
C2  20.85  18.47 -17.83
D2  84.09  -2.00  -8.32
E2  31.60  17.65  20.30
F2  64.88  19.02  18.97
G2  46.09  -3.78 -24.90
H2  37.79 -17.03  27.62
I2  51.38   9.44 -26.60
J2  69.01 -34.89  -0.23
K2  84.98  11.28  18.18
L2  22.84  34.82  11.15
M2  43.59  62.58  12.20
N2  49.47  -0.43   0.20
A3  49.29  -0.40   0.34
B3  61.06  26.19 -17.85
C3  41.20  18.23 -35.79
D3  84.97  14.12   0.33
E3  61.62  37.39  65.87
F3  34.65  12.62 -49.61
G3  48.88  53.23  23.29
H3  21.54  31.19 -27.46
I3  70.01 -23.55  58.67
J3  68.86  17.67  75.18
K3  89.22 -16.52   5.53
L3  46.04  67.03  52.94
M3  19.14  33.14  -8.78
N3   7.62   0.68   0.36
A4  95.97  -0.85   1.79
B4  29.55  48.09 -39.77
C4  21.61  -2.32 -33.02
D4  84.45 -19.22  -1.21
E4  18.40  20.23 -53.94
F4  53.49 -42.45  35.84
G4  39.18  64.81  43.00
H4  80.49   3.73  82.02
I4  48.52  54.36 -12.03
J4  48.59 -31.13 -31.06
K4  84.21   5.12  -6.56
L4  61.20  35.36   4.75
M4  42.97  65.42  33.08
N4  96.19  -0.95   1.47
A5   7.59   0.16  -0.00
B5  49.95 -12.06 -47.67
C5  60.48 -16.87 -32.28
D5  84.68  12.86   7.75
E5  95.99  -0.95   1.40
F5  78.58   0.00   0.17
G5  64.67  -0.41  -0.22
H5  49.27  -0.39   0.28
I5  34.78  -0.45   0.12
J5  15.77  -0.66  -0.92
K5  83.65 -12.44  -8.77
L5  62.59  35.89  18.50
M5  55.30  70.03  54.01
N5  49.44  -0.40   0.25
A6  49.24  -0.43   0.27
B6  60.91 -29.73 -26.49
C6  23.25 -17.86 -17.08
D6  83.06 -10.21  25.52
E6   8.76   0.81   0.95
F6  29.94   0.09   0.28
G6  39.58  -0.39   0.31
H6  59.96  -0.06  -0.18
I6  74.20   0.21  -0.17
J6  87.36  -0.86  -0.84
K6  69.72  -0.21  -0.53
L6  65.14  51.87  77.47
M6  80.28  24.14  84.24
N6   8.09   0.90   0.92
A7  95.57  -0.90   1.86
B7  22.34 -25.77  -7.94
C7  60.17  -4.92 -32.26
D7  61.91  30.33  34.64
E7  75.54  20.72  23.54
F7  63.35  13.04  24.48
G7  39.72  15.07  24.95
H7  67.28  13.96  15.60
I7  45.34  25.45  39.99
J7  63.03  24.93  26.02
K7  45.10  -0.13   0.68
L7  70.15 -11.09  81.78
M7  79.20   6.09  92.96
N7  95.94  -0.82   1.61
A8   7.68  -0.02   0.21
B8  60.90 -41.98 -13.15
C8  52.91 -49.89 -11.48
D8  64.82  19.63  17.65
E8  73.02  29.96  25.73
F8  64.05  13.40  17.53
G8  64.97  15.46  16.35
H8  65.40  15.95  17.88
I8  36.08  14.89  25.93
J8  65.88  21.92  27.22
K8  20.88  -0.41   0.33
L8  60.77   2.51  53.26
M8  69.84 -17.60  74.36
N8  49.37  -0.42   0.24
A9  49.04  -0.43   0.19
B9  20.06   0.29  13.53
C9  60.68 -40.05  19.59
D9  52.14 -52.38  14.36
E9  22.38 -22.94   5.39
F9  60.87 -43.06   7.34
G9  59.38 -27.68  38.72
H9  51.37 -49.13  43.81
I9  61.26 -52.41  45.63
J9  60.56  16.21  49.58
K9  60.35 -13.93  52.70
L9  70.34 -28.77  72.57
M9  22.94  12.77  19.35
N9   8.01   0.43   0.53
A10 95.19  -0.91   1.87
B10 49.12  -0.47   0.27
C10  7.77  -0.01   0.37
D10 95.44  -0.90   1.63
E10 49.16  -0.44   0.21
F10  7.87   0.16   0.44
G10 95.41  -0.82   1.71
H10 49.24  -0.40   0.24
I10  8.06   0.22   0.74
J10 95.70  -0.85   1.49
K10 49.25  -0.39   0.25
L10  8.08   0.19   0.81
M10 49.29  -0.41   0.16
N10 95.48  -0.79   1.65

The second way to achieve this is even more simple. All you need is to open a terminal from the folder with the tif file run the cielab_extractor command with the name of the tif file that you want ato analyze.

$ cielab_extractor sk-C-1833_135MB.tif

That is all. If you are curious how all this works, then read the next sections.


source

cielab_extractor

 cielab_extractor (tif_file, write_excel=True, verbose=True)

*Extract RGB values from color patches in tif_file and convert to CIELAB values table.

Returns a pandas dataframe with 140 CIELAB values.*