Skip to content

Commit 5ede7ac

Browse files
author
tsl
committed
adds doc
1 parent 53a4c11 commit 5ede7ac

File tree

7 files changed

+226
-0
lines changed

7 files changed

+226
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ Library containing several algorithms for:
3030
| :---: | :---: |
3131
|![Screenshot](data/test_images/flower.jpg)|![Screenshot](data/test_images/flower_oabf.jpg)|
3232

33+
## Color Palette Extraction of Images
34+
35+
[more detail](apps/palette_extraction/README.md)
36+
3337

3438
## References
3539

apps/palette_extraction/README.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
2+
# Digital Palette Mixer
3+
4+
Mix paint palettes for images from base pigments using the Kubelka-Munk equations. Based on the paper of Lindemeier et al. [1].
5+
6+
7+
## Example
8+
9+
This is a collection of base pigments whose absorption and scattering coefficients I've measured in my article [1]:
10+
11+
* Primary Magenta
12+
* Carmine Red
13+
* Cadmium Red Medium
14+
* Raw Umber
15+
* Cadmium Orange Hue
16+
* Cadmium Yellow Hue
17+
* Primary Yellow
18+
* Leaf Green
19+
* Phthalo Green
20+
* Cobalt Blue Tone Deep
21+
* Ultramarine Blue
22+
* Lilac
23+
* Lamp Black
24+
* Titanium White
25+
26+
27+
![](doc/palette_extraction/pexels-photo-977737-extractedPalette.json.basePigments.jpg)
28+
29+
**Figure 1:** This is a visualization of the pigments and their resulting reflectance on black and white background.
30+
31+
32+
33+
### Create a palette from an input picture and mixing them from base pigments
34+
Command to extract a pallete of size 6 from a input image:
35+
```shell
36+
./palette_extraction -b ../palettes/BasePigments/AcrylicsBasePigments.json -i ../doc/palette_extraction/pexels-photo-977737.jpeg -n 6 -o ../doc/palette_extraction/pexels-photo-977737-extractedPalette.json
37+
```
38+
39+
![](doc/palette_extraction/pexels-photo-977737.jpeg)
40+
41+
**Figure 2:** The input image [2] we will extract a palette from using the pigments from Figure 1 .
42+
43+
44+
45+
![](doc/palette_extraction/pexels-photo-977737-extractedPalette.json.jpg)
46+
47+
**Figure 3:** The extracted palette rendered on black and white background.
48+
49+
50+
51+
These are the weights computed with the PaintMixer solver:
52+
53+
| Primary Magenta | Carmine Red| Cadmium Red Medium| Raw Umber| Cadmium Orange Hue| Cadmium Yellow Hue| Primary Yellow| Leaf Green| Phthalo Green| Cobalt Blue Tone Deep| Ultramarine Blue| Lilac| Lamp Black | Titanium White |
54+
|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|
55+
| 0 |0 | 0 | 0 | 0 | 0 |0 | 0.0947 | 0.262 | 0.0903 | 0.215 | 0 |0.337 | 0 |
56+
| 0 |0 | 0 | 0 | 0 | 0 |0 | 0 | 0 | 0 | 0 | 0.019 |0 | 0.981 |
57+
| 0 |0 | 0 | 0 | 0 | 0.00757|0 | 0.192 | 0.59 | 0.139 | 0.0424 | 0 |0 | 0.0292 |
58+
| 0 |0 | 0.0854 | 0 | 0.171 | 0.0692 |0.674| 0 | 0 | 0 | 0 | 0 |0 | 0 |
59+
| 0.146 |0.211 | 0.437 | 0 | 0.206 | 0 |0 | 0 | 0 | 0 | 0 | 0 |0 | 0 |
60+
| 0 |0 | 0 | 0.0063 | 0 | 0 |0 | 0.0369 | 0.212 | 0.216 | 0.259 | 0.0625 |0.206 | 0 |
61+
62+
**Table 1:** These are the weights for mixing the paints as shown in Figure 3 from the base pigments shown in Figure 1.
63+
64+
65+
These are the absorption and scattering coefficients of the extracted palette computed using the mixing solver and output as json:
66+
```json
67+
[
68+
{
69+
"K": [
70+
1.4671067147397455,
71+
0.9698479705161202,
72+
0.7784896610234372
73+
],
74+
"S": [
75+
0.043076041668283649,
76+
0.08198151765139729,
77+
0.06474356110909095
78+
]
79+
},
80+
{
81+
"K": [
82+
0.06539400295725369,
83+
0.06421413897814343,
84+
0.06737760085328282
85+
],
86+
"S": [
87+
0.7612055495574275,
88+
0.9165666516471837,
89+
1.0169171824109196
90+
]
91+
},
92+
{
93+
"K": [
94+
1.558403138979944,
95+
0.706115436691196,
96+
0.7202637267172865
97+
],
98+
"S": [
99+
0.06732445406550918,
100+
0.11887217439153461,
101+
0.11310752780489106
102+
]
103+
},
104+
{
105+
"K": [
106+
0.013819327449075598,
107+
0.3409922592740801,
108+
2.53557022496248
109+
],
110+
"S": [
111+
1.0679933129986213,
112+
0.6562281343632745,
113+
0.01595292961985854
114+
]
115+
},
116+
{
117+
"K": [
118+
0.13424884989254433,
119+
1.6172395172573063,
120+
1.8094305792798447
121+
],
122+
"S": [
123+
0.7523791290476137,
124+
0.1791898328836181,
125+
0.1282115084482811
126+
]
127+
},
128+
{
129+
"K": [
130+
1.5054829224326548,
131+
0.9997198355146348,
132+
0.584845819500503
133+
],
134+
"S": [
135+
0.041619867600404109,
136+
0.10086032379657013,
137+
0.11154146006304615
138+
]
139+
}
140+
]
141+
```
142+
143+
## References
144+
145+
[1]: T. Lindemeier, J. M. Gülzow, and O. Deussen. 2018. Painterly rendering using limited paint color palettes. In Proceedings of the Conference on Vision, Modeling, and Visualization (EG VMV '18). Eurographics Association, Goslar Germany, Germany, 135-145. DOI: https://doi.org/10.2312/vmv.20181263
146+
147+
[2]: Image from (https://www.pexels.com/photo/scenic-view-of-beach-during-dawn-977737/), accessed May 22, 2019.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://www.pexels.com/photo/scenic-view-of-beach-during-dawn-977737/
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
[
2+
{
3+
"K": [
4+
1.4671067147397455,
5+
0.9698479705161202,
6+
0.7784896610234372
7+
],
8+
"S": [
9+
0.043076041668283649,
10+
0.08198151765139729,
11+
0.06474356110909095
12+
]
13+
},
14+
{
15+
"K": [
16+
0.06539400295725369,
17+
0.06421413897814343,
18+
0.06737760085328282
19+
],
20+
"S": [
21+
0.7612055495574275,
22+
0.9165666516471837,
23+
1.0169171824109196
24+
]
25+
},
26+
{
27+
"K": [
28+
1.558403138979944,
29+
0.706115436691196,
30+
0.7202637267172865
31+
],
32+
"S": [
33+
0.06732445406550918,
34+
0.11887217439153461,
35+
0.11310752780489106
36+
]
37+
},
38+
{
39+
"K": [
40+
0.013819327449075598,
41+
0.3409922592740801,
42+
2.53557022496248
43+
],
44+
"S": [
45+
1.0679933129986213,
46+
0.6562281343632745,
47+
0.01595292961985854
48+
]
49+
},
50+
{
51+
"K": [
52+
0.13424884989254433,
53+
1.6172395172573063,
54+
1.8094305792798447
55+
],
56+
"S": [
57+
0.7523791290476137,
58+
0.1791898328836181,
59+
0.1282115084482811
60+
]
61+
},
62+
{
63+
"K": [
64+
1.5054829224326548,
65+
0.9997198355146348,
66+
0.584845819500503
67+
],
68+
"S": [
69+
0.041619867600404109,
70+
0.10086032379657013,
71+
0.11154146006304615
72+
]
73+
}
74+
]
Loading
Loading
Loading

0 commit comments

Comments
 (0)