-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
184 lines (169 loc) · 8.6 KB
/
index.html
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html>
<head>
<script>
var r = document.querySelector(':root');
function cargarImagen() {
//calcula la anchura y la altura del objeto "anaglyph"
r.style.setProperty('--anaglyph-width', document.getElementById('invisible').naturalWidth/2+'px' );
r.style.setProperty('--anaglyph-height', document.getElementById('invisible').naturalHeight+'px' );
//carga la imagen
r.style.setProperty('--anaglyph-image', "url("+document.getElementById('invisible').src+")" );
}
</script>
<style>
:root { --anaglyph-width; --anaglyph-height; --anaglyph-image; }
.anaglyph { position: relative; display: inline-block; overflow: hidden; width: var(--anaglyph-width); height: var(--anaglyph-height); }
.glyph { background-image: var(--anaglyph-image); position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; mix-blend-mode: screen;}
.left { background-position: left 0; }
.right { background-position: right 0; }
</style>
</head>
<body>
<!-- ========== TRUCO PARA FORZAR LA CARGA DE LA IMAGEN ====== -->
<img id="invisible" style="display: none" onload = "cargarImagen()">
<script>document.getElementById('invisible').src = 'https://stereosite.com/wp-content/uploads/2022/11/barcelona-5-1024x576.jpeg'</script>
<!-- ========== EL TEXTO DE LA PÁGINA EMPIEZA AQUÍ =========== -->
<h1>Anaglyph method comparison</h1>
<h2> A new twist: on-the-fly anaglyphs</h2>
<p>The purpose of this web page is to generate anaglyphs following the various methods that Peter Wimmer exposed in his article
<a href="https://3dtv.at/Knowhow/AnaglyphComparison_en.aspx">Anaglyph Methods Comparison</a>.
<p>In addition, it has also been included an extra anaglyph following the <i>linear projection method</i> explained by Vu M. Tran in his thesis <a href="https://ruor.uottawa.ca/bitstream/10393/27189/1/MR14962.PDF">New methods for rendering anaglyph stereoscopic images on CRT and photo-quality ink-jet printers</a>.
<p>Anaglyphs here are built on the fly using HTML5, CSS, JavaScript and some SVG filters that do the magic.
<p><p>Type a link to a stereoscopic pair in the box below and click the button <i>Anaglyph it!</i>
<p><input type="text" id="url-image" size="75%" value="https://stereosite.com/wp-content/uploads/2022/11/barcelona-5-1024x576.jpeg">
<button onclick="document.getElementById('invisible').src = document.getElementById('url-image').value">Anaglyph it!</button>
</br><small>The link by default is provided just in case you haven't got any on hand. It points to a joyful stereoscopic pair shared by Pascal Martiné from <a href="http://stereosite.com">stereosite.com</a>.</small>
</br><small>The code of this page is on repository <a href="https://github.com/raphikWasHere/anaglyph-method-comparison">github.com/raphikWasHere/anaglyph-method-comparison</a></small>
<!-- ========== EL TEXTO DE LA PÁGINA TERMINA AQUÍ =========== -->
<!-- ========== TRUE ANAGLYPH ================================ -->
<p><img src="https://github.com/raphikWasHere/anaglyph-method-comparison/blob/main/gafasRC.png?raw=true"><b> True Anaglyph</b></br>
<object class="anaglyph">
<img class="left glyph" style="filter: url(#leftTrue);">
<img class="right glyph" style="filter: url(#rightTrue);">
</object>
<svg width=0 height=0>
<filter id="leftTrue"><feColorMatrix type="matrix"
values="0.299 0.547 0.114 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 1 0" />
</filter>
<filter id="rightTrue"><feColorMatrix type="matrix"
values="0.000 0.000 0.000 0 0
0.000 0.000 0.000 0 0
0.299 0.547 0.114 0 0
0.000 0.000 0.000 1 0" />
</filter>
</svg>
<!-- ========== GREY ANAGLYPH ================================ -->
<p><img src="https://github.com/raphikWasHere/anaglyph-method-comparison/blob/main/gafasRC.png?raw=true"><b> Grey Anaglyph</b></br>
<object class="anaglyph">
<img class="left glyph" style="filter: url(#leftGrey); ">
<img class="right glyph" style="filter: url(#rightGrey); ">
</object>
<svg width=0 height=0>
<filter id="leftGrey"><feColorMatrix type="matrix"
values="0.299 0.547 0.114 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 1 0" />
</filter>
<filter id="rightGrey"><feColorMatrix type="matrix"
values="0.000 0.000 0.000 0 0
0.299 0.547 0.114 0 0
0.299 0.547 0.114 0 0
0.000 0.000 0.000 1 0" />
</filter>
</svg>
<!-- ========== COLOR ANAGLYPH =============================== -->
<p><img src="https://github.com/raphikWasHere/anaglyph-method-comparison/blob/main/gafasRC.png?raw=true"><b> Color Anaglyph</b></br>
<object class="anaglyph">
<img class="left glyph" style="filter: url(#leftColor); ">
<img class="right glyph" style="filter: url(#rightColor); ">
</object>
<svg width=0 height=0>
<filter id="leftColor"><feColorMatrix type="matrix"
values="1.000 0.000 0.000 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 1 0" />
</filter>
<filter id="rightColor"><feColorMatrix type="matrix"
values="0.000 0.000 0.000 0 0
0.000 1.000 0.000 0 0
0.000 0.000 1.000 0 0
0.000 0.000 0.000 1 0" />
</filter>
</svg>
<!-- ========== HALF COLOR ANAGLYPH ========================== -->
<p><img src="https://github.com/raphikWasHere/anaglyph-method-comparison/blob/main/gafasRC.png?raw=true"><b> Half Color Anaglyph</b></br>
<object class="anaglyph">
<img class="left glyph" style="filter: url(#leftHalfColor); ">
<img class="right glyph" style="filter: url(#rightHalfColor); ">
</object>
<svg width=0 height=0>
<filter id="leftHalfColor"><feColorMatrix type="matrix"
values="0.299 0.547 0.114 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 1 0" />
</filter>
<filter id="rightHalfColor"><feColorMatrix type="matrix"
values="0.000 0.000 0.000 0 0
0.000 1.000 0.000 0 0
0.000 0.000 1.000 0 0
0.000 0.000 0.000 1 0" />
</filter>
</svg>
<!-- ========== OPTIMIZED ANAGLYPH =========================== -->
<p><img src="https://github.com/raphikWasHere/anaglyph-method-comparison/blob/main/gafasRC.png?raw=true"><b> Optimized Anaglyph</b></br>
<object class="anaglyph">
<img class="left glyph" style="filter: url(#leftOptimized); ">
<img class="right glyph" style="filter: url(#rightOptimized) url(#gammaRedChannel); ">
</object>
<svg width=0 height=0>
<filter id="leftOptimized"><feColorMatrix type="matrix"
values="0.000 0.700 0.300 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 0 0
0.000 0.000 0.000 1 0" />
</filter>
<filter id="rightOptimized"><feColorMatrix type="matrix"
values="0.000 0.000 0.000 0 0
0.000 1.000 0.000 0 0
0.000 0.000 1.000 0 0
0.000 0.000 0.000 1 0" />
</filter>
<filter id="gammaRedChannel">
<feComponentTransfer>
<feFuncR type="gamma" amplitude="1.5"></feFuncR>
<feFuncG type="gamma" amplitude="1.5"></feFuncG>
<feFuncB type="gamma" amplitude="1.5"></feFuncB>
</feComponentTransfer>
</filter>
</svg>
<!-- ========== Linear Projection Method ANAGLYPH ============ -->
<p><img src="https://github.com/raphikWasHere/anaglyph-method-comparison/blob/main/gafasRC.png?raw=true"><b> Linear Projection Anaglyph (Vu M. Tran method)</b></br>
<object class="anaglyph">
<img class="left glyph" style="filter: url(#leftLinearProjection); ">
<img class="right glyph" style="filter: url(#rightLinearProjection); ">
</object>
<svg width=0 height=0>
<filter id="leftLinearProjection"><feColorMatrix type="matrix"
values="+0.3224 +0.4951 +0.2534 0 0
-0.0436 -0.0616 -0.0460 0 0
-0.0393 -0.0606 +0.0017 0 0
0.0000 0.0000 0.0000 1 0" />
</filter>
<filter id="rightLinearProjection"><feColorMatrix type="matrix"
values="-0.0121 -0.0472 -0.0115 0 0
+0.2847 +0.8588 +0.0077 0 0
-0.0009 -0.0614 +1.1605 0 0
0.0000 0.0000 0.0000 1 0" />
</filter>
</svg>
<p><small>:P 2023 raphik</small>
<p>
</body>
</html>