This file is indexed.

/usr/share/doc/munipack/itone.html is in munipack-doc 0.5.10-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- meta -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="description" content="A general astronomical image processing software">
<meta name="author" content="Filip Hroch">
<link href="news_feed.xml" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed" />
<link type="text/css" rel="stylesheet" href="munipack.css">
<link rel="shortcut icon" href="favicon.ico">
<title>Munipack ‒ HDR Rendering</title>
</head>
<body>
<header>
<a href="munipack.html"><img src="title_logo.png" alt="Munipack's logo" class="head"></a>
<div class="headhead">
<div class="headtitle">
<a class="headtitle" href="munipack.html">Munipack</a>
<a class="headsubtitle" href="munipack.html">A general astronomical image processing software</a>
</div>
<ul class="menu">
  <li class="menu"><a href="docs.html" class="menu">Documents</a></li>
  <li class="menu"><a href="guide.html" class="menu">User guide</a></li>
</ul>
</div>
</header>

<h1 class="noindent">HDR Rendering</h1>

<p class="abstract">
A mapping of high dynamical range of astronomical images
to limited range of display devices is crucial for
best user visual experience. There are described rendering methods used
by Munipack.
</p>

<p>
<a href="ftp://munipack.physics.muni.cz/pub/munipack/munipack-data.tar.gz" class="download">Sample data</a>
</p>

<h2>Introduction</h2>

<p>
The dynamical range of a standard CCD camera is over 65 thousand.
When any taken image is processed or single exposures are composed,
its range can be expanded. Also frequently the images can be calibrated
to a physical quantities. Therefore the range of images must be
supposed to be unlimited (usually in interval zero to positive infinity).
Moreover, a typical processed image has dynamical range spread over many orders.
Unfortunately, the display range of conventional device is just only
256 levels (limits by both display devices and by software).
Methods for mapping of an principially unlimited dynamical range
to a limited range are discussed here.
</p>

<p class="indent">
By method, it is possible to use global or local mapping techniques.
The global mapping stretch full range to a predefined range by a global
transformation function (acting on all pixels equivalently).
The local mapping adapts the transformation according to values actual
pixels. The local technique would remove large structures
from image and shows only local rapid changes.
Local techniques simulates perception of human eye. Munipack
currently implements only global techniques.
</p>

<h1>Linear mapping</h1>

<p>
The linear mapping simply converts a wide range (represented
usually by numbers from the real set) to a limited interval
with linear scaling and cut-off. The linear scaling is represented by
</p>
<p>
<i>i = B + S · I,</i>
</p>
<p>
where <i>i</i> is a display intensity, <i>I</i> is an original intensity.
The parameter <i>B</i> (black level) sets the intensity level
in an original picture corresponding to black color on the display. The slope
<i>S</i> determines the intensity range which will be displayed.
The intensities out of display range are cut-offed. Lower intensities
to black and higher ones to white.
</p>

<p class="indent">
The parameters are not orthogonal. The change of both will brighten
or darken the picture but the results will be different. There is no
known widely used orthogonal set of parameters.
</p>

<table>
<tr>
  <td class="blank"><img alt="B=0, S=1/4096" src="tone11.png">
     <div class="caption"><i>B=0, S=1/4096</i></div>
 </td>
  <td class="blank"><img alt="B=2048, S=1/1024" src="tone21.png">
      <div class="caption"><i>B=2048, S=1/1024</i></div>
  </td>
</tr>
<tr>
  <td class="blank"><img alt="B=0, S=1/16384" src="tone12.png">
      <div class="caption"><i>B=0, S=1/16384</i></div>
  </td>
  <td class="blank"><img alt="B=3072, S=1/1024" src="tone22.png">
      <div class="caption"><i>B=3072, S=1/1024</i></div>
  </td>
</tr>
<tr>
  <td class="blank"><img alt="B=0, S=1/65536" src="tone13.png">
      <div class="caption"><i>B=0, S=1/65536</i></div>
  </td>
  <td class="blank"><img alt="B=4096, S=1/1024" src="tone23.png">
      <div class="caption"><i>B=4096, S=1/1024</i></div>
  </td>
</tr>
</table>

<h2>Relation to contrast/luminosity</h2>

<p>
The direct use of <a href="http://en.wikipedia.org/wiki/Contrast_(vision)">contrast/luminosity</a> parameters for adjusting of range is not possible
due to principal difference of both operations.
</p>

<p class="indent">
There is an weak analogy between black and slope parameters and widely
known contrast and brightness parameters. The black corresponds to
brightness and contrast corresponds to slope. The formal definition
and usage of both twines of parameters is different.
On the other side, the practical usage of both parameters is similar.
</p>



<h2>Estimation of black and slope parameters</h2>

<p>
Munipack has included empirical estimate of parameters on base of
descriptive statistics.
</p>

<p>
Lets median of selected pixels of an image is
</p>
<p>
 <i>D</i><sub>med</sub> = med <i>D<sub>ij</sub>,</i>
</p>
<p>
and median of absolute deviations of the image is
</p>
<p>
<i>D</i><sub>mad</sub>=  med |<i>D<sub>ij</sub> - D</i><sub>med</sub>|,
</p>
<p>
than the parameters are initially estimated to
</p>
<p>
<i>B = D</i><sub>med</sub> - <i>k D</i><sub>mad</sub>,<br>
<i>S = 1 / w D</i><sub>mad</sub>.
</p>
<p>
Ones are choose to <i>k = 0, w = 30</i>.
</p>

<p class="indent">
The estimator and parameters has been determined empirically by visually
comparing
of set of images with different parameters. The algorithm perfectly
works on images with Gaussian-like histogram. The prototype of the images
can be a sparse stars sky field. The
histogram is mostly composed from the noise of the sky. Stars have just
only marginally importance. Images with non-Gaussian histogram
are estimated poorly by the way.
</p>

<p class="indent">
The estimator uses just only a few thousands of pixels in selected
regular grid covering of full frame. The median is used as estimator
of mean. The use of arithmetical mean
does not work at all because one is too sensitive to outliners.
</p>

<figure>
<img class="figure" alt="tone.png" src="tone.png">
<figcaption>
<i>B=2936, slope=1/780,</i> <i>S</i><sub>med</sub> = 2936,
<i>S</i><sub>mad</sub>= 26.
</figcaption>
</figure>

<h1>Non-linear mapping</h1>

<p>
The values prescaled by the above linear transformation can be directly
used in more general transformation:
<p>
<i>  i' = f<sub>0</sub> · f(i) + z,</i>
</p>
<p>
where <i>f<sub>0</sub></i> and scales and <i>z</i> vertically shifts
the function. Available functions are:
</p>

<table>
<caption>Tone functions <i>f(i)</i></caption>
<tr><th>Function</th><th>Description</th></tr>
<tr><td>asinh</td><td>Wide range without background noise. Intended for general usage. Suggested by <a href="http://adsabs.harvard.edu/abs/2004PASP..116..133L">Lupton et al. (2004)</a></td></tr>
<tr><td>log</td><td>Simulates magnitudes. Emphasizes details on
background. On high levels similar to asinh.</td></tr>
<tr><td>sqrt</td><td>Similar to log. Inspired by ds9 (saoimage).</td></tr>
<tr><td>gamma</td><td>Gamma function with power 1/4.2 (as in sRGB). Just only for comparison.</td></tr>
<tr><td>normal</td><td>Normal ‒ Gaussian ‒ distribution function (integral of Gaussian hat). As the simulation of gradation curve of classical photography.</td></tr>
<tr><td>logistic</td><td>Logistic function. The similar usage as for normal</td></tr>
<tr><td>atan</td><td>Arc tan. The similar usage as for normal</td></tr>
<tr><td>square</td><td>Square has opposite curvature to all others. Emphasizes low-contrast details in noise background.</td></tr>
</table>

<p>
&nbsp;
</p>

<table>
<tr>
  <td class="blank"><img alt="linear" src="tone.png"><br>linear</td>
  <td class="blank"><img alt="asinh"  src="tone1.png"><br>asinh</td>
</tr>
<tr>
  <td class="blank"><img alt="log" src="tone2.png"><br>log</td>
  <td class="blank"><img alt="sqrt" src="tone3.png"><br>sqrt</td>
</tr>
<tr>
  <td class="blank"><img alt="gamma"  src="tone4.png"><br>gamma</td>
  <td class="blank"><img alt="normal" src="tone5.png"><br>normal</td>
</tr>
<tr>
  <td class="blank"><img alt="logistic" src="tone6.png"><br>logistic</td>
  <td class="blank"><img alt="atan"     src="tone7.png"><br>atan</td>
</tr>
<tr>
  <td class="blank"><img alt="square" src="tone8.png"><br>square</td>
  <td class="blank">&nbsp;</td>
</tr>
</table>



<h1>Gamma correction</h1>

<p>
Mostly (all) widely used displays are using the gamma correction. The correction
transforms already mapped <i>i</i> so response on linear stimulus
in input intensity is linear response (humans perception).
</p>
<p>
The gamma correction takes the form
</p>
<p>
<i>
 i'  = i<sup>1/γ</sup>,
</i>
</p>
<p>
where <i>γ</i> is 4.2 for sRGB and 4.0 for AdobeRGB display. Without
the correction, images appears too dim.
</p>


<figure>
<img class="figure" alt="nogamma" src="tone-nogamma.png">
<figcaption>
How did looks images in deep dark ages when gamma correction has not been discovered yet.
</figcaption>
</figure>

<h1>Color images</h1>

<p>
In case of color images, the scaled component is not more directly
the intensity but the <i>L</i> component of
<a href="http://en.wikipedia.org/wiki/CIELUV_color_space">CIE Luv color
space</a>:
</p>
<p>
<!--L' =  Itt(L).-->
<i>I ≡ L = 116 Y<sup>1/3</sup> - 16.</i>
</p>
<p>
The colors itself are untouched. The scaled value <i>I'</i> and color is than
transformed back to
<a href="http://en.wikipedia.org/wiki/CIE_1931_color_space">CIE XYZ.</a>
The reason of the technique is saving of colors. Without
the transformation colors are deformed and does not corresponds to
human perception.
</p>

<table>
<tr>
  <td class="blank"><img alt="" src="toneC1.png"><div class="caption"><i>B=0, S=1/1024</i></div></td>
  <td class="blank"><img alt="" src="toneC2.png"><div class="caption"><i>B=0, S=1/4096</i></div></td>
</tr>
<tr>
  <td class="blank"><img alt="" src="toneC3.png"><div class="caption"><i>B=0, S=1/16384</i></div></td>
  <td class="blank"><img alt="" src="toneC4.png"><div class="caption"><i>B=0, S=1/65536</i></div></td>
</tr>
</table>


<h1>Graphical controls</h1>

<p>
Full access to tone tuning is available via a graphical interface.
</p>

<p>
<img alt="controls" src="Screenshot-m27_R.png" style="width:100%">
</p>

<h1>The algorithm</h1>

<p>
The algorithm as is implemented in <samp>xmunipack/fitsimage.cpp.</samp>
</p>


<footer>
<div style="float:left; margin-left:2em;">
Copyright &copy; 1997 – 2018
Filip Hroch (<a style="text-decoration: none" href="mailto:hroch@physics.muni.cz?Subject=Munipack" title="Author's Email"></a>), license <a href="http://www.gnu.org/licenses/gpl.html">GPLv3</a>.
</div>
<div style="float:right; margin-right:2em; margin-top:-0.2em;">
<a href="http://monteboo.blogspot.com/search/label/Munipack" title="Munipack on MonteBoo Blog"><img src="favicon-blogger.png" alt="Blogger"></a>
<a href="http://www.muni.cz/?lang=en" title="Masaryk University in Brno, Czech Republic"><img src="mu-logo.png" alt="Masaryk University"></a>
<a href="news_feed.xml" title="Munipack's Releases in Atom Syndication Format"><img src="Feed-icon.png" alt="Atom Feed"></a>
</div>
</footer>

</body>
</html>