-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·81 lines (61 loc) · 2.14 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
image_measurement=data/measurements/Colors_0000000320_dem.tiff
bounds_measurement=data/measurements/boxes.csv
ref_illu=data/D65.csv
ref_cmf=data/XYZ.csv
bin_dir=./build/bin/
mkdir output
###############################################################################
# Measurement extraction
###############################################################################
# Extract patches from the measured image
${bin_dir}extract-patches \
${image_measurement} \
${bounds_measurement} \
output/patches.csv
# Show areas averaged for each patch
${bin_dir}overlay-areas \
${image_measurement} \
${bounds_measurement} \
output/orig_overlays.tiff
# Create a preview of the measured patches
${bin_dir}gen-colorchart-image \
output/patches.csv \
output/orig_measured.tiff \
true
###############################################################################
# Reference generation
###############################################################################
# Generate reference patches for given illuminant & CMFs
${bin_dir}gen-ref-colorchart \
${ref_illu} \
${ref_cmf} \
output/reference.csv
# Create a preview of the reference patches
${bin_dir}gen-colorchart-image \
output/reference.csv \
output/reference.tiff
###############################################################################
# Fit matrix to correct colors
###############################################################################
${bin_dir}extract-matrix \
output/reference.csv \
output/patches.csv \
output/matrix.csv
###############################################################################
# Color correction
###############################################################################
# Apply the matrix to each patch
${bin_dir}correct-patches \
output/patches.csv \
output/matrix.csv \
output/corrected_patches.csv
# Create a preview of the corrected patches
${bin_dir}gen-colorchart-image \
output/corrected_patches.csv \
output/corrected_measured.tiff
# Correct the original image using the same matrix
${bin_dir}correct-image \
${image_measurement} \
output/matrix.csv \
output/corrected_image.tiff