~ubuntu-branches/ubuntu/trusty/enblend-enfuse/trusty

« back to all changes in this revision

Viewing changes to .pc/0001-Change-all-texinfo-variable-names-to-alpha-nums.patch/doc/enfuse.texi

  • Committer: Package Import Robot
  • Author(s): Jackson Doak
  • Date: 2014-01-22 06:23:44 UTC
  • mfrom: (5.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20140122062344-gdj5nf671oxprqq7
Tags: 4.1.2+dfsg-2ubuntu1
* Merge from Debian, remaining changes:
  - Build-depend on libglew-dev rather than libglew1.5-dev | libglew1.4-dev
    | libglew-dev.
  - Build using -O1 on arm

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\input auxmac
 
2
\input texinfo
 
3
 
 
4
 
 
5
@c
 
6
@c Header
 
7
@c
 
8
 
 
9
@c %**start of header
 
10
@setfilename enfuse.info
 
11
@include versenfuse.texi
 
12
@settitle Fusing Multiple Images with Enfuse @value{VERSION}
 
13
@include auxmac.texi
 
14
@include varsenfuse.texi
 
15
@include config-h.texi
 
16
 
 
17
@set default-image-cache-cachesize 1024@dmn{MB}
 
18
@set default-image-cache-blocksize 2048@dmn{KB}
 
19
 
 
20
@c Define a new index for syntactic comments.
 
21
@defcodeindex sc
 
22
@c Define a new index for options.
 
23
@defcodeindex op
 
24
@c %**end of header
 
25
 
 
26
 
 
27
@c
 
28
@c Categorization for the GNU Info System
 
29
@c
 
30
 
 
31
@dircategory Individual utilities
 
32
 
 
33
@direntry
 
34
* enfuse: (enfuse).                     Fuse images using a multiresolution spline.
 
35
@end direntry
 
36
 
 
37
 
 
38
@c
 
39
@c Summary Description and Copyright
 
40
@c
 
41
 
 
42
@copying
 
43
This manual is for Enfuse (version @value{VERSION}, @value{UPDATED}),
 
44
a program to merge different exposures of the same scene to produce an
 
45
image that looks much like a tonemapped image.
 
46
 
 
47
Copyright @copyright{} 2004--2012 @sc{Andrew Mihal}.
 
48
 
 
49
@quotation
 
50
Permission is granted to copy, distribute and/or modify this document
 
51
under the terms of the @acronym{GNU} Free Documentation License,
 
52
Version 1.2 or any later version published by the Free Software
 
53
Foundation; with no Invariant Sections, no Front-Cover Texts and no
 
54
Back-Cover Texts.  A copy of the license is included in the section
 
55
entitled ``@acronym{GNU} Free Documentation License''.
 
56
@end quotation
 
57
@end copying
 
58
 
 
59
 
 
60
@c
 
61
@c Title Page and Copyright
 
62
@c
 
63
 
 
64
@titlepage
 
65
@title Enfuse
 
66
@subtitle Fusing Multiple Images
 
67
@subtitle with Enfuse version @value{VERSION}, @value{UPDATED}
 
68
 
 
69
@author Andrew Mihal
 
70
 
 
71
@page
 
72
@vskip 0pt plus 1fill
 
73
@insertcopying
 
74
@end titlepage
 
75
 
 
76
 
 
77
@ifnothtml
 
78
@summarycontents
 
79
@end ifnothtml
 
80
@contents
 
81
 
 
82
 
 
83
@c For the TeX output the List-of-Tables and List-of-Figures appear
 
84
@c right after the Table-of-Contents.  In all other formats they go
 
85
@c right before the indices.
 
86
@iftex
 
87
@c Adjust page number so that we get roman numerals for the
 
88
@c List-of-Tables and List-of-Figures.  This screws up Texinfo's page
 
89
@c count so that we must undo it later.
 
90
@tex
 
91
\global\pageno=-4
 
92
@end tex
 
93
 
 
94
@unnumbered List of Tables
 
95
@listoffloats Table
 
96
 
 
97
 
 
98
@unnumbered List of Figures
 
99
@listoffloats Figure
 
100
@end iftex
 
101
 
 
102
 
 
103
@c
 
104
@c ``Top'' Node and Master Menu
 
105
@c
 
106
 
 
107
@ifnottex
 
108
@node Top
 
109
@top Enfuse
 
110
 
 
111
This manual is for Enfuse (version@tie{}@value{VERSION},
 
112
@value{UPDATED}), a program to merge different exposures of the same
 
113
scene to produce an image that looks much like a tonemapped image.
 
114
@end ifnottex
 
115
 
 
116
@menu
 
117
* Overview::                    Overview of Enfuse's features
 
118
* Workflow::                    Enfuse's role in combining images
 
119
* Invocation::                  Command line options and arguments
 
120
* Color Profiles::              How Enblend handles @acronym{ICC} color profiles
 
121
* Weighting Functions::         Description of all weighting functions
 
122
* Understanding Masks::         How to interpret masks and mask files
 
123
* Tuning Memory Usage::         Balancing @acronym{RAM} and swap
 
124
* Applications::                Possible applications of Enfuse
 
125
* Helpful Programs::            Useful other programs
 
126
* Bug Reports::                 How to write bug reports
 
127
* Authors::                     Major contributors
 
128
* FDL::                         @acronym{GNU} Free Documentation License
 
129
@ifnotdocbook
 
130
* List of Tables::              List of all tables
 
131
* List of Figures::             List of all figures
 
132
* Program Index::               Names of programs referenced
 
133
* Syntactic-Comment Index::     Keys of syntactic comments
 
134
* Option Index::                Index of all options
 
135
* General Index::               Topic index
 
136
@end ifnotdocbook
 
137
 
 
138
@detailmenu
 
139
 
 
140
--- The Detailed Node Listing ---
 
141
 
 
142
Overview
 
143
 
 
144
Workflow
 
145
 
 
146
* Standard Workflow::           The usual, all-in-one thing
 
147
* External Mask Manipulation::  Fiddling around with the masks yourself
 
148
 
 
149
 
 
150
Invocation
 
151
 
 
152
* Common Options::              General options
 
153
* Extended Options::            Memory control and others
 
154
* Fusion Options::              Image fusion control
 
155
* Expert Options::              Local contrast and local entropy selection configuration
 
156
* Option Delimiters::           How to separate options' arguments
 
157
 
 
158
Color Profiles
 
159
 
 
160
Weighting Functions
 
161
 
 
162
* Weighting Pixels::            General concept of weighting pixels
 
163
* Exposure Weighting::          Weighting by exposure
 
164
* Saturation Weighting::        Weighting by saturation
 
165
* Local Contrast Weighting::    Weighting by local contrast
 
166
* Local Entropy Weighting::     Weighting by local entropy
 
167
 
 
168
Weighting Algorithms
 
169
 
 
170
* Weighted Average::            Enfuse's default weighting algorithm
 
171
* Disabling Averaging::         ``Super Trouper'' weighting for focus stacks
 
172
 
 
173
Local Contrast Weighting
 
174
 
 
175
* Standard Deviation::          Standard deviation (@acronym{SDev}) in a square of pixels
 
176
* Laplacian of Gaussian::       @acronym{LoG}, a second derivative method
 
177
* Blend SDev and LoG::          Mix both methods
 
178
* Scaling and Choice of Mode::  How parameters do not scale; neither does mode
 
179
 
 
180
Understanding Masks
 
181
 
 
182
Tuning Memory Usage
 
183
 
 
184
Applications
 
185
 
 
186
* What Images::                 What makes images fusable?
 
187
* Repetition::                  Just taking the same shot multiple times
 
188
* Exposure Series::             Varying the exposure time
 
189
* Flash Exposure Series::       Varying the flash output
 
190
* Polarization Series::         Changing the polarizer angle
 
191
* Focus Stacks::                Stacking images with different in-focus distance
 
192
 
 
193
Exposure Series
 
194
 
 
195
* Exposure Series Tips::            Some hints for beginners
 
196
* Exposure Series Misconceptions::  What works despite the hype
 
197
 
 
198
Focus Stacks
 
199
 
 
200
* Why Focus Stacks::            Why take the hassle?
 
201
* Preparing Focus Stacks::      How to get suitable input images
 
202
* Local Contrast Based Fusing:: Fundamental command line options
 
203
* Basic Focus Stacking::        Simple, standard deviation method
 
204
* Advanced Focus Stacking::     Advanced, Laplacian technique
 
205
* Expert Stacking::             Tips for focus stacking experts
 
206
 
 
207
Advanced Focus Stacking
 
208
 
 
209
* Local Contrast Problem::        What is the problem Kenneth?
 
210
* Laplacian Edge Detection::      Using a Laplacian-of-Gaussian to detect edges
 
211
* Local Contrast Enhancement::    Boosting local contrast before weighting
 
212
* Suppressing Noise or Recognizing Faint Edges::  The best of both worlds
 
213
* Focus Stacking Decision Tree::  What to do and how to fuse
 
214
 
 
215
Helpful Programs
 
216
 
 
217
Bug Reports
 
218
 
 
219
Authors
 
220
 
 
221
FDL
 
222
@end detailmenu
 
223
@end menu
 
224
 
 
225
 
 
226
@c
 
227
@c Document Body
 
228
@c
 
229
 
 
230
@node Overview
 
231
@chapter Overview
 
232
 
 
233
@c Undo the roman page numbering we used for the Table-of-Contents,
 
234
@c the List-of-Tables, and the List-of-Figures.
 
235
@tex
 
236
\global\pageno=1
 
237
@end tex
 
238
 
 
239
@cindex overview
 
240
 
 
241
@cindex Mertens-Kautz-Van Reeth exposure fusion
 
242
Enfuse merges overlapping images using the
 
243
@sc{Mertens}-@sc{Kautz}-@sc{Van Reeth} exposure fusion
 
244
algorithm.@footnote{Tom Mertens, Jan Kautz, and Frank van Reeth,
 
245
``Exposure Fusion'', Proceedings of the 15th Pacific Conference on
 
246
Computer Graphics and Applications, pages 382--390.}  This is a quick
 
247
way for example to blend differently exposed images into a nice output
 
248
image, without producing intermediate high-dynamic range
 
249
(@acronym{HDR}) images that are then tonemapped to a viewable image.
 
250
This simplified process often works much better than tonemapping
 
251
algorithms.
 
252
 
 
253
Enfuse can also be used to build extended depth-of-field
 
254
(@acronym{DOF}) images by blending a focus stack.
 
255
 
 
256
The idea is that pixels in the input images are weighted according to
 
257
qualities such as, for example, proper exposure, good local contrast,
 
258
or high saturation.  These weights determine how much a given pixel
 
259
will contribute to the final image.
 
260
 
 
261
@cindex Burt-Adelson multiresolution spline
 
262
A @sc{Burt}-@sc{Adelson} multiresolution spline blender@footnote{Peter
 
263
J. Burt and Edward H. Adelson, ``A Multiresolution Spline With
 
264
Application to Image Mosaics'', @acronym{ACM} Transactions on
 
265
Graphics, @abbr{Vol@.}  2, @abbr{No@.} 4, October 1983, pages
 
266
217--236.} is used to combine the images according to the weights.
 
267
The multiresolution blending ensures that transitions between regions
 
268
where different images contribute are difficult to spot.
 
269
 
 
270
Enfuse uses up to four criteria to judge the quality of a pixel, which
 
271
@ref{Table:weighting-criteria} briefly describes.
 
272
 
 
273
@float Table,Table:weighting-criteria
 
274
@table @asis
 
275
@dbtitle{Weighting Criteria}
 
276
@item Exposure
 
277
@cindex weighting, exposure
 
278
The exposure criteria favors pixels with luminance close to the middle
 
279
of the range.  These pixels are considered better exposed than those
 
280
with high or low luminance levels.
 
281
 
 
282
@item Saturation
 
283
@cindex weighting, saturation
 
284
The saturation criteria favors highly-saturated pixels.  (Note that
 
285
saturation is only defined for color pixels.)
 
286
 
 
287
@item Local Contrast
 
288
@cindex weighting, local contrast
 
289
The contrast criteria favors pixels inside a high-contrast
 
290
neighborhood.  Enfuse can use standard deviation, Laplacian magnitude,
 
291
or a blend of both as local contrast measure.
 
292
 
 
293
@item Local Entropy
 
294
@cindex weighting, local entropy
 
295
The entropy criteria prefers pixels inside a high-entropy
 
296
neighborhood.  In addition, Enfuse allows the user to mitigate the
 
297
problem of noisy images when using entropy weighting by setting a
 
298
black threshold.
 
299
@end table
 
300
 
 
301
@caption{Enfuse's four weighting criteria.  (Also see @ref{Table:default-weights} for the default weights of these criteria.)}
 
302
 
 
303
@shortcaption{Weighting criteria}
 
304
@end float
 
305
 
 
306
For the concept of pixel weighting, and details on the different
 
307
weighting functions, see @ref{Weighting Functions}.
 
308
 
 
309
Adjust how much importance is given to each criterion by setting the
 
310
weight parameters on the command line.  For example, if you set
 
311
@samp{--exposure-weight=1.0} and @samp{--saturation-weight=0.5},
 
312
Enfuse will favor well-exposed pixels over highly-saturated pixels
 
313
when blending the source images.  The effect of these parameters on
 
314
the final result will not always be clear in advance.  The quality of
 
315
the result is subject to your artistic interpretation.  Playing with
 
316
the weights may or may not give a more pleasing result.  The authors
 
317
encourage you to experiment, perhaps using
 
318
down-sized@footnote{Downsampling with a good interpolator reduces
 
319
noise, which might not desired to judge the image quality of the
 
320
original-size image.  Cropping might be an alternative, though.} or
 
321
cropped images for speed.
 
322
 
 
323
@cindex alpha channel
 
324
@cindex channel, alpha
 
325
Enfuse expects but does not require each input image to have an alpha
 
326
channel.  By setting the alpha values of pixels to zero, users can
 
327
manually remove those pixels from consideration when blending.  If an
 
328
input image lacks an alpha channel, Enfuse will issue a warning and
 
329
continue assuming all pixels should contribute to the final output.
 
330
Any alpha value other than zero is interpreted as ``this pixel should
 
331
contribute to the final image''.
 
332
 
 
333
@cindex multi-layer image
 
334
@cindex image, multi-layer
 
335
@cindex multi-directory @acronym{TIFF}
 
336
@cindex @acronym{TIFF}, multi-directory
 
337
@cindex @command{tiffcopy}
 
338
@cindex @command{tiffsplit}
 
339
Enfuse reads all layers of multi-layer images, like, for example,
 
340
multi-directory @acronym{TIFF} images@footnote{Use utilities like,
 
341
e.g., @command{tiffcopy} and @command{tiffsplit} of LibTIFF to
 
342
manipulate multi-directory @acronym{TIFF} images.  @xref{Helpful
 
343
Programs}.}.  The input images are processed in the order they appear
 
344
on the command line.  Multi-layer images are processed from the first
 
345
layer to the last before Enfuse considers the next image on the
 
346
command line.
 
347
 
 
348
@cindex SourceForge
 
349
Find out more about Enfuse on its @uref{http://@/sourceforge.net/,
 
350
SourceForge} @uref{http://@/enblend.sourceforge.net/, web page}.
 
351
 
 
352
 
 
353
@node Workflow
 
354
@chapter Workflow
 
355
@cindex workflow
 
356
 
 
357
Enfuse is a part of a chain of tools to assemble images.  It merges
 
358
photos of the same subject at the same location and same direction,
 
359
but taken with varying exposure parameters.
 
360
 
 
361
@menu
 
362
* Standard Workflow::           The usual, all-in-one thing
 
363
* External Mask Manipulation::  Fiddling around with the masks yourself
 
364
@end menu
 
365
 
 
366
 
 
367
@node Standard Workflow
 
368
@section Standard Workflow
 
369
@cindex workflow, standard
 
370
 
 
371
@include workflow.texi
 
372
 
 
373
 
 
374
@node External Mask Manipulation
 
375
@section External Mask Manipulation
 
376
@cindex workflow, external mask manipulation
 
377
 
 
378
@include external-masks.texi
 
379
 
 
380
 
 
381
@node Invocation
 
382
@chapter Invocation
 
383
@cindex invocation
 
384
 
 
385
@command{enfuse} [@var{OPTIONS}] [@code{--output=}@var{IMAGE}]
 
386
@var{INPUT}@enddots{}
 
387
 
 
388
@noindent
 
389
Fuse the sequence of images @var{INPUT}@dots{} into a single
 
390
@var{IMAGE}.
 
391
 
 
392
@cindex literal filename
 
393
@cindex filename, literal
 
394
@cindex response file
 
395
Input images are either specified literally or via so-called response
 
396
files (see below).  The latter are an alternative to specifying image
 
397
filenames on the command line.
 
398
 
 
399
 
 
400
@menu
 
401
* Image Requirements::          Input image requirements
 
402
* Response Files::              Files listing the images' names
 
403
* Common Options::              General options
 
404
* Extended Options::            Memory control and others
 
405
* Fusion Options::              Image fusion control
 
406
* Expert Options::              Local contrast and local entropy selection configuration
 
407
* Option Delimiters::           How to separate options' arguments
 
408
@end menu
 
409
 
 
410
 
 
411
@node Image Requirements
 
412
@section Image Requirements
 
413
@cindex input image requirements
 
414
 
 
415
All input images must comply with the following requirements.
 
416
 
 
417
@itemize
 
418
@item
 
419
The images overlap.
 
420
 
 
421
@item
 
422
The images agree on their number of bits-per-channel, this is, their
 
423
``depth'':
 
424
@itemize --
 
425
@item
 
426
@code{UINT8},
 
427
@item
 
428
@code{UINT16},
 
429
@item
 
430
@code{FLOAT},
 
431
@item
 
432
etc.
 
433
@end itemize
 
434
 
 
435
See option@tie{}@option{--depth} below for an explanation of different
 
436
(output) depths.
 
437
 
 
438
@item
 
439
Enfuse understands the images' filename extensions as well as their
 
440
file formats.
 
441
 
 
442
You can check the supported extensions and formats by calling Enfuse
 
443
with the option pair @option{--version@tie{}--verbose} and scan the
 
444
output for @samp{Supported image formats} or @samp{Supported file
 
445
extensions}.
 
446
@end itemize
 
447
 
 
448
Moreover, there are some ``good practices'', which are not enforced by
 
449
the application, but almost certainly deliver superior results.
 
450
 
 
451
@itemize
 
452
@item
 
453
Either all files lack an @acronym{ICC} profile, or all images are
 
454
supplied with the @emph{same} @acronym{ICC} profile.
 
455
 
 
456
@item
 
457
If the images' meta-data contains resolution information
 
458
(``@acronym{DPI}''), it is the same for all pictures.
 
459
@end itemize
 
460
 
 
461
 
 
462
@node Response Files
 
463
@section Response Files
 
464
@cindex response file
 
465
 
 
466
@include filespec.texi
 
467
 
 
468
 
 
469
@node Common Options
 
470
@section Common Options
 
471
@cindex options, common
 
472
 
 
473
Common options control some overall features of Enfuse.
 
474
 
 
475
Enfuse accepts arguments to any option in uppercase as well as in
 
476
lowercase letters.  For example, @samp{deflate}, @samp{Deflate} and
 
477
@samp{DEFLATE} as arguments to the @code{--compression} option
 
478
described below, all instruct Enfuse to use the @sc{Deflate}
 
479
compression scheme.  This manual denotes all arguments in lowercase
 
480
for consistency.
 
481
 
 
482
@table @code
 
483
@item --compression=@var{COMPRESSION}
 
484
@opindex --compression
 
485
@cindex output file compression
 
486
@cindex compression
 
487
Write a compressed output file.
 
488
 
 
489
Depending on the output file format, Enfuse accepts different values
 
490
for @var{COMPRESSION}.
 
491
 
 
492
@table @asis
 
493
@item @acronym{JPEG} format.
 
494
@cindex @acronym{JPEG} compression
 
495
@cindex compression, @acronym{JPEG}
 
496
 
 
497
The compression either is a literal integer or a keyword-option
 
498
combination.
 
499
 
 
500
@table @code
 
501
@item @var{LEVEL}
 
502
Set @acronym{JPEG} quality@tie{}@var{LEVEL}, where @var{LEVEL} is an
 
503
integer that ranges from 0--100.
 
504
 
 
505
@item jpeg[:@var{LEVEL}]
 
506
Same as above; without the optional argument just switch on (standard)
 
507
@acronym{JPEG} compression.
 
508
 
 
509
@item jpeg-arith[:@var{LEVEL}]
 
510
@cindex arithmetic @acronym{JPEG} compression
 
511
@cindex compression, arithmetic @acronym{JPEG}
 
512
Switch on arithmetic @acronym{JPEG} compression.  With optional
 
513
argument set the arithmetic compression@tie{}@var{LEVEL}, where
 
514
@var{LEVEL} is an integer that ranges from 0--100.
 
515
@end table
 
516
 
 
517
@item @acronym{TIF} format.
 
518
Here, @var{COMPRESSION} is one of the keywords:
 
519
 
 
520
@table @code
 
521
@item none
 
522
Do not compress.  This is the default.
 
523
 
 
524
@item deflate
 
525
@cindex deflate compression
 
526
@cindex compression, deflate
 
527
Use the @sc{Deflate} compression scheme also called
 
528
@acronym{ZIP}-in-@acronym{TIFF}.  @sc{Deflate} is a lossless data
 
529
compression algorithm that uses a combination of the @acronym{LZ77}
 
530
algorithm and @sc{Huffman} coding.
 
531
 
 
532
@item jpeg[:@var{LEVEL}]
 
533
@cindex compression, @acronym{JPEG}
 
534
Use @acronym{JPEG} compression.  With optional argument set the
 
535
compression@tie{}@var{LEVEL}, where @var{LEVEL} is an integer that
 
536
ranges from 0--100.
 
537
 
 
538
@item lzw
 
539
@cindex @acronym{LZW} compression
 
540
@cindex compression, @acronym{LZW}
 
541
Use @sc{Lempel}-@sc{Ziv}-@sc{Welch} (@acronym{LZW}) adaptive
 
542
compression scheme.  @acronym{LZW} compression is lossless.
 
543
 
 
544
@item packbits
 
545
@cindex packbits compression
 
546
@cindex compression, packbits
 
547
Use @sc{PackBits} compression scheme.  @sc{PackBits} is a particular
 
548
variant of run-length compression; it is lossless.
 
549
@end table
 
550
 
 
551
@item Any other format.
 
552
Other formats do not accept a @var{COMPRESSION} setting.
 
553
 
 
554
However, @uref{http://@/hci.iwr.uni-@/heidelberg.de/@/vigra/,
 
555
@acronym{VIGRA}} automatically compresses @file{png}-files with the
 
556
@sc{Deflate} method.
 
557
@end table
 
558
 
 
559
@item --layer-selector=@var{ALGORITHM}
 
560
@opindex --layer-selector
 
561
@cindex layer selection
 
562
@cindex layer selection
 
563
Override the standard layer selector algorithm, which is
 
564
@samp{@value{src::layer-selector}}.
 
565
 
 
566
This version of Enfuse offers the following algorithms:
 
567
@table @code
 
568
@item all-layers
 
569
@cindex layer selection, all-layers
 
570
Select all layers in all images.
 
571
 
 
572
@item first-layer
 
573
@cindex layer selection, first-layer
 
574
Select only first layer in each multi-layer image.  For single-layer
 
575
images this is the same as @samp{all-layers}.
 
576
 
 
577
@item largest-layer
 
578
@cindex layer selection, largest-layer
 
579
Select largest layer in each multi-layer image, where the
 
580
``largeness'', this is the size is defined by the product of the layer
 
581
width and its height.  The channel width of the layer is ignored.  For
 
582
single-layer images this is the same as @samp{all-layers}.
 
583
 
 
584
@item no-layer
 
585
@cindex layer selection, no layer
 
586
Do not select any layer in any image.
 
587
 
 
588
This algorithm is useful to temporarily exclude some images in
 
589
response files.
 
590
@end table
 
591
 
 
592
@item -h
 
593
@itemx --help
 
594
@opindex -h
 
595
@opindex --help
 
596
Print information on the available options and exit.
 
597
 
 
598
@item -l @var{LEVELS}
 
599
@itemx --levels=@var{LEVELS}
 
600
@opindex -l
 
601
@opindex --levels
 
602
@cindex pyramid levels
 
603
@cindex levels, pyramid
 
604
Use at most this many @var{LEVELS} for pyramid @footnote{As
 
605
Dr.@tie{}Daniel Jackson correctly
 
606
@uref{http://stargate.wikia.com/@/wiki/@/The_@/Tomb, noted}, actually,
 
607
it is not a pyramid: ``Ziggaurat, it's a
 
608
@uref{http://en.wikipedia.org/@/wiki/@/Ziggaurat, Ziggaurat}.''}
 
609
blending if @var{LEVELS} is positive, or reduce the maximum number of
 
610
levels used by @minus{}@var{LEVELS} if @var{LEVELS} is negative;
 
611
@samp{auto} or @samp{automatic} restore the default, which is to use
 
612
the maximum possible number of levels for each overlapping region.
 
613
 
 
614
The number of levels used in a pyramid controls the balance between
 
615
local and global image features (contrast, saturation, @dots{}) in the
 
616
blended region.  Fewer levels emphasize local features and suppress
 
617
global ones.  The more levels a pyramid has, the more global features
 
618
will be taken into account.
 
619
 
 
620
As a guideline, remember that each new level works on a linear scale
 
621
twice as large as the previous one.  So, the zeroth layer, the
 
622
original image, obviously defines the image at single-pixel scale, the
 
623
first level works at two-pixel scale, and generally, the @math{n}-th
 
624
level contains image data at @power{2, n}-pixel scale.  This is the
 
625
reason why an image of
 
626
@math{width}@classictimes{}@/@math{height}@dmn{pixels} cannot be
 
627
deconstructed into a pyramid of more than
 
628
@ifinfo
 
629
@display
 
630
@math{floor(log_2(min(width, height)))}
 
631
@end display
 
632
@end ifinfo
 
633
@html
 
634
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
635
    <mrowinline>
 
636
        <mo>&LeftFloor;</mo>
 
637
        <mrowinline>
 
638
            <msubinline>
 
639
                <mo>log</mo>
 
640
                <mn>2</mo>
 
641
            </msubinline>
 
642
            <mo>&ApplyFunction;</mo>
 
643
            <mo>(</mo>
 
644
            <mrowinline>
 
645
                <mo>min</mo>
 
646
                <mo>&ApplyFunction;</mo>
 
647
                <mfencedinline>
 
648
                    <mi mathvariant="italic">width</mi>
 
649
                    <mi mathvariant="italic">height</mi>
 
650
                </mfencedinline>
 
651
            </mrowinline>
 
652
            <mo>)</mo>
 
653
        </mrowinline>
 
654
        <mo>&RightFloor;</mo>
 
655
    </mrowinline>
 
656
</mathinline>
 
657
@end html
 
658
@tex
 
659
$\lfloor \log_2(\min(\mathit{width}, \mathit{height})) \rfloor$
 
660
@end tex
 
661
@docbook
 
662
<inlineequation>
 
663
    <mml:math>
 
664
        <mml:apply>
 
665
            <mml:floor/>
 
666
            <mml:apply>
 
667
                <mml:log/>
 
668
                <mml:logbase>
 
669
                    <mml:cn>2</mml:cn>
 
670
                </mml:logbase>
 
671
                <mml:apply>
 
672
                    <mml:min/>
 
673
                    <mml:csymbol>
 
674
                        <mml:mi mathvariant="italic">width</mml:mi>
 
675
                    </mml:csymbol>
 
676
                    <mml:csymbol>
 
677
                        <mml:mi mathvariant="italic">height</mml:mi>
 
678
                    </mml:csymbol>
 
679
                </mml:apply>
 
680
            </mml:apply>
 
681
        </mml:apply>
 
682
    </mml:math>
 
683
</inlineequation>&nbsp;
 
684
@end docbook
 
685
levels.
 
686
 
 
687
If too few levels are used, ``halos'' around regions of strong local
 
688
feature variation can show up.  On the other hand, if too many levels
 
689
are used, the image might contain too much global features.  Usually,
 
690
the latter is not a problem, but is highly desired.  This is the
 
691
reason, why the default is to use as many levels as is possible given
 
692
the size of the overlap regions.  Enfuse may still use a smaller
 
693
number of levels if the geometry of the overlap region demands.
 
694
 
 
695
Positive values of @var{LEVELS} limit the maximum number of pyramid
 
696
levels.  Depending on the size and geometry of the overlap regions
 
697
this may or may not influence any pyramid.  Negative values of
 
698
@var{LEVELS} reduce the number of pyramid levels below the maximum no
 
699
matter what the actual maximum is and thus always influence all
 
700
pyramids.  Use @samp{auto} or @samp{automatic} as @var{LEVELS} to
 
701
restore the automatic calculation of the maximum number of levels.
 
702
 
 
703
The valid range of the absolute value of @var{LEVELS} is
 
704
@value{src::minimum-pyramid-levels} to
 
705
@value{src::maximum-pyramid-levels}.
 
706
 
 
707
@item -o
 
708
@itemx --output=@var{FILE}
 
709
@opindex -o
 
710
@opindex --output
 
711
Place output in @var{FILE}.
 
712
 
 
713
@cindex @file{@value{src::default-output-filename}}
 
714
@cindex default output filename
 
715
@cindex output filename, default
 
716
If @option{--output} is not specified, the default is to put the
 
717
resulting image in @file{@value{src::default-output-filename}}.
 
718
 
 
719
@item --parameter=@var{KEY}[=@var{VALUE}]:@dots{}
 
720
Set a @var{KEY}-@var{VALUE} pair, where @var{VALUE} is optional.  This
 
721
option is cumulative.  Separate multiple pairs with the usual numeric
 
722
delimiters.
 
723
 
 
724
This option has the negated form @option{--no-parameter},
 
725
@opindex --no-parameter
 
726
which takes one or more @var{KEY}s and removes them from the list of
 
727
defined parameters.  The special key@tie{}@samp{*} deletes all
 
728
parameters at once.
 
729
 
 
730
Parameters allow the developers to change the internal
 
731
workings of Enfuse without the need to recompile.
 
732
 
 
733
@item -v
 
734
@itemx --verbose[=@var{LEVEL}]
 
735
@opindex -v
 
736
@opindex --verbose
 
737
Without an argument, increase the verbosity of progress reporting.
 
738
Giving more @option{--verbose}@tie{}options will make Enfuse more
 
739
verbose.  Directly set a verbosity level with a non-negative integral
 
740
@var{LEVEL}.
 
741
 
 
742
Each level includes all messages of the lower levels.
 
743
 
 
744
@table @asis
 
745
@item Level
 
746
Messages
 
747
 
 
748
@item 0
 
749
only warnings and errors
 
750
 
 
751
@item 1
 
752
reading and writing of images
 
753
 
 
754
@item 2
 
755
mask generation, pyramid, and blending
 
756
 
 
757
@item 3
 
758
reading of response files, color conversions
 
759
 
 
760
@item 4
 
761
image sizes, bounding boxes and intersection sizes
 
762
 
 
763
@item 5
 
764
detailed information on the optimizer runs (Enblend only)
 
765
 
 
766
@item 6
 
767
estimations of required memory in selected processing steps
 
768
@end table
 
769
 
 
770
The default verbosity level of Enfuse is
 
771
@value{src::default-verbosity-level}.
 
772
 
 
773
@item -V
 
774
@itemx --version
 
775
@opindex -V
 
776
@opindex --version
 
777
Output information on the Enfuse version.
 
778
 
 
779
Team this option with @option{--verbose} to show configuration
 
780
details, like the extra features that have been compiled in.
 
781
 
 
782
@item -w
 
783
@itemx --wrap=@var{MODE}
 
784
@opindex -w
 
785
@opindex --wrap
 
786
@cindex 360@textdegree{} panoramas
 
787
@cindex wrap around
 
788
Blend around the boundaries of the panorama.
 
789
 
 
790
As this option significantly increases memory usage and computation
 
791
time only use it, if the panorama will be
 
792
 
 
793
@itemize
 
794
@item
 
795
consulted for any kind measurement, this is, all boundaries must match
 
796
as accurately as possible, or
 
797
 
 
798
@item
 
799
printed out and the boundaries glued together, or
 
800
 
 
801
@item
 
802
@cindex virtual reality
 
803
fed into a virtual reality (@abbr{VR}) generator, which creates a
 
804
seamless environment.
 
805
@end itemize
 
806
 
 
807
Otherwise, always avoid this option!
 
808
 
 
809
With this option, Enfuse treats the panorama of width@tie{}@math{w}
 
810
and height@tie{}@math{h} as an infinite data structure, where each
 
811
pixel@tie{}@math{P(x, y)} of the input images represents the set of
 
812
pixels
 
813
@ifinfo
 
814
@math{S_P(x, y)}
 
815
@end ifinfo
 
816
@html
 
817
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
818
    <mrowinline>
 
819
        <msubinline>
 
820
            <mi>S</mi>
 
821
            <mi>P</mi>
 
822
        </msubinline>
 
823
        <mfencedinline>
 
824
            <mi>x</mi>
 
825
            <mi>y</mi>
 
826
        </mfencedinline>
 
827
    </mrowinline>
 
828
</mathinline>
 
829
@end html
 
830
@tex
 
831
$S_P(x, y)$
 
832
@end tex
 
833
@docbook
 
834
<inlineequation>
 
835
    <mml:math>
 
836
        <mml:apply>
 
837
            <mml:csymbol>
 
838
                <mml:msub>
 
839
                    <mml:mi>S</mml:mi>
 
840
                    <mml:mi>P</mml:mi>
 
841
                </mml:msub>
 
842
            </mml:csymbol>
 
843
            <mml:ci>x</mml:ci>
 
844
            <mml:ci>y</mml:ci>
 
845
        </mml:apply>
 
846
    </mml:math>
 
847
</inlineequation>
 
848
@end docbook
 
849
@footnote{Solid-state physicists will be reminded of the
 
850
@uref{http://@/en.wikipedia.org/@/wiki/@/Born-@/von_@/Karman_@/boundary_@/condition,
 
851
@sc{Born}-@sc{von@tie{}K@'arm@'an} boundary condition}.}.
 
852
 
 
853
@var{MODE} takes the following values:
 
854
 
 
855
@table @samp
 
856
@item none
 
857
@itemx open
 
858
This is a ``no-op''; it has the same effect as not giving
 
859
@option{--wrap} at all.  The set of input images is considered open at
 
860
its boundaries.
 
861
 
 
862
@item horizontal
 
863
Wrap around horizontally:
 
864
@ifinfo
 
865
@display
 
866
@math{S_P(x, y) = @{P(x + m * w, y): m in Z@}.}
 
867
@end display
 
868
@end ifinfo
 
869
@html
 
870
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
871
    <mrow>
 
872
        <msub>
 
873
            <mi>S</mi>
 
874
            <mi>P</mi>
 
875
        </msub>
 
876
        <mfenced>
 
877
            <mi>x</mi>
 
878
            <mi>y</mi>
 
879
        </mfenced>
 
880
        <mo>=</mo>
 
881
        <mrow>
 
882
            <mo>&lcub;</mo>
 
883
            <mrow>
 
884
                <mi>P</mi>
 
885
                <mfenced>
 
886
                    <mrow>
 
887
                        <mi>x</mi>
 
888
                        <mo>+</mo>
 
889
                        <mi>m</mi>
 
890
                        <mo>&InvisibleTimes;</mo>
 
891
                        <mi>w</mi>
 
892
                    </mrow>
 
893
                    <mi>y</mi>
 
894
                </mfenced>
 
895
            </mrow>
 
896
            <mo>:</mo>
 
897
            <mrow>
 
898
                <mi>m</mi>
 
899
                <mtext>&ThickSpace;in&ThickSpace;</mtext>
 
900
                <mi>Z</mi>
 
901
            </mrow>
 
902
            <mo>&rcub;</mo>
 
903
        </mrow>
 
904
        <mtext>.</mtext>
 
905
    </mrow>
 
906
</math>
 
907
@end html
 
908
@tex
 
909
$$
 
910
    S_P(x, y) = \{P(x + m w, y): m \in Z\}.
 
911
$$
 
912
@end tex
 
913
@docbook
 
914
<informalequation>
 
915
    <mml:math>
 
916
        <mml:reln>
 
917
            <mml:eq/>
 
918
            <mml:apply>
 
919
                <mml:csymbol>
 
920
                    <mml:msub>
 
921
                        <mml:mi>S</mml:mi>
 
922
                        <mml:mi>P</mml:mi>
 
923
                    </mml:msub>
 
924
                </mml:csymbol>
 
925
                <mml:ci>x</mml:ci>
 
926
                <mml:ci>y</mml:ci>
 
927
            </mml:apply>
 
928
            <mml:set>
 
929
                <mml:bvar>
 
930
                    <mml:apply>
 
931
                        <mml:ci>P</mml:ci>
 
932
                        <mml:apply>
 
933
                            <mml:plus/>
 
934
                            <mml:ci>x</mml:ci>
 
935
                            <mml:apply>
 
936
                                <mml:times/>
 
937
                                <mml:ci>m</mml:ci>
 
938
                                <mml:ci>w</mml:ci>
 
939
                            </mml:apply>
 
940
                        </mml:apply>
 
941
                        <mml:ci>y</mml:ci>
 
942
                    </mml:apply>
 
943
                </mml:bvar>
 
944
                <mml:condition>
 
945
                    <mml:apply>
 
946
                        <mml:in/>
 
947
                        <mml:ci>m</mml:ci>
 
948
                        <mml:ci>Z</mml:ci>
 
949
                    </mml:apply>
 
950
                </mml:condition>
 
951
            </mml:set>
 
952
        </mml:reln>
 
953
    </mml:math>
 
954
</informalequation>
 
955
@end docbook
 
956
 
 
957
This is useful for 360@textdegree{} horizontal panoramas as it
 
958
eliminates the left and right borders.
 
959
 
 
960
@item vertical
 
961
Wrap around vertically:
 
962
@ifinfo
 
963
@display
 
964
@math{S_P(x, y) = @{P(x, y + n * h): m in Z@}.}
 
965
@end display
 
966
@end ifinfo
 
967
@html
 
968
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
969
    <mrow>
 
970
        <msub>
 
971
            <mi>S</mi>
 
972
            <mi>P</mi>
 
973
        </msub>
 
974
        <mfenced>
 
975
            <mi>x</mi>
 
976
            <mi>y</mi>
 
977
        </mfenced>
 
978
        <mo>=</mo>
 
979
        <mrow>
 
980
            <mo>&lcub;</mo>
 
981
            <mrow>
 
982
                <mi>P</mi>
 
983
                <mfenced>
 
984
                    <mi>x</mi>
 
985
                    <mrow>
 
986
                        <mi>y</mi>
 
987
                        <mo>+</mo>
 
988
                        <mi>n</mi>
 
989
                        <mo>&InvisibleTimes;</mo>
 
990
                        <mi>h</mi>
 
991
                    </mrow>
 
992
                </mfenced>
 
993
            </mrow>
 
994
            <mo>:</mo>
 
995
            <mrow>
 
996
                <mi>n</mi>
 
997
                <mtext>&ThickSpace;in&ThickSpace;</mtext>
 
998
                <mi>Z</mi>
 
999
            </mrow>
 
1000
            <mo>&rcub;</mo>
 
1001
        </mrow>
 
1002
        <mtext>.</mtext>
 
1003
    </mrow>
 
1004
</math>
 
1005
@end html
 
1006
@tex
 
1007
$$
 
1008
    S_P(x, y) = \{P(x, y + n h): n \in Z\}.
 
1009
$$
 
1010
@end tex
 
1011
 
 
1012
This is useful for 360@textdegree{} vertical panoramas, as it
 
1013
eliminates the top and bottom borders.
 
1014
 
 
1015
@item both
 
1016
@itemx horizontal+vertical
 
1017
@itemx vertical+horizontal
 
1018
Wrap around both horizontally and vertically:
 
1019
@ifinfo
 
1020
@display
 
1021
@math{S_P(x, y) = @{P(x + m * w, y + n * h): m, n in Z@}.}
 
1022
@end display
 
1023
@end ifinfo
 
1024
@html
 
1025
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
1026
    <mrow>
 
1027
        <msub>
 
1028
            <mi>S</mi>
 
1029
            <mi>P</mi>
 
1030
        </msub>
 
1031
        <mfenced>
 
1032
            <mi>x</mi>
 
1033
            <mi>y</mi>
 
1034
        </mfenced>
 
1035
        <mo>=</mo>
 
1036
        <mrow>
 
1037
            <mo>&lcub;</mo>
 
1038
            <mrow>
 
1039
                <mi>P</mi>
 
1040
                <mfenced>
 
1041
                    <mrow>
 
1042
                        <mi>x</mi>
 
1043
                        <mo>+</mo>
 
1044
                        <mi>m</mi>
 
1045
                        <mo>&InvisibleTimes;</mo>
 
1046
                        <mi>w</mi>
 
1047
                    </mrow>
 
1048
                    <mrow>
 
1049
                        <mi>y</mi>
 
1050
                        <mo>+</mo>
 
1051
                        <mi>n</mi>
 
1052
                        <mo>&InvisibleTimes;</mo>
 
1053
                        <mi>h</mi>
 
1054
                    </mrow>
 
1055
                </mfenced>
 
1056
            </mrow>
 
1057
            <mo>:</mo>
 
1058
            <mrow>
 
1059
                <mrow>
 
1060
                    <mi>m</mi>
 
1061
                    <mo>,</mo>
 
1062
                    <mi>n</mi>
 
1063
                </mrow>
 
1064
                <mtext>&ThickSpace;in&ThickSpace;</mtext>
 
1065
                <mi>Z</mi>
 
1066
            </mrow>
 
1067
            <mo>&rcub;</mo>
 
1068
        </mrow>
 
1069
        <mtext>.</mtext>
 
1070
    </mrow>
 
1071
</math>
 
1072
@end html
 
1073
@tex
 
1074
$$
 
1075
    S_P(x, y) = \{P(x + m w, y + n h): m, n \in Z\}.
 
1076
$$
 
1077
@end tex
 
1078
@docbook
 
1079
<informalequation>
 
1080
    <mml:math>
 
1081
        <mml:reln>
 
1082
            <mml:eq/>
 
1083
            <mml:apply>
 
1084
                <mml:csymbol>
 
1085
                    <mml:msub>
 
1086
                        <mml:mi>S</mml:mi>
 
1087
                        <mml:mi>P</mml:mi>
 
1088
                    </mml:msub>
 
1089
                </mml:csymbol>
 
1090
                <mml:ci>x</mml:ci>
 
1091
                <mml:ci>y</mml:ci>
 
1092
            </mml:apply>
 
1093
            <mml:set>
 
1094
                <mml:bvar>
 
1095
                    <mml:apply>
 
1096
                        <mml:ci>P</mml:ci>
 
1097
                        <mml:apply>
 
1098
                            <mml:plus/>
 
1099
                            <mml:ci>x</mml:ci>
 
1100
                            <mml:apply>
 
1101
                                <mml:times/>
 
1102
                                <mml:ci>m</mml:ci>
 
1103
                                <mml:ci>w</mml:ci>
 
1104
                            </mml:apply>
 
1105
                        </mml:apply>
 
1106
                        <mml:apply>
 
1107
                            <mml:plus/>
 
1108
                            <mml:ci>y</mml:ci>
 
1109
                            <mml:apply>
 
1110
                                <mml:times/>
 
1111
                                <mml:ci>n</mml:ci>
 
1112
                                <mml:ci>h</mml:ci>
 
1113
                            </mml:apply>
 
1114
                        </mml:apply>
 
1115
                    </mml:apply>
 
1116
                </mml:bvar>
 
1117
                <mml:condition>
 
1118
                    <mml:apply>
 
1119
                        <mml:and/>
 
1120
                        <mml:apply>
 
1121
                            <mml:in/>
 
1122
                            <mml:ci>n</mml:ci>
 
1123
                            <mml:ci>Z</mml:ci>
 
1124
                        </mml:apply>
 
1125
                        <mml:apply>
 
1126
                            <mml:in/>
 
1127
                            <mml:ci>m</mml:ci>
 
1128
                            <mml:ci>Z</mml:ci>
 
1129
                        </mml:apply>
 
1130
                    </mml:apply>
 
1131
                </mml:condition>
 
1132
            </mml:set>
 
1133
        </mml:reln>
 
1134
    </mml:math>
 
1135
</informalequation>
 
1136
@end docbook
 
1137
 
 
1138
In this mode, both left and right borders, as well as top and bottom
 
1139
borders, are eliminated.
 
1140
@end table
 
1141
 
 
1142
Specifying @option{--wrap} without @var{MODE} selects horizontal
 
1143
wrapping.
 
1144
@end table
 
1145
 
 
1146
 
 
1147
@node Extended Options
 
1148
@section Extended Options
 
1149
@cindex options, extended
 
1150
 
 
1151
Extended options control the image cache, the color model, and the
 
1152
cropping of the output image.
 
1153
 
 
1154
@table @code
 
1155
@item -b @var{BLOCKSIZE}
 
1156
@opindex -b
 
1157
@cindex image cache, block size
 
1158
Set the @var{BLOCKSIZE} in kilobytes (@acronym{KB}) of Enfuse's image
 
1159
cache.
 
1160
 
 
1161
This is the amount of data that Enfuse will move to and from the disk
 
1162
at one time.  The default is @value{default-image-cache-blocksize},
 
1163
which should be ok for most systems.  See @ref{Tuning Memory Usage}
 
1164
for details.
 
1165
 
 
1166
Note that Enfuse must have been compiled with the image-cache feature
 
1167
for this option to be effective.  Find out about extra features with
 
1168
@code{enfuse --version --verbose}.
 
1169
 
 
1170
@item -c
 
1171
@itemx --ciecam
 
1172
@opindex -c
 
1173
@opindex --ciecam
 
1174
@cindex color appearance model
 
1175
@cindex @acronym{CIECAM02}
 
1176
Force the use of the @acronym{CIECAM02} color appearance model for
 
1177
blending colors instead of blending inside the @acronym{RGB} color
 
1178
cube.
 
1179
 
 
1180
@cindex color profile
 
1181
@cindex @acronym{ICC} profile
 
1182
@cindex profile, @acronym{ICC}
 
1183
@cindex @acronym{sRGB} color space
 
1184
@cindex color space, @acronym{sRGB}
 
1185
All input files should have identical @acronym{ICC} profiles when this
 
1186
option is specified.  If no @acronym{ICC} profile is present, Enfuse
 
1187
assumes that all images use the @acronym{sRGB} color space.
 
1188
@xref{Color Profiles}.
 
1189
 
 
1190
Please keep in mind that using @acronym{CIECAM02} blending may change
 
1191
the colors in the output image.
 
1192
 
 
1193
This option can be negated; see option@tie{}@option{--no-ciecam}
 
1194
below.
 
1195
 
 
1196
@item -d
 
1197
@itemx --depth=@var{DEPTH}
 
1198
@opindex -d
 
1199
@opindex --depth
 
1200
@cindex bits per channel
 
1201
@cindex channel width
 
1202
Force the number of bits per channel and the numeric format of the
 
1203
output image.
 
1204
 
 
1205
Enfuse always uses a smart way to change the channel depth, to assure
 
1206
highest image quality (at the expense of memory), whether
 
1207
requantization is implicit because of the output format or explicit
 
1208
with option@tie{}@option{--depth}.
 
1209
 
 
1210
@itemize
 
1211
@item
 
1212
If the output-channel width is larger than the input-channel width of
 
1213
the input images, the input images' channels are widened to the output
 
1214
channel width immediately after loading, that is, as soon as possible.
 
1215
Enfuse then performs all blending operations at the output-channel
 
1216
width, thereby preserving minute color details which can appear in the
 
1217
blending areas.
 
1218
 
 
1219
@item
 
1220
If the output-channel width is smaller than the input-channel width of
 
1221
the input images, the output image's channels are narrowed only right
 
1222
before it is written to disk, that is, as late as possible.  Thus the
 
1223
data benefits from the wider input channels for the longest time.
 
1224
@end itemize
 
1225
 
 
1226
All @var{DEPTH} specifications are valid in lowercase as well as
 
1227
uppercase letters.  For integer format, use
 
1228
 
 
1229
@table @asis
 
1230
@item @code{8}, @code{uint8}
 
1231
Unsigned 8@dmn{bit}; range: 0..255
 
1232
@item @code{int16}
 
1233
Signed 16@dmn{bit}; range: @minus{}32768..32767
 
1234
@item @code{16}, @code{uint16}
 
1235
Unsigned 16@dmn{bit}; range: 0..65535
 
1236
@item @code{int32}
 
1237
Signed 32@dmn{bit}; range: @minus{}2147483648..2147483647
 
1238
@item @code{32}, @code{uint32}
 
1239
Unsigned 32@dmn{bit}; range: 0..4294967295
 
1240
@end table
 
1241
 
 
1242
For floating-point format, use
 
1243
 
 
1244
@c Minimum positive normalized value: 2^(2 - 2^k)
 
1245
@c Epsilon: 2^(1 - n)
 
1246
@c Maximum finite value: (1 - 2^(-n)) * 2^(2^k)
 
1247
 
 
1248
@table @asis
 
1249
@c IEEE single: 32 bits, n = 24, k = 32 - n - 1 = 7
 
1250
@item @code{r32}, @code{real32}, @code{float}
 
1251
@cindex @acronym{IEEE754} single precision float
 
1252
@cindex single precision float, @acronym{IEEE754}
 
1253
@acronym{IEEE754} single precision floating-point, 32@dmn{bit} wide,
 
1254
24@dmn{bit} significant
 
1255
 
 
1256
@itemize
 
1257
@item
 
1258
Minimum normalized value: @semilog{1.2, -38}
 
1259
@item
 
1260
Epsilon: @semilog{1.2, -7}
 
1261
@item
 
1262
Maximum finite value: @semilog{3.4, 38}
 
1263
@end itemize
 
1264
 
 
1265
@c IEEE double: 64 bits, n = 53, k = 64 - n - 1 = 10
 
1266
@item @code{r64}, @code{real64}, @code{double}
 
1267
@cindex @acronym{IEEE754} double precision float
 
1268
@cindex double precision float, @acronym{IEEE754}
 
1269
@acronym{IEEE754} double precision floating-point, 64@dmn{bit} wide,
 
1270
53@dmn{bit} significant
 
1271
 
 
1272
@itemize
 
1273
@item
 
1274
Minimum normalized value: @semilog{2.2, -308}
 
1275
@item
 
1276
Epsilon: @semilog{2.2, -16}
 
1277
@item
 
1278
Maximum finite value: @semilog{1.8, 308}
 
1279
@end itemize
 
1280
@end table
 
1281
 
 
1282
If the requested @var{DEPTH} is not supported by the output file
 
1283
format, Enfuse warns and chooses the @var{DEPTH} that matches best.
 
1284
 
 
1285
@cindex @acronym{OpenEXR}, data format
 
1286
The @acronym{OpenEXR} data format is treated as
 
1287
@acronym{IEEE754}@tie{}float internally.  Externally, on disk,
 
1288
@acronym{OpenEXR} data is represented by ``half'' precision
 
1289
floating-point numbers.
 
1290
 
 
1291
@c ILM half: 16 bits, n = 10, k = 16 - n - 1 = 5
 
1292
@cindex @acronym{OpenEXR}, half precision float
 
1293
@cindex half precision float, @acronym{OpenEXR}
 
1294
@uref{http://@/www.openexr.com/@/about.html#@/features,
 
1295
@acronym{OpenEXR}} half precision floating-point, 16@dmn{bit} wide,
 
1296
10@dmn{bit} significant
 
1297
 
 
1298
@itemize
 
1299
@item
 
1300
Minimum normalized value: @semilog{9.3, -10}
 
1301
@item
 
1302
Epsilon: @semilog{2.0, -3}
 
1303
@item
 
1304
Maximum finite value: @semilog{4.3, 9}
 
1305
@end itemize
 
1306
 
 
1307
@item -f @var{WIDTH}x@var{HEIGHT}
 
1308
@itemx -f @var{WIDTH}x@var{HEIGHT}+x@var{XOFFSET}+y@var{YOFFSET}
 
1309
@opindex -f
 
1310
@cindex output image, set size of
 
1311
@cindex canvas size
 
1312
@cindex size, canvas
 
1313
Ensure that the minimum ``canvas'' size of the output image is at
 
1314
least @var{WIDTH}@classictimes{}@/@var{HEIGHT}.  Optionally specify
 
1315
the @var{XOFFSET} and @var{YOFFSET}, too.
 
1316
 
 
1317
@pindex nona @r{(Hugin)}
 
1318
@pindex hugin
 
1319
This option only is useful when the input images are cropped
 
1320
@acronym{TIFF} files, such as those produced by
 
1321
@command{nona}@footnote{The stitcher @command{nona} is part of Hugin.
 
1322
@xref{Helpful Programs}.}.
 
1323
 
 
1324
Note that option@tie{}@option{-f} neither rescales the output image,
 
1325
nor shrinks the canvas size below the minimum size occupied by the
 
1326
union of all input images.
 
1327
 
 
1328
@item --fallback-profile=@var{PROFILE-FILENAME}
 
1329
@opindex --fallback-profile
 
1330
@cindex profile, fallback
 
1331
@cindex fallback profile
 
1332
@cindex @acronym{CIECAM02}
 
1333
Use the @acronym{ICC} profile in @var{PROFILE-FILENAME} instead of the
 
1334
default @acronym{sRGB}.  See option@tie{}@option{--ciecam} and
 
1335
@ref{Color Profiles}.
 
1336
 
 
1337
This option only is effective if the input images come without color
 
1338
profiles and blending is performed in @acronym{CIECAM02} color
 
1339
appearance model.
 
1340
 
 
1341
@item -g
 
1342
@opindex -g
 
1343
@cindex alpha channel, associated
 
1344
Save alpha channel as ``associated''.  See the
 
1345
@uref{http://@/www.awaresystems.be/@/imaging/@/tiff/@/tifftags/@/extrasamples.html,
 
1346
@acronym{TIFF} documentation} for an explanation.
 
1347
 
 
1348
@pindex gimp
 
1349
@pindex cinepaint
 
1350
Gimp (before version@tie{}2.0) and CinePaint (@pxref{Helpful
 
1351
Programs}) exhibit unusual behavior when loading images with
 
1352
unassociated alpha channels.  Use option @option{-g} to work around
 
1353
this problem.  With this flag Enfuse will create the output image
 
1354
with the associated alpha tag set, even though the image is really
 
1355
unassociated alpha.
 
1356
 
 
1357
@item -m @var{CACHESIZE}
 
1358
@opindex -m
 
1359
@cindex image cache, cache size
 
1360
Set the @var{CACHESIZE} in megabytes (@acronym{MB}) of Enfuse's image
 
1361
cache.
 
1362
 
 
1363
This is the amount of memory Enfuse will use for storing image data
 
1364
before swapping to disk.  The default is
 
1365
@value{default-image-cache-cachesize}, which is good for systems with
 
1366
3--4@dmn{gigabytes} (@acronym{GB}) of @acronym{RAM}.  See @ref{Tuning
 
1367
Memory Usage} for details.
 
1368
 
 
1369
Note that Enfuse must have been compiled with the image-cache feature
 
1370
for this option to be effective.  Find out about extra features with
 
1371
@code{enfuse --version --verbose}.
 
1372
 
 
1373
@item --no-ciecam
 
1374
@opindex --no-ciecam
 
1375
@cindex color appearance model
 
1376
@cindex @acronym{CIECAM02}
 
1377
Disable the use of the @acronym{CIECAM02} color appearance model for
 
1378
blending colors.
 
1379
 
 
1380
See option@tie{}@option{--ciecam} for details.  Also see @ref{Color
 
1381
Profiles}.
 
1382
@end table
 
1383
 
 
1384
 
 
1385
@node Fusion Options
 
1386
@section Fusion Options
 
1387
@cindex options, fusion
 
1388
 
 
1389
Fusion options define the proportion to which each input image's pixel
 
1390
contributes to the output image.
 
1391
 
 
1392
@table @code
 
1393
@item --contrast-weight=@var{WEIGHT}
 
1394
@opindex --contrast-weight
 
1395
@cindex weight, local contrast
 
1396
 
 
1397
Sets the relative @var{WEIGHT} of high local-contrast pixels.
 
1398
 
 
1399
Valid range: @value{src::minimum-weight-contrast} @leq{} @var{WEIGHT}
 
1400
@leq{} @value{src::maximum-weight-contrast}.
 
1401
 
 
1402
Default: @value{src::default-weight-contrast}.
 
1403
 
 
1404
See @ref{Local Contrast Weighting} and @ref{Expert Options, Option
 
1405
contrast-window-size}.
 
1406
 
 
1407
@item --entropy-weight=@var{WEIGHT}
 
1408
@opindex --entropy-weight
 
1409
@cindex weight, entropy
 
1410
 
 
1411
Sets the relative @var{WEIGHT} of high local entropy pixels.
 
1412
 
 
1413
Valid range: @value{src::minimum-weight-entropy} @leq{} @var{WEIGHT}
 
1414
@leq{} @value{src::maximum-weight-entropy}.
 
1415
 
 
1416
Default: @value{src::default-weight-entropy}.
 
1417
 
 
1418
See @ref{Local Entropy Weighting} and @ref{Expert Options, Options
 
1419
entropy-window-size and entropy-cutoff}.
 
1420
 
 
1421
@item --exposure-weight=@var{WEIGHT}
 
1422
@opindex --exposure-weight
 
1423
@cindex weight, exposure
 
1424
 
 
1425
Sets the relative @var{WEIGHT} of the well-exposedness criterion.
 
1426
Increasing this weight relative to the others will make well-exposed
 
1427
pixels contribute more to the final output.
 
1428
 
 
1429
Valid range: @value{src::minimum-weight-exposure} @leq{} @var{WEIGHT}
 
1430
@leq{} @value{src::maximum-weight-exposure}.
 
1431
 
 
1432
Default: @value{src::default-weight-exposure}.
 
1433
 
 
1434
@xref{Exposure Weighting}.
 
1435
 
 
1436
@item --exposure-mu=@var{MEAN}
 
1437
@opindex --exposure-mu
 
1438
 
 
1439
Set the @var{MEAN} (this is, the center) of the Gaussian exposure
 
1440
weight curve.
 
1441
 
 
1442
Valid range: @value{src::minimum-exposure-mu} @leq{} @var{MEAN}
 
1443
@leq{} @value{src::maximum-exposure-mu}.
 
1444
 
 
1445
Default: @value{src::default-exposure-mu}.
 
1446
 
 
1447
Use this option to fine-tune exposure weighting (@pxref{Exposure
 
1448
Weighting}).
 
1449
 
 
1450
@item --exposure-sigma=@var{STD-DEV}
 
1451
@opindex --exposure-sigma
 
1452
 
 
1453
Standard deviation @var{STD-DEV} of the Gaussian exposure weight
 
1454
curve.  Low numbers give less weight to pixels that are far from
 
1455
@option{--wMu} and vice versa.
 
1456
 
 
1457
Valid range: @var{STD-DEV} @geq{} @value{src::minimum-exposure-sigma}.
 
1458
 
 
1459
Default: @value{src::default-exposure-sigma}.
 
1460
 
 
1461
Use this option to fine-tune exposure weighting (@pxref{Exposure
 
1462
Weighting}).
 
1463
 
 
1464
@item --saturation-weight=@var{WEIGHT}
 
1465
@opindex --saturation-weight
 
1466
 
 
1467
Sets the relative @var{WEIGHT} of high-saturation pixels.  Increasing
 
1468
this weight makes pixels with high saturation contribute more to the
 
1469
final output.
 
1470
 
 
1471
Valid range: @value{src::minimum-weight-saturation}
 
1472
@leq{} @var{WEIGHT} @leq{} @value{src::maximum-weight-saturation}.
 
1473
 
 
1474
Default: @value{src::default-weight-saturation}.
 
1475
 
 
1476
Saturation weighting is only defined for color images.
 
1477
@xref{Saturation Weighting}.
 
1478
@end table
 
1479
 
 
1480
 
 
1481
@node Expert Options
 
1482
@section Expert Options
 
1483
@cindex options, expert
 
1484
 
 
1485
Expert options influence the workings of Enfuse that require the user
 
1486
to read the manual before applying them successfully.
 
1487
 
 
1488
@table @code
 
1489
@item --contrast-edge-scale=@var{EDGE-SCALE}
 
1490
@itemx --contrast-edge-scale=@var{EDGE-SCALE}:@var{LCE-SCALE}:@var{LCE-FACTOR}
 
1491
@opindex --contrast-edge-scale
 
1492
 
 
1493
@cindex Laplacian-of-Gaussian
 
1494
A non-zero value for @var{EDGE-SCALE} switches on the
 
1495
Laplacian-of-Gaussian (@acronym{LoG}) edge detection algorithm.
 
1496
@var{EDGE-SCALE} is the radius of the Gaussian used in the search for
 
1497
edges.  Default: @value{src::default-edge-scale}@dmn{pixels}.
 
1498
 
 
1499
A positive @var{LCE-SCALE} turns on local contrast enhancement
 
1500
(@acronym{LCE}) before the @acronym{LoG} edge detection.
 
1501
@var{LCE-SCALE} is the radius of the Gaussian used in the enhancement
 
1502
step, @var{LCE-FACTOR} is the weight factor (``strength'').
 
1503
 
 
1504
@var{enhanced} = (1 + @var{LCE-FACTOR}) @classictimes{} @var{original}
 
1505
@minus{} @var{LCE-FACTOR} @classictimes{} Gaussian@/Smooth(@var{original},
 
1506
@var{LCE-SCALE}).
 
1507
 
 
1508
@var{LCE-SCALE} defaults to @value{src::default-lce-scale} pixels and
 
1509
@var{LCE-FACTOR} defaults to @value{src::default-lce-factor}.  Append
 
1510
@samp{%} to @var{LCE-SCALE} to specify the radius as a percentage of
 
1511
@var{EDGE-SCALE}.  Append @samp{%} to @var{LCE-FACTOR} to specify the
 
1512
weight as a percentage.
 
1513
 
 
1514
@item --contrast-min-curvature=@var{CURVATURE}
 
1515
@opindex --contrast-min-curvature
 
1516
 
 
1517
Define the minimum @var{CURVATURE} for the @acronym{LoG} edge
 
1518
detection.  Default: @value{src::default-minimum-curvature}.  Append a
 
1519
@samp{%} to specify the minimum curvature relative to maximum pixel
 
1520
value in the source image (for example 255 or 65535).
 
1521
 
 
1522
A positive value makes Enfuse use the local contrast data (controlled
 
1523
with @option{--contrast-window-size}) for curvatures less than
 
1524
@var{CURVATURE} and @acronym{LoG} data for values above it.
 
1525
 
 
1526
A negative value truncates all curvatures less than
 
1527
@minus{}@var{CURVATURE} to zero.  Values above @var{CURVATURE} are
 
1528
left unchanged.  This effectively suppresses weak edges.
 
1529
 
 
1530
@item --contrast-window-size=@var{SIZE}
 
1531
@opindex --contrast-window-size
 
1532
 
 
1533
Set the window @var{SIZE} for local contrast analysis.  The window
 
1534
will be a square of @var{SIZE}@classictimes{}@/@var{SIZE} pixels.  If
 
1535
given an even @var{SIZE}, Enfuse will automatically use the next odd
 
1536
number.
 
1537
 
 
1538
For contrast analysis @var{SIZE} values larger than 5 might result in
 
1539
a blurry composite image.  Values of 3 and 5 have given good results
 
1540
on focus stacks.
 
1541
 
 
1542
Valid range: @var{SIZE} @geq{} @value{src::minimum-contrast-window-size}.
 
1543
 
 
1544
Default: @value{src::default-contrast-window-size}@dmn{pixels}.
 
1545
 
 
1546
See also @ref{Fusion Options, Option --contrast-weight} and
 
1547
@option{--hard-mask} below.
 
1548
 
 
1549
@item --entropy-cutoff=@var{LOWER-CUTOFF}
 
1550
@itemx --entropy-cutoff=@var{LOWER-CUTOFF}:@var{UPPER-CUTOFF}
 
1551
@opindex --entropy-cutoff
 
1552
 
 
1553
The first form defines the lower cutoff value below which pixels are
 
1554
treated as pure black when calculating the local entropy.  The second
 
1555
form also defines the upper cutoff value above which pixels are
 
1556
treated as pure white.
 
1557
 
 
1558
For color images @var{LOWER-CUTOFF} and @var{UPPER-CUTOFF} are applied
 
1559
separately and independently to each channel.
 
1560
 
 
1561
Defaults: @value{src::default-entropy-lower-cutoff} for
 
1562
@var{LOWER-CUTOFF} and @value{src::default-entropy-upper-cutoff} for
 
1563
@var{UPPER-CUTOFF}, that is, all pixels' values are taken into
 
1564
account.  Append a @samp{%} to specify the cutoff relative to maximum
 
1565
pixel value in the source image (for example 255 or 65535).
 
1566
@ref{Figure:entropy-cutoff} shows an example.
 
1567
 
 
1568
@float Figure,Figure:entropy-cutoff
 
1569
@vimage{entropy-cutoff}
 
1570
 
 
1571
@caption{Linear lightness@tie{}@var{Y} in comparison with an entropy-cutoff function for @var{LOWER-CUTOFF} = 5% and @var{UPPER-CUTOFF} = 90%, which are rather extreme values.  Please note that we have shifted the original lightness curve up and the cut-off curve down by a very small @var{Offset} to emphasize that the proportional part of @var{Y} remains unaltered under the cut-off operation.}
 
1572
 
 
1573
@shortcaption{Entropy cutoff function}
 
1574
@end float
 
1575
 
 
1576
Note that a high @var{LOWER-CUTOFF} value lightens the resulting
 
1577
image, as dark (and presumably noisy) pixels are averaged with
 
1578
@emph{equal} weights.  With @samp{--entropy-cutoff=0}, the default, on
 
1579
the other hand, ``noise'' might be interpreted as high entropy and the
 
1580
noisy pixels get a high weight, which in turn renders the resulting
 
1581
image darker.  Analogously, a low @var{UPPER-CUTOFF} darkens the
 
1582
output image.
 
1583
 
 
1584
@item --entropy-window-size=@var{SIZE}
 
1585
@opindex --entropy-window-size
 
1586
 
 
1587
Window @var{SIZE} for local entropy analysis.  The window will be a
 
1588
square of @var{SIZE}@classictimes{}@/@var{SIZE} pixels.
 
1589
 
 
1590
In the entropy calculation @var{SIZE} values of 3 to 7 yield an
 
1591
acceptable compromise of the locality of the information and the
 
1592
significance of the local entropy value itself.
 
1593
 
 
1594
Valid range: @var{SIZE} @geq{} @value{src::minimum-entropy-window-size}.
 
1595
 
 
1596
Default: @value{src::default-entropy-window-size}@dmn{pixels}.
 
1597
 
 
1598
If given an even @var{SIZE} Enfuse will automatically use the next odd
 
1599
number.
 
1600
 
 
1601
@item --exposure-cutoff=@var{LOWER-CUTOFF}
 
1602
@itemx --exposure-cutoff=@var{LOWER-CUTOFF}:@var{UPPER-CUTOFF}
 
1603
@itemx --exposure-cutoff=@var{LOWER-CUTOFF}:@var{UPPER-CUTOFF}:@var{LOWER-PROJECTOR}:@var{UPPER-PROJECTOR}
 
1604
@opindex --exposure-cutoff
 
1605
 
 
1606
The first form sets the weight for all pixels below the lower cutoff
 
1607
to zero.  The second form sets the lower cutoff and the upper cutoff
 
1608
at the same time.  For color images the values of @var{LOWER-CUTOFF}
 
1609
and @var{UPPER-CUTOFF} refer to the gray-scale projection as selected
 
1610
with the option @option{--gray-projector}.
 
1611
 
 
1612
The impact of this option is similar, but not identical to
 
1613
transforming @emph{all} input images with
 
1614
@uref{http://@/www.imagemagick.org/, ImageMagick's} @command{convert}
 
1615
(@pxref{Helpful Programs}) prior to fusing with the following
 
1616
commands.
 
1617
 
 
1618
@example
 
1619
@group
 
1620
# First form
 
1621
convert IMAGE \
 
1622
        \( +clone -threshold LOWER-CUTOFF \) \
 
1623
        -compose copy_opacity -composite \
 
1624
        MASKED-IMAGE
 
1625
@end group
 
1626
 
 
1627
@group
 
1628
# Second form
 
1629
convert IMAGE \
 
1630
        \( \
 
1631
            \( IMAGE -threshold LOWER-CUTOFF \) \
 
1632
            \( IMAGE -threshold UPPER-CUTOFF -negate \) \
 
1633
            -compose multiply -composite \
 
1634
        \) \
 
1635
        -compose copy_opacity -composite \
 
1636
        MASKED-IMAGE
 
1637
@end group
 
1638
@end example
 
1639
 
 
1640
(Transforming some or all input images as shown in the above examples
 
1641
gives the user more flexibility because the thresholds can be chosen
 
1642
for each image individually.)
 
1643
 
 
1644
The third form specifies projection operators as in
 
1645
option@tie{}@option{--gray-projector} for the @var{LOWER-CUTOFF} and
 
1646
@var{UPPER-CUTOFF} thresholds.
 
1647
 
 
1648
This option can be helpful if the user wants to exclude underexposed
 
1649
or overexposed pixels from the fusing process in @emph{all} of the
 
1650
input images.  The values of @var{LOWER-CUTOFF} and @var{UPPER-CUTOFF}
 
1651
as well as the gray-scale projector determine which pixels are
 
1652
considered ``underexposed'' or ``overexposed''.  As any change of the
 
1653
exposure-weight curve this option changes the brightness of the
 
1654
resulting image: increasing @var{LOWER-CUTOFF} lightens the final
 
1655
image and lowering @var{UPPER-CUTOFF} darkens it.
 
1656
 
 
1657
Defaults: @value{src::default-exposure-lower-cutoff} for
 
1658
@var{LOWER-CUTOFF} and @value{src::default-exposure-upper-cutoff} for
 
1659
@var{UPPER-CUTOFF}, that is, all pixels' values are weighted according
 
1660
to the ``uncut'' exposure-weight curve.
 
1661
 
 
1662
Append a @samp{%} to specify the cutoff relative to the maximum pixel
 
1663
value in the source image (for example 255 or 65535).
 
1664
 
 
1665
@ref{Figure:exposure-cutoff} shows an example.
 
1666
 
 
1667
The gray-scale projectors @var{LOWER-PROJECTOR} and
 
1668
@var{UPPER-PROJECTOR} default to
 
1669
@samp{@value{src::default-exposure-lower-cutoff-projector}} and
 
1670
@samp{@value{src::default-exposure-upper-cutoff-projector}}, which are
 
1671
usually the best choices for effective cutoff operations on the
 
1672
respective ends.
 
1673
 
 
1674
@float Figure,Figure:exposure-cutoff
 
1675
@vimage{exposure-cutoff}
 
1676
 
 
1677
@caption{Exposure weight, a Gaussian with @var{Mu} = 0.5 and @var{Sigma} = 0.2 submitted to an exposure-cutoff of @var{LOWER-CUTOFF} = 5% and @var{UPPER-CUTOFF} = 97%.}
 
1678
 
 
1679
@shortcaption{Exposure cutoff function}
 
1680
@end float
 
1681
 
 
1682
Note that the application of the respective cutoffs is completely
 
1683
independent of the actual shape of the exposure weight function.
 
1684
 
 
1685
If a set of images stubbornly refuses to ``react'' to this option,
 
1686
look at their histograms to verify the cutoff actually falls into
 
1687
populated ranges of the histograms.  In the absence of an image
 
1688
manipulation program like @uref{http://@/www.gimp.org/, The Gimp},
 
1689
@uref{http://@/www.imagemagick.org/, ImageMagick} (@pxref{Helpful
 
1690
Programs}) can be used to generate
 
1691
@uref{http://@/www.imagemagick.org/@/Usage/@/files/@/#histogram,
 
1692
histograms}, like, for example,
 
1693
 
 
1694
@example
 
1695
@group
 
1696
convert -define histogram:unique-colors=false \
 
1697
        IMAGE histogram:- | \
 
1698
    display
 
1699
@end group
 
1700
@end example
 
1701
 
 
1702
@item --gray-projector=@var{PROJECTOR}
 
1703
@opindex --gray-projector
 
1704
@cindex gray projector
 
1705
 
 
1706
Use gray projector@tie{}@var{PROJECTOR} for conversion of
 
1707
@acronym{RGB} images to grayscale:
 
1708
@ifinfo
 
1709
@math{(R, G, B) --> Y.}
 
1710
@end ifinfo
 
1711
@html
 
1712
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
1713
    <mrowinline>
 
1714
        <mfencedinline>
 
1715
            <mi>R</mi>
 
1716
            <mi>G</mi>
 
1717
            <mi>B</mi>
 
1718
        </mfencedinline>
 
1719
        <mo>&rightarrow;</mo>
 
1720
        <mi>Y</mi>
 
1721
        <mtext>.</mtext>
 
1722
    </mrowinline>
 
1723
</mathinline>
 
1724
@end html
 
1725
@tex
 
1726
$(R, G, B) \rightarrow Y.$
 
1727
@end tex
 
1728
@docbook
 
1729
<informalequation>
 
1730
    <mml:math>
 
1731
        <mml:lambda>
 
1732
            <mml:bvar>
 
1733
                <mml:vector>
 
1734
                    <mml:ci>R</mml:ci>
 
1735
                    <mml:ci>G</mml:ci>
 
1736
                    <mml:ci>B</mml:ci>
 
1737
                </mml:vector>
 
1738
            </mml:bvar>
 
1739
            <mml:ci>Y</mml:ci>
 
1740
        </mml:lambda>
 
1741
    </mml:math>
 
1742
</informalequation>
 
1743
@end docbook
 
1744
 
 
1745
In version@tie{}@value{VERSION} of Enfuse, the option is effective for
 
1746
exposure weighting and local contrast weighting.  Default:
 
1747
@samp{average}.
 
1748
 
 
1749
Valid values for @var{PROJECTOR} are:
 
1750
 
 
1751
@table @code
 
1752
@item anti-value
 
1753
@cindex gray projector, @samp{anti-value}
 
1754
@cindex @samp{anti-value} gray projector
 
1755
Do the opposite of the @samp{value} projector: take the minimum of all
 
1756
color channels.
 
1757
@ifinfo
 
1758
@display
 
1759
@math{Y = min(R, G, B)}
 
1760
@end display
 
1761
@end ifinfo
 
1762
@html
 
1763
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
1764
    <mrow>
 
1765
        <mi>Y</mi>
 
1766
        <mo>=</mo>
 
1767
        <mrow>
 
1768
            <mo>min</mo>
 
1769
            <mo>&ApplyFunction;</mo>
 
1770
            <mfenced>
 
1771
                <mi>R</mi>
 
1772
                <mi>G</mi>
 
1773
                <mi>B</mi>
 
1774
            </mfenced>
 
1775
        </mrow>
 
1776
    </mrow>
 
1777
</math>
 
1778
@end html
 
1779
@tex
 
1780
$$
 
1781
    Y = \min(R, G, B)
 
1782
$$
 
1783
@end tex
 
1784
@docbook
 
1785
<informalequation>
 
1786
    <mml:math>
 
1787
        <mml:reln>
 
1788
            <mml:eq/>
 
1789
            <mml:ci>Y</mml:ci>
 
1790
            <mml:apply>
 
1791
                <mml:min/>
 
1792
                <mml:ci>R</mml:ci>
 
1793
                <mml:ci>G</mml:ci>
 
1794
                <mml:ci>B</mml:ci>
 
1795
            </mml:apply>
 
1796
        </mml:reln>
 
1797
    </mml:math>
 
1798
</informalequation>
 
1799
@end docbook
 
1800
 
 
1801
This projector can be useful when exposure weighing while employing a
 
1802
lower cutoff (see option@tie{}@option{--exposure-cutoff}) to reduce
 
1803
the noise in the fused image.
 
1804
 
 
1805
@item average
 
1806
@cindex gray projector, @samp{average}
 
1807
@cindex @samp{average} gray projector
 
1808
Average red, green, and blue channel with equal weights.  This is the
 
1809
default, and it often is a good projector for @math{gamma = 1} data.
 
1810
@ifinfo
 
1811
@display
 
1812
@math{Y = (R + G + B) / 3}
 
1813
@end display
 
1814
@end ifinfo
 
1815
@html
 
1816
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
1817
    <mrow>
 
1818
        <mi>Y</mi>
 
1819
        <mo>=</mo>
 
1820
        <mfrac>
 
1821
            <mrow>
 
1822
                <mi>R</mi>
 
1823
                <mo>+</mo>
 
1824
                <mi>G</mi>
 
1825
                <mo>+</mo>
 
1826
                <mi>B</mi>
 
1827
            </mrow>
 
1828
            <mn>3</mn>
 
1829
        </mfrac>
 
1830
    </mrow>
 
1831
</math>
 
1832
@end html
 
1833
@tex
 
1834
$$
 
1835
    Y = {R + G + B \over 3}
 
1836
$$
 
1837
@end tex
 
1838
@docbook
 
1839
<informalequation>
 
1840
    <mml:math>
 
1841
        <mml:reln>
 
1842
            <mml:eq/>
 
1843
            <mml:ci>Y</mml:ci>
 
1844
            <mml:apply other='display="scriptstyle"'>
 
1845
                <mml:divide/>
 
1846
                <mml:apply>
 
1847
                    <mml:plus/>
 
1848
                    <mml:ci>R</mml:ci>
 
1849
                    <mml:ci>G</mml:ci>
 
1850
                    <mml:ci>B</mml:ci>
 
1851
                </mml:apply>
 
1852
                <mml:cn>3</mml:cn>
 
1853
            </mml:apply>
 
1854
        </mml:reln>
 
1855
    </mml:math>
 
1856
</informalequation>
 
1857
@end docbook
 
1858
 
 
1859
@item channel-mixer:@var{RED-WEIGHT}:@var{GREEN-WEIGHT}:@var{BLUE-WEIGHT}
 
1860
@cindex gray projector, @samp{channel-mixer}
 
1861
@cindex @samp{channel-mixer} gray projector
 
1862
Weight the channels as given.
 
1863
@ifinfo
 
1864
@display
 
1865
@math{Y = RED-WEIGHT * R + GREEN-WEIGHT * G + BLUE-WEIGHT * B}
 
1866
@end display
 
1867
@end ifinfo
 
1868
@html
 
1869
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
1870
    <mrow>
 
1871
        <mi>Y</mi>
 
1872
        <mo>=</mo>
 
1873
        <mrow>
 
1874
            <mi mathvariant="italic">RED-WEIGHT</mi>
 
1875
            <mo>&times;</mo>
 
1876
            <mi>R</mi>
 
1877
        </mrow>
 
1878
        <mo>+</mo>
 
1879
        <mrow>
 
1880
            <mi mathvariant="italic">GREEN-WEIGHT</mi>
 
1881
            <mo>&times;</mo>
 
1882
            <mi>G</mi>
 
1883
        </mrow>
 
1884
        <mo>+</mo>
 
1885
        <mrow>
 
1886
            <mi mathvariant="italic">BLUE-WEIGHT</mi>
 
1887
            <mo>&times;</mo>
 
1888
            <mi>B</mi>
 
1889
        </mrow>
 
1890
    </mrow>
 
1891
</math>
 
1892
@end html
 
1893
@tex
 
1894
$$
 
1895
    \eqalign{Y \quad = \quad
 
1896
        & \mathit{RED-WEIGHT} \times R \; + \cr
 
1897
        & \mathit{GREEN-WEIGHT} \times G \; + \cr
 
1898
        & \mathit{BLUE-WEIGHT} \times B \cr}
 
1899
$$
 
1900
@end tex
 
1901
@docbook
 
1902
<informalequation>
 
1903
    <mml:math>
 
1904
        <mml:reln>
 
1905
            <mml:eq/>
 
1906
            <mml:ci>Y</mml:ci>
 
1907
            <mml:apply>
 
1908
                <mml:plus/>
 
1909
                <mml:apply>
 
1910
                    <mml:times/>
 
1911
                    <mml:csymbol>
 
1912
                        <mml:mi mathvariant="italic">RED-WEIGHT</mml:mi>
 
1913
                    </mml:csymbol>
 
1914
                    <mml:ci>R</mml:ci>
 
1915
                </mml:apply>
 
1916
                <mml:apply>
 
1917
                    <mml:times/>
 
1918
                    <mml:csymbol>
 
1919
                        <mml:mi mathvariant="italic">GREEN-WEIGHT</mml:mi>
 
1920
                    </mml:csymbol>
 
1921
                    <mml:ci>G</mml:ci>
 
1922
                </mml:apply>
 
1923
                <mml:apply>
 
1924
                    <mml:times/>
 
1925
                    <mml:csymbol>
 
1926
                        <mml:mi mathvariant="italic">BLUE-WEIGHT</mml:mi>
 
1927
                    </mml:csymbol>
 
1928
                    <mml:ci>B</mml:ci>
 
1929
                </mml:apply>
 
1930
            </mml:apply>
 
1931
        </mml:reln>
 
1932
    </mml:math>
 
1933
</informalequation>
 
1934
@end docbook
 
1935
 
 
1936
The weights are automatically normalized to one, so
 
1937
 
 
1938
@example
 
1939
--gray-projector=channel-mixer:0.25:0.5:0.25
 
1940
--gray-projector=channel-mixer:1:2:1
 
1941
--gray-projector=channel-mixer:25:50:25
 
1942
@end example
 
1943
 
 
1944
all define the same mixer configuration.
 
1945
 
 
1946
The three weights @var{RED-WEIGHT}, @var{GREEN-WEIGHT}, and
 
1947
@var{BLUE-WEIGHT} define the relative weight of the respective color
 
1948
channel.  The sum of all weights is normalized to one.
 
1949
 
 
1950
@item l-star
 
1951
@cindex gray projector, @samp{l-star}
 
1952
@cindex @samp{l-star} gray projector
 
1953
@cindex RGB-L*a*b* conversion
 
1954
@cindex conversion, RGB-L*a*b*
 
1955
Use the L-channel of the L*a*b*-conversion of the image as its
 
1956
grayscale representation.  This is a useful projector for gamma = 1
 
1957
data.  It reveals minute contrast variations even in the shadows and
 
1958
the highlights.  This projector is computationally expensive.  Compare
 
1959
with @samp{pl-star}, which is intended for gamma-corrected images.
 
1960
 
 
1961
See @uref{http://@/en.wikipedia.org/@/wiki/@/Lab_@/color_@/space,
 
1962
Wikipedia} for a detailed description of the @acronym{Lab}@tie{}color
 
1963
space.
 
1964
 
 
1965
@item lightness
 
1966
@cindex gray projector, @samp{lightness}
 
1967
@cindex @samp{lightness} gray projector
 
1968
Compute the lightness of each @acronym{RGB} pixel as in an
 
1969
Hue-Saturation-Lightness (@acronym{HSL}) conversion of the image.
 
1970
@ifinfo
 
1971
@display
 
1972
@math{Y = (max(R, G, B) + min(R, G, B)) / 2}
 
1973
@end display
 
1974
@end ifinfo
 
1975
@html
 
1976
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
1977
    <mrow>
 
1978
        <mi>Y</mi>
 
1979
        <mo>=</mo>
 
1980
        <mfrac>
 
1981
            <mrow>
 
1982
                <mrow>
 
1983
                    <mo>max</mo>
 
1984
                    <mo>&ApplyFunction;</mo>
 
1985
                    <mfenced>
 
1986
                        <mi>R</mi>
 
1987
                        <mi>G</mi>
 
1988
                        <mi>B</mi>
 
1989
                    </mfenced>
 
1990
                </mrow>
 
1991
                <mo>+</mo>
 
1992
                <mrow>
 
1993
                    <mo>min</mo>
 
1994
                    <mo>&ApplyFunction;</mo>
 
1995
                    <mfenced>
 
1996
                        <mi>R</mi>
 
1997
                        <mi>G</mi>
 
1998
                        <mi>B</mi>
 
1999
                    </mfenced>
 
2000
                </mrow>
 
2001
            </mrow>
 
2002
            <mn>2</mn>
 
2003
        </mfrac>
 
2004
    </mrow>
 
2005
</math>
 
2006
@end html
 
2007
@tex
 
2008
$$
 
2009
    Y = {\max(R, G, B) + \min(R, G, B) \over 2}
 
2010
$$
 
2011
@end tex
 
2012
@docbook
 
2013
<informalequation>
 
2014
    <mml:math>
 
2015
        <mml:reln>
 
2016
            <mml:eq/>
 
2017
            <mml:ci>Y</mml:ci>
 
2018
            <mml:apply>
 
2019
                <mml:divide/>
 
2020
                <mml:apply>
 
2021
                    <mml:plus/>
 
2022
                    <mml:apply>
 
2023
                        <mml:max/>
 
2024
                        <mml:ci>R</mml:ci>
 
2025
                        <mml:ci>G</mml:ci>
 
2026
                        <mml:ci>B</mml:ci>
 
2027
                    </mml:apply>
 
2028
                    <mml:apply>
 
2029
                        <mml:min/>
 
2030
                        <mml:ci>R</mml:ci>
 
2031
                        <mml:ci>G</mml:ci>
 
2032
                        <mml:ci>B</mml:ci>
 
2033
                    </mml:apply>
 
2034
                </mml:apply>
 
2035
                <mml:cn>2</mml:cn>
 
2036
            </mml:apply>
 
2037
        </mml:reln>
 
2038
    </mml:math>
 
2039
</informalequation>
 
2040
@end docbook
 
2041
 
 
2042
@item luminance
 
2043
@cindex gray projector, @samp{luminance}
 
2044
@cindex @samp{luminance} gray projector
 
2045
Use the weighted average of the @acronym{RGB} pixel's channels as
 
2046
defined by @acronym{CIE} (``Commission Internationale de
 
2047
l'@'Eclairage'') and the @acronym{JPEG} standard.
 
2048
@ifinfo
 
2049
@display
 
2050
@math{Y = 0.30 * R + 0.59 * G + 0.11 * B}
 
2051
@end display
 
2052
@end ifinfo
 
2053
@html
 
2054
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
2055
    <mrow>
 
2056
        <mi>Y</mi>
 
2057
        <mo>=</mo>
 
2058
        <mrow>
 
2059
            <mn>0.30</mn>
 
2060
            <mo>&times;</mo>
 
2061
            <mi>R</mi>
 
2062
        </mrow>
 
2063
        <mo>+</mo>
 
2064
        <mrow>
 
2065
            <mn>0.59</mn>
 
2066
            <mo>&times;</mo>
 
2067
            <mi>G</mi>
 
2068
        </mrow>
 
2069
        <mo>+</mo>
 
2070
        <mrow>
 
2071
            <mn>0.11</mn>
 
2072
            <mo>&times;</mo>
 
2073
            <mi>B</mi>
 
2074
        </mrow>
 
2075
    </mrow>
 
2076
</math>
 
2077
@end html
 
2078
@tex
 
2079
$$
 
2080
    Y = 0.30 \times R + 0.59 \times G + 0.11 \times B
 
2081
$$
 
2082
@end tex
 
2083
@docbook
 
2084
<informalequation>
 
2085
    <mml:math>
 
2086
        <mml:reln>
 
2087
            <mml:eq/>
 
2088
            <mml:ci>Y</mml:ci>
 
2089
            <mml:apply>
 
2090
                <mml:plus/>
 
2091
                <mml:apply>
 
2092
                    <mml:times/>
 
2093
                    <mml:cn type="real">0.30</mml:cn>
 
2094
                    <mml:ci>R</mml:ci>
 
2095
                </mml:apply>
 
2096
                <mml:apply>
 
2097
                    <mml:times/>
 
2098
                    <mml:cn type="real">0.59</mml:cn>
 
2099
                    <mml:ci>G</mml:ci>
 
2100
                </mml:apply>
 
2101
                <mml:apply>
 
2102
                    <mml:times/>
 
2103
                    <mml:cn type="real">0.11</mml:cn>
 
2104
                    <mml:ci>B</mml:ci>
 
2105
                </mml:apply>
 
2106
            </mml:apply>
 
2107
        </mml:reln>
 
2108
    </mml:math>
 
2109
</informalequation>
 
2110
@end docbook
 
2111
 
 
2112
@item pl-star
 
2113
@cindex gray projector, @samp{pl-star}
 
2114
@cindex @samp{pl-star} gray projector
 
2115
@cindex RGB'-L*a*b* conversion
 
2116
@cindex conversion, RGB'-L*a*b*
 
2117
Use the L-channel of the L*a*b*-conversion of the image as its
 
2118
grayscale representation.  This is a useful projector for
 
2119
gamma-corrected data.  It reveals minute contrast variations even in
 
2120
the shadows and the highlights.  This projector is computationally
 
2121
expensive.  Compare with @samp{l-star}, which is intended for gamma =
 
2122
1 images.
 
2123
 
 
2124
See @uref{http://@/en.wikipedia.org/@/wiki/@/Lab_@/color_@/space,
 
2125
Wikipedia} for a detailed description of the @acronym{Lab}@tie{}color
 
2126
space.
 
2127
 
 
2128
@item value
 
2129
@cindex gray projector, @samp{value}
 
2130
@cindex @samp{value} gray projector
 
2131
Take the Value-channel of the Hue-Saturation-Value (@acronym{HSV})
 
2132
conversion of the image.
 
2133
@ifinfo
 
2134
@display
 
2135
@math{Y = max(R, G, B)}
 
2136
@end display
 
2137
@end ifinfo
 
2138
@html
 
2139
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
2140
    <mrow>
 
2141
        <mi>Y</mi>
 
2142
        <mo>=</mo>
 
2143
        <mrow>
 
2144
            <mo>max</mo>
 
2145
            <mo>&ApplyFunction;</mo>
 
2146
            <mfenced>
 
2147
                <mi>R</mi>
 
2148
                <mi>G</mi>
 
2149
                <mi>B</mi>
 
2150
            </mfenced>
 
2151
        </mrow>
 
2152
    </mrow>
 
2153
</math>
 
2154
@end html
 
2155
@tex
 
2156
$$
 
2157
    Y = \max(R, G, B)
 
2158
$$
 
2159
@end tex
 
2160
@docbook
 
2161
<informalequation>
 
2162
    <mml:math>
 
2163
        <mml:reln>
 
2164
            <mml:eq/>
 
2165
            <mml:ci>Y</mml:ci>
 
2166
            <mml:apply>
 
2167
                <mml:max/>
 
2168
                <mml:ci>R</mml:ci>
 
2169
                <mml:ci>G</mml:ci>
 
2170
                <mml:ci>B</mml:ci>
 
2171
            </mml:apply>
 
2172
        </mml:reln>
 
2173
    </mml:math>
 
2174
</informalequation>
 
2175
@end docbook
 
2176
@end table
 
2177
 
 
2178
@item --hard-mask
 
2179
@opindex --hard-mask
 
2180
 
 
2181
Force hard blend masks on the finest scale.  This is the opposite flag
 
2182
of @option{--soft-mask}.
 
2183
 
 
2184
This blending mode avoids averaging of fine details (only) at the
 
2185
expense of increasing the noise.  However it considerably improves the
 
2186
sharpness of focus stacks.  Blending with hard masks has only proven
 
2187
useful with focus stacks.
 
2188
 
 
2189
See also @ref{Fusion Options, Option --contrast-weight} and
 
2190
@option{--contrast-window-size} above.
 
2191
 
 
2192
@item --load-masks
 
2193
@itemx --load-masks=@var{SOFT-MASK-TEMPLATE}
 
2194
@itemx --load-masks=@var{SOFT-MASK-TEMPLATE}:@var{HARD-MASK-TEMPLATE}
 
2195
@opindex --load-masks
 
2196
 
 
2197
Load masks from images instead of computing them.
 
2198
 
 
2199
The masks have to be a grayscale images.
 
2200
 
 
2201
@cindex mask, loading
 
2202
First form: Load all soft-weight masks from files that were previously
 
2203
saved with option@tie{}@option{--save-masks}.  If
 
2204
option@tie{}@option{--hard-mask} is effective only load hard masks.
 
2205
The defaults are @file{@value{src::default-soft-mask-template}} and
 
2206
@file{@value{src::default-hard-mask-template}}.
 
2207
@cindex filename template
 
2208
@cindex mask, filename template
 
2209
In the second form, @var{SOFT-MASK-TEMPLATE} defines the names of the
 
2210
soft-mask files.  In the third form, @var{HARD-MASK-TEMPLATE}
 
2211
additionally defines the names of the hard-mask files.  See
 
2212
option@tie{}@option{--save-masks} below for the description of mask
 
2213
templates.
 
2214
 
 
2215
Options@tie{}@option{--load-masks} and @option{--save-masks} are
 
2216
mutually exclusive.
 
2217
 
 
2218
@item --save-masks
 
2219
@itemx --save-masks=@var{SOFT-MASK-TEMPLATE}
 
2220
@itemx --save-masks=@var{SOFT-MASK-TEMPLATE}:@var{HARD-MASK-TEMPLATE}
 
2221
@opindex --save-masks
 
2222
@cindex mask, save
 
2223
@cindex save mask
 
2224
Save the generated weight masks to image files.
 
2225
 
 
2226
First form: Save all soft-weight masks in files.  If
 
2227
option@tie{}@option{--hard-mask} is effective also save the hard masks.
 
2228
The defaults are @file{@value{src::default-soft-mask-template}} and
 
2229
@file{@value{src::default-hard-mask-template}}.
 
2230
@cindex filename template
 
2231
@cindex mask, filename template
 
2232
In the second form, @var{SOFT-MASK-TEMPLATE} defines the names of the
 
2233
soft-mask files.  In the third form, @var{HARD-MASK-TEMPLATE}
 
2234
additionally defines the names of the hard-mask files.
 
2235
 
 
2236
@cindex save mask, only
 
2237
@cindex only save mask
 
2238
Enfuse will stop after saving all masks unless
 
2239
option@tie{}@option{--output} is given, too.  With both options given,
 
2240
this is, @option{--save-masks} and @option{--output}, Enfuse saves all
 
2241
masks and then proceeds to fuse the output image.
 
2242
 
 
2243
Both @var{SOFT-MASK-TEMPLATE} and @var{HARD-MASK-TEMPLATE} define
 
2244
templates that are expanded for each mask file.  In a template a
 
2245
percent sign (@samp{%}) introduces a variable part.  All other
 
2246
characters are copied literally.  Lowercase letters refer to the name
 
2247
of the respective input file, whereas uppercase ones refer to the name
 
2248
of the output file (@pxref{Common Options}).
 
2249
@ref{Table:mask-template-characters} lists all variables.
 
2250
 
 
2251
A fancy mask filename template could look like this:
 
2252
 
 
2253
@example
 
2254
%D/soft-mask-%02n-%f.viff
 
2255
@end example
 
2256
 
 
2257
It puts the mask files into the same directory as the output file
 
2258
(@samp{%D}), generates a two-digit index (@samp{%02n}) to keep the
 
2259
mask files nicely sorted, and decorates the mask filename with the
 
2260
name of the associated input file (@samp{%f}) for easy recognition.
 
2261
 
 
2262
@item --soft-mask
 
2263
@opindex --soft-mask
 
2264
 
 
2265
Consider all masks when fusing.  This is the default.
 
2266
@end table
 
2267
 
 
2268
@c The extra <para>s fix another stupid Texinfo problem with DocBook.
 
2269
@docbook
 
2270
<para>
 
2271
@end docbook
 
2272
Options@tie{}@option{--save-masks} and @option{--load-masks} are
 
2273
mutually exclusive.
 
2274
@docbook
 
2275
</para>
 
2276
@end docbook
 
2277
 
 
2278
@page
 
2279
 
 
2280
@include mask-template-characters.texi
 
2281
 
 
2282
@node Option Delimiters
 
2283
@section Option Delimiters
 
2284
@cindex option delimiters
 
2285
@cindex delimiters, option
 
2286
 
 
2287
Enfuse allows the arguments supplied to the program's options to be
 
2288
separated by different separators.  The online documentation and this
 
2289
manual, however, exclusively use the colon @samp{:} in every syntax
 
2290
definition and in all examples.
 
2291
 
 
2292
@need 500
 
2293
@noindent
 
2294
@strong{Numeric Arguments}
 
2295
 
 
2296
Valid delimiters are the the semicolon @samp{;}, the colon @samp{:},
 
2297
and the slash @samp{/}.  All delimiters may be mixed within any
 
2298
option that takes numeric arguments.
 
2299
 
 
2300
@noindent
 
2301
Examples:
 
2302
 
 
2303
@table @samp
 
2304
@item --contrast-edge-scale=0.667:6.67:3.5
 
2305
Separate all arguments with colons.
 
2306
 
 
2307
@item --contrast-edge-scale=0.667;6.67;3.5
 
2308
Use semi-colons.
 
2309
 
 
2310
@item --contrast-edge-scale=0.667;6.67/3.5
 
2311
Mix semicolon and slash in weird ways.
 
2312
 
 
2313
@item --entropy-cutoff=3%/99%
 
2314
All delimiters also work in conjunction with percentages.
 
2315
 
 
2316
@item --gray-projector=channel-mixer:3/6/1
 
2317
Separate arguments with a colon and two slashes.
 
2318
 
 
2319
@item --gray-projector=channel-mixer/30;60:10
 
2320
Go wild and Enfuse will understand.
 
2321
@end table
 
2322
 
 
2323
@need 500
 
2324
@noindent
 
2325
@strong{Filename Arguments}
 
2326
 
 
2327
Here, the accepted delimiters are @samp{,}, @samp{;}, and @samp{:}.
 
2328
Again, all delimiters may be mixed within any option that has filename
 
2329
arguments.
 
2330
 
 
2331
@noindent
 
2332
Examples:
 
2333
 
 
2334
@table @samp
 
2335
@item --save-masks=soft-mask-%03i.tif:hard-mask-03%i.tif
 
2336
Separate all arguments with colons.
 
2337
 
 
2338
@item --save-masks=%d/soft-%n.tif,%d/hard-%n.tif
 
2339
Use a comma.
 
2340
@end table
 
2341
 
 
2342
 
 
2343
@node Color Profiles
 
2344
@chapter Color Profiles
 
2345
@cindex profile, @acronym{ICC}
 
2346
@cindex @acronym{ICC} profile
 
2347
@cindex color profile
 
2348
 
 
2349
@include color-profiles.texi
 
2350
 
 
2351
 
 
2352
@node Weighting Functions
 
2353
@chapter Weighting Functions
 
2354
@cindex weighting functions
 
2355
 
 
2356
As has been noted in the Overview (@pxref{Overview}), Enfuse supports
 
2357
four different types of weighting.  The following subsections describe
 
2358
the concept of weighting and all weighting functions in detail.
 
2359
 
 
2360
@menu
 
2361
* Weighting Pixels::            General concept of weighting pixels
 
2362
* Exposure Weighting::          Weighting by exposure
 
2363
* Saturation Weighting::        Weighting by saturation
 
2364
* Local Contrast Weighting::    Weighting by local contrast
 
2365
* Local Entropy Weighting::     Weighting by local entropy
 
2366
@end menu
 
2367
 
 
2368
 
 
2369
@node Weighting Pixels
 
2370
@section Weighting Pixels
 
2371
@cindex weighting, general concept of
 
2372
 
 
2373
Image fusion maps each pixel@tie{}@math{P(i, x, y)} of every input
 
2374
image @math{i} to a single pixel@tie{}@math{Q(x, y)} in the output
 
2375
image:
 
2376
@ifinfo
 
2377
@display
 
2378
@math{P(i, x, y) --> Q(x, y),}
 
2379
@end display
 
2380
@end ifinfo
 
2381
@html
 
2382
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
2383
    <mrow>
 
2384
        <mrow>
 
2385
            <mi>P</mi>
 
2386
            <mfenced>
 
2387
                <mi>i</mi>
 
2388
                <mi>x</mi>
 
2389
                <mi>y</mi>
 
2390
            </mfenced>
 
2391
        </mrow>
 
2392
        <mo>&rightarrow;</mo>
 
2393
        <mrow>
 
2394
            <mi>Q</mi>
 
2395
            <mfenced>
 
2396
                <mi>x</mi>
 
2397
                <mi>y</mi>
 
2398
            </mfenced>
 
2399
        </mrow>
 
2400
        <mtext>,</mtext>
 
2401
    </mrow>
 
2402
</math>
 
2403
@end html
 
2404
@tex
 
2405
$$
 
2406
    P(i, x, y) \rightarrow Q(x, y),
 
2407
$$
 
2408
@end tex
 
2409
@docbook
 
2410
<informalequation>
 
2411
    <mml:math>
 
2412
        <mml:lambda>
 
2413
            <mml:bvar>
 
2414
                <mml:apply>
 
2415
                    <mml:ci>P</mml:ci>
 
2416
                    <mml:ci>i</mml:ci>
 
2417
                    <mml:ci>x</mml:ci>
 
2418
                    <mml:ci>y</mml:ci>
 
2419
                </mml:apply>
 
2420
            </mml:bvar>
 
2421
            <mml:apply>
 
2422
                <mml:ci>Q</mml:ci>
 
2423
                <mml:ci>x</mml:ci>
 
2424
                <mml:ci>y</mml:ci>
 
2425
            </mml:apply>
 
2426
        </mml:lambda>
 
2427
    </mml:math>
 
2428
</informalequation>
 
2429
@end docbook
 
2430
 
 
2431
@noindent
 
2432
where @math{x} runs from 1 to the common width of the images, @math{y}
 
2433
from 1 to the common height, and @math{i} from 1 to the number of
 
2434
input images@tie{}@math{n}.
 
2435
 
 
2436
@macro equationW{}
 
2437
@ifnotdocbook
 
2438
@ifnottex
 
2439
(W)
 
2440
@end ifnottex
 
2441
@end ifnotdocbook
 
2442
@tex
 
2443
(W)%
 
2444
@end tex
 
2445
@docbook
 
2446
<xref linkend="equ:pixel-weighting-function"/>
 
2447
@end docbook
 
2448
@end macro
 
2449
 
 
2450
Enfuse allows for weighting the contribution of each @math{P(i, x, y)}
 
2451
to the final @math{Q(x, y)}:
 
2452
@ifinfo
 
2453
@display
 
2454
@math{w(P(1, x, y)) * P(1, x, y) +
 
2455
... +
 
2456
w(P(n, x, y)) * P(n, x, y)
 
2457
--> Q(x, y),}@w{                                                  }@equationW{}
 
2458
@end display
 
2459
@end ifinfo
 
2460
@html
 
2461
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
2462
    <mrow>
 
2463
        <mrow>
 
2464
            <mi>w</mi>
 
2465
            <mo>&ApplyFunction;</mo>
 
2466
            <mrow>
 
2467
                <mo>(</mo>
 
2468
                <mrow>
 
2469
                    <mi>P</mi>
 
2470
                    <mfenced>
 
2471
                        <mi>1</mi>
 
2472
                        <mi>x</mi>
 
2473
                        <mi>y</mi>
 
2474
                    </mfenced>
 
2475
                </mrow>
 
2476
                <mo>)</mo>
 
2477
            </mrow>
 
2478
            <mo>&times;</mo>
 
2479
            <mrow>
 
2480
                <mi>P</mi>
 
2481
                <mfenced>
 
2482
                    <mi>1</mi>
 
2483
                    <mi>x</mi>
 
2484
                    <mi>y</mi>
 
2485
                </mfenced>
 
2486
            </mrow>
 
2487
            <mo>+</mo>
 
2488
            <mo>...</mo>
 
2489
            <mo>+</mo>
 
2490
            <mi>w</mi>
 
2491
            <mo>&ApplyFunction;</mo>
 
2492
            <mrow>
 
2493
                <mo>(</mo>
 
2494
                <mrow>
 
2495
                    <mi>P</mi>
 
2496
                    <mfenced>
 
2497
                        <mi>n</mi>
 
2498
                        <mi>x</mi>
 
2499
                        <mi>y</mi>
 
2500
                    </mfenced>
 
2501
                </mrow>
 
2502
                <mo>)</mo>
 
2503
            </mrow>
 
2504
            <mo>&times;</mo>
 
2505
            <mrow>
 
2506
                <mi>P</mi>
 
2507
                <mfenced>
 
2508
                    <mi>n</mi>
 
2509
                    <mi>x</mi>
 
2510
                    <mi>y</mi>
 
2511
                </mfenced>
 
2512
            </mrow>
 
2513
        </mrow>
 
2514
        <mo>&rightarrow;</mo>
 
2515
        <mrow>
 
2516
            <mi>Q</mi>
 
2517
            <mfenced>
 
2518
                <mi>i</mi>
 
2519
                <mi>x</mi>
 
2520
                <mi>y</mi>
 
2521
            </mfenced>
 
2522
        </mrow>
 
2523
        <mtext>,</mtext>
 
2524
        <mspace width="4em"/>
 
2525
        <mtext>@equationW{}</mtext>
 
2526
    </mrow>
 
2527
</math>
 
2528
@end html
 
2529
@tex
 
2530
$$
 
2531
    w(P(1, x, y)) P(1, x, y) + \ldots + w(P(n, x, y)) P(n, x, y)
 
2532
    \rightarrow
 
2533
    Q(x, y),\hskip4em\hbox{@equationW{}}
 
2534
$$
 
2535
@end tex
 
2536
@docbook
 
2537
<equation id="equ:pixel-weighting-function">
 
2538
    <title>Pixel Weighting Function</title>
 
2539
    <mml:math>
 
2540
        <mml:lambda>
 
2541
            <mml:bvar>
 
2542
                <mml:apply>
 
2543
                    <mml:plus/>
 
2544
                    <mml:apply>
 
2545
                        <mml:times/>
 
2546
                        <mml:apply>
 
2547
                            <mml:ci>w</mml:ci>
 
2548
                            <mml:apply>
 
2549
                                <mml:ci>P</mml:ci>
 
2550
                                <mml:cn>1</mml:cn>
 
2551
                                <mml:ci>x</mml:ci>
 
2552
                                <mml:ci>y</mml:ci>
 
2553
                            </mml:apply>
 
2554
                        </mml:apply>
 
2555
                        <mml:apply>
 
2556
                            <mml:ci>P</mml:ci>
 
2557
                            <mml:cn>1</mml:cn>
 
2558
                            <mml:ci>x</mml:ci>
 
2559
                            <mml:ci>y</mml:ci>
 
2560
                        </mml:apply>
 
2561
                    </mml:apply>
 
2562
                    <mml:mo>...</mml:mo>
 
2563
                    <mml:apply>
 
2564
                        <mml:times/>
 
2565
                        <mml:apply>
 
2566
                            <mml:ci>w</mml:ci>
 
2567
                            <mml:apply>
 
2568
                                <mml:ci>P</mml:ci>
 
2569
                                <mml:ci>n</mml:ci>
 
2570
                                <mml:ci>x</mml:ci>
 
2571
                                <mml:ci>y</mml:ci>
 
2572
                            </mml:apply>
 
2573
                        </mml:apply>
 
2574
                        <mml:apply>
 
2575
                            <mml:ci>P</mml:ci>
 
2576
                            <mml:ci>n</mml:ci>
 
2577
                            <mml:ci>x</mml:ci>
 
2578
                            <mml:ci>y</mml:ci>
 
2579
                        </mml:apply>
 
2580
                    </mml:apply>
 
2581
                </mml:apply>
 
2582
            </mml:bvar>
 
2583
            <mml:apply>
 
2584
                <mml:ci>Q</mml:ci>
 
2585
                <mml:ci>x</mml:ci>
 
2586
                <mml:ci>y</mml:ci>
 
2587
            </mml:apply>
 
2588
        </mml:lambda>
 
2589
    </mml:math>
 
2590
</equation>
 
2591
@end docbook
 
2592
 
 
2593
@noindent
 
2594
where
 
2595
 
 
2596
@itemize
 
2597
@item
 
2598
each @math{w} is non-negative to yield a physical intensity and
 
2599
 
 
2600
@item
 
2601
the sum of all @math{w} is one to leave the total intensity unchanged.
 
2602
@end itemize
 
2603
 
 
2604
@noindent
 
2605
The pixel weights@tie{}@math{w} themselves are weighted sums with the
 
2606
same constraints
 
2607
@ifinfo
 
2608
@display
 
2609
@math{w(P) = w_exp * f_exp(P) +
 
2610
       w_sat * f_sat(P) +
 
2611
       w_cont * f_cont(P, r_cont) +
 
2612
       w_ent * f_ent(P, r_ent),}
 
2613
@end display
 
2614
 
 
2615
@noindent
 
2616
where we have abbreviated @math{P(i, x, y)} to @math{P} for
 
2617
simplicity.  The user defines the constants@tie{}@math{w_exp},
 
2618
@math{w_sat}, @math{w_cont}, and @math{w_ent} with the options
 
2619
@option{--exposure-weight}, @option{--saturation-weight},
 
2620
@option{--contrast-weight}, and @option{--entropy-weight}.  The
 
2621
functions@tie{}@math{f_exp}, @math{f_sat}, @math{f_cont}, and
 
2622
@math{f_ent} along with the window sizes@tie{}@math{r_cont} and
 
2623
@math{r_ent} are explained in the next sections.
 
2624
@end ifinfo
 
2625
@html
 
2626
</p>
 
2627
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
2628
    <mtable>
 
2629
        <mtr>
 
2630
            <mtd>
 
2631
                <mi>w</mi>
 
2632
                <mo>&ApplyFunction;</mo>
 
2633
                <mrow>
 
2634
                    <mo>(</mo>
 
2635
                    <mi>P</mi>
 
2636
                    <mo>)</mo>
 
2637
                </mrow>
 
2638
            </mtd>
 
2639
            <mtd>
 
2640
                <mo>=</mo>
 
2641
            </mtd>
 
2642
            <mtd>
 
2643
                <msub>
 
2644
                    <mi>w</mi>
 
2645
                    <mtext>exp</mtext>
 
2646
                </msub>
 
2647
                <mo>&times;</mo>
 
2648
                <mrow>
 
2649
                    <msub>
 
2650
                        <mi>f</mi>
 
2651
                        <mtext>exp</mtext>
 
2652
                    </msub>
 
2653
                    <mo>&ApplyFunction;</mo>
 
2654
                    <mrow>
 
2655
                        <mo>(</mo>
 
2656
                        <mi>P</mi>
 
2657
                        <mo>)</mo>
 
2658
                    </mrow>
 
2659
                    <mo>+</mo>
 
2660
                </mrow>
 
2661
            </mtd>
 
2662
        </mtr>
 
2663
        <mtr>
 
2664
            <mtd></mtd>
 
2665
            <mtd></mtd>
 
2666
            <mtd>
 
2667
                <msub>
 
2668
                    <mi>w</mi>
 
2669
                    <mtext>sat</mtext>
 
2670
                </msub>
 
2671
                <mo>&times;</mo>
 
2672
                <mrow>
 
2673
                    <msub>
 
2674
                        <mi>f</mi>
 
2675
                        <mtext>sat</mtext>
 
2676
                    </msub>
 
2677
                    <mo>&ApplyFunction;</mo>
 
2678
                    <mrow>
 
2679
                        <mo>(</mo>
 
2680
                        <mi>P</mi>
 
2681
                        <mo>)</mo>
 
2682
                    </mrow>
 
2683
                    <mo>+</mo>
 
2684
                </mrow>
 
2685
            </mtd>
 
2686
        </mtr>
 
2687
        <mtr>
 
2688
            <mtd></mtd>
 
2689
            <mtd></mtd>
 
2690
            <mtd>
 
2691
                <msub>
 
2692
                    <mi>w</mi>
 
2693
                    <mtext>cont</mtext>
 
2694
                </msub>
 
2695
                <mo>&times;</mo>
 
2696
                <mrow>
 
2697
                    <msub>
 
2698
                        <mi>f</mi>
 
2699
                        <mtext>cont</mtext>
 
2700
                    </msub>
 
2701
                    <mo>&ApplyFunction;</mo>
 
2702
                    <mfenced>
 
2703
                        <mi>P</mi>
 
2704
                        <msub>
 
2705
                            <mi>r</mi>
 
2706
                            <mtext>cont</mtext>
 
2707
                        </msub>
 
2708
                    </mfenced>
 
2709
                </mrow>
 
2710
                <mo>+</mo>
 
2711
            </mtd>
 
2712
        </mtr>
 
2713
        <mtr>
 
2714
            <mtd></mtd>
 
2715
            <mtd></mtd>
 
2716
            <mtd>
 
2717
                <msub>
 
2718
                    <mi>w</mi>
 
2719
                    <mtext>ent</mtext>
 
2720
                </msub>
 
2721
                <mo>&times;</mo>
 
2722
                <mrow>
 
2723
                    <msub>
 
2724
                        <mi>f</mi>
 
2725
                        <mtext>ent</mtext>
 
2726
                    </msub>
 
2727
                    <mo>&ApplyFunction;</mo>
 
2728
                    <mfenced>
 
2729
                        <mi>P</mi>
 
2730
                        <msub>
 
2731
                            <mi>r</mi>
 
2732
                            <mtext>ent</mtext>
 
2733
                        </msub>
 
2734
                    </mfenced>
 
2735
                </mrow>
 
2736
            </mtd>
 
2737
        </mtr>
 
2738
    </mtable>
 
2739
</math>
 
2740
 
 
2741
<p>where we have abbreviated
 
2742
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2743
<mi>P</mi> <mrowinline> <mo>(</mo> <mi>i</mi> <mo>,</mo> <mi>x</mi> <mo>,</mo>
 
2744
<mi>y</mi> <mo>)</mo> </mrowinline> </mathinline> to
 
2745
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2746
<mi>P</mi> </mathinline> for simplicity.  The user defines the
 
2747
constants&nbsp;<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2748
<msubinline> <mi>w</mi> <mtext>exp</mtext> </msubinline> </mathinline>,
 
2749
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2750
<msubinline> <mi>w</mi> <mtext>sat</mtext> </msubinline> </mathinline>,
 
2751
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2752
<msubinline> <mi>w</mi> <mtext>cont</mtext> </msubinline> </mathinline>, and
 
2753
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2754
<msubinline> <mi>w</mi> <mtext>ent</mtext> </msubinline> </mathinline> with the options
 
2755
`<tt>--exposure-weight</tt>', `<tt>--saturation-weight</tt>',
 
2756
`<tt>--contrast-weight</tt>', and `<tt>--entropy-weight</tt>'
 
2757
respectively.  The
 
2758
functions&nbsp;<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2759
<msubinline> <mi>f</mi> <mtext>exp</mtext> </msubinline> </mathinline>,
 
2760
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2761
<msubinline> <mi>f</mi> <mtext>sat</mtext> </msubinline> </mathinline>,
 
2762
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2763
<msubinline> <mi>f</mi> <mtext>cont</mtext> </msubinline> </mathinline>, and
 
2764
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2765
<msubinline> <mi>f</mi> <mtext>ent</mtext> </msubinline> </mathinline> along with the window
 
2766
sizes&nbsp;<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2767
<msubinline> <mi>r</mi> <mtext>cont</mtext> </msubinline> </mathinline> and
 
2768
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
2769
<msubinline> <mi>r</mi> <mtext>ent</mtext> </msubinline> </mathinline> are explained in
 
2770
the next sections.</p><p>
 
2771
@end html
 
2772
@tex
 
2773
$$
 
2774
    \eqalign{w(P) \quad = \quad
 
2775
        & w_{\mathrm{exp}} \; f_{\mathrm{exp}}(P) + \cr
 
2776
        & w_{\mathrm{sat}} \; f_{\mathrm{sat}}(P) + \cr
 
2777
        & w_{\mathrm{cont}} \; f_{\mathrm{cont}}(P, r_{\mathrm{cont}}) + \cr
 
2778
        & w_{\mathrm{ent}} \; f_{\mathrm{ent}}(P, r_{\mathrm{ent}}), \cr}
 
2779
$$
 
2780
 
 
2781
\noindent where we have abbreviated $P(i, x, y)$ to $P$ for
 
2782
simplicity.  The user defines the constants~$w_{\mathrm{exp}}$,
 
2783
$w_{\mathrm{sat}}$, $w_{\mathrm{cont}}$, and $w_{\mathrm{ent}}$ with
 
2784
the options `{\tt --exposure-weight}', `{\tt --saturation-weight}', `{\tt
 
2785
--contrast-weight}', and `{\tt --entropy-weight}' respectively.  The
 
2786
functions~$f_{\mathrm{exp}}$, $f_{\mathrm{sat}}$, $f_{\mathrm{cont}}$,
 
2787
and $f_{\mathrm{ent}}$ along with the window sizes~$r_{\mathrm{cont}}$
 
2788
and $r_{\mathrm{ent}}$ are explained in the next sections.
 
2789
@end tex
 
2790
@docbook
 
2791
<informalequation>
 
2792
    <mml:math>
 
2793
        <mml:reln>
 
2794
            <mml:eq/>
 
2795
            <mml:apply>
 
2796
                <mml:ci>w</mml:ci>
 
2797
                <mml:ci>P</mml:ci>
 
2798
            </mml:apply>
 
2799
            <mml:apply>
 
2800
                <mml:plus/>
 
2801
                <mml:apply>
 
2802
                    <mml:times/>
 
2803
                    <mml:csymbol>
 
2804
                        <mml:msub>
 
2805
                            <mml:mi>w</mml:mi>
 
2806
                            <mml:mi mathvariant="normal">exp</mml:mi>
 
2807
                        </mml:msub>
 
2808
                    </mml:csymbol>
 
2809
                    <mml:apply>
 
2810
                        <mml:csymbol>
 
2811
                            <mml:msub>
 
2812
                                <mml:mi>f</mml:mi>
 
2813
                                <mml:mi mathvariant="normal">exp</mml:mi>
 
2814
                            </mml:msub>
 
2815
                        </mml:csymbol>
 
2816
                        <mml:ci>P</mml:ci>
 
2817
                    </mml:apply>
 
2818
                </mml:apply>
 
2819
                <mml:apply>
 
2820
                    <mml:times/>
 
2821
                    <mml:csymbol>
 
2822
                        <mml:msub>
 
2823
                            <mml:mi>w</mml:mi>
 
2824
                            <mml:mi mathvariant="normal">sat</mml:mi>
 
2825
                        </mml:msub>
 
2826
                    </mml:csymbol>
 
2827
                    <mml:apply>
 
2828
                        <mml:csymbol>
 
2829
                            <mml:msub>
 
2830
                                <mml:mi>f</mml:mi>
 
2831
                                <mml:mi mathvariant="normal">sat</mml:mi>
 
2832
                            </mml:msub>
 
2833
                        </mml:csymbol>
 
2834
                        <mml:ci>P</mml:ci>
 
2835
                    </mml:apply>
 
2836
                </mml:apply>
 
2837
                <mml:apply>
 
2838
                    <mml:times/>
 
2839
                    <mml:csymbol>
 
2840
                        <mml:msub>
 
2841
                            <mml:mi>w</mml:mi>
 
2842
                            <mml:mi mathvariant="normal">cont</mml:mi>
 
2843
                        </mml:msub>
 
2844
                    </mml:csymbol>
 
2845
                    <mml:apply>
 
2846
                        <mml:csymbol>
 
2847
                            <mml:msub>
 
2848
                                <mml:mi>f</mml:mi>
 
2849
                                <mml:mi mathvariant="normal">cont</mml:mi>
 
2850
                            </mml:msub>
 
2851
                        </mml:csymbol>
 
2852
                        <mml:ci>P</mml:ci>
 
2853
                        <mml:csymbol>
 
2854
                            <mml:msub>
 
2855
                                <mml:mi>r</mml:mi>
 
2856
                                <mml:mi mathvariant="normal">cont</mml:mi>
 
2857
                            </mml:msub>
 
2858
                        </mml:csymbol>
 
2859
                    </mml:apply>
 
2860
                </mml:apply>
 
2861
 
 
2862
                <mml:apply>
 
2863
                    <mml:times/>
 
2864
                    <mml:csymbol>
 
2865
                        <mml:msub>
 
2866
                            <mml:mi>w</mml:mi>
 
2867
                            <mml:mi mathvariant="normal">ent</mml:mi>
 
2868
                        </mml:msub>
 
2869
                    </mml:csymbol>
 
2870
                    <mml:apply>
 
2871
                        <mml:csymbol>
 
2872
                            <mml:msub>
 
2873
                                <mml:mi>f</mml:mi>
 
2874
                                <mml:mi mathvariant="normal">ent</mml:mi>
 
2875
                            </mml:msub>
 
2876
                        </mml:csymbol>
 
2877
                        <mml:ci>P</mml:ci>
 
2878
                        <mml:csymbol>
 
2879
                            <mml:msub>
 
2880
                                <mml:mi>r</mml:mi>
 
2881
                                <mml:mi mathvariant="normal">ent</mml:mi>
 
2882
                            </mml:msub>
 
2883
                        </mml:csymbol>
 
2884
                    </mml:apply>
 
2885
                </mml:apply>
 
2886
 
 
2887
            </mml:apply>
 
2888
        </mml:reln>
 
2889
    </mml:math>
 
2890
</informalequation>
 
2891
 
 
2892
where we have abbreviated <inlineequation> <mml:math> <mml:apply>
 
2893
<mml:ci>P</mml:ci> <mml:ci>i</mml:ci> <mml:ci>x</mml:ci>
 
2894
<mml:ci>y</mml:ci> </mml:apply> </mml:math> </inlineequation> to
 
2895
<inlineequation> <mml:math> <mml:ci>P</mml:ci> </mml:math>
 
2896
</inlineequation> for simplicity.  The user defines the
 
2897
constants&nbsp;<inlineequation> <mml:math> <mml:csymbol> <mml:msub>
 
2898
<mml:mi>w</mml:mi> <mml:mi mathvariant="normal">exp</mml:mi>
 
2899
</mml:msub> </mml:csymbol> </mml:math> </inlineequation>,
 
2900
<inlineequation> <mml:math> <mml:csymbol> <mml:msub>
 
2901
<mml:mi>w</mml:mi> <mml:mi mathvariant="normal">sat</mml:mi>
 
2902
</mml:msub> </mml:csymbol> </mml:math> </inlineequation>,
 
2903
<inlineequation> <mml:math> <mml:csymbol> <mml:msub>
 
2904
<mml:mi>w</mml:mi> <mml:mi mathvariant="normal">cont</mml:mi>
 
2905
</mml:msub> </mml:csymbol> </mml:math> </inlineequation>, and
 
2906
<inlineequation> <mml:math> <mml:csymbol> <mml:msub>
 
2907
<mml:mi>w</mml:mi> <mml:mi mathvariant="normal">ent</mml:mi>
 
2908
</mml:msub> </mml:csymbol> </mml:math> </inlineequation>, with the
 
2909
options <literal>--exposure-weight</literal>,
 
2910
<literal>--saturation-weight</literal>,
 
2911
<literal>--contrast-weight</literal>, and
 
2912
<literal>--entropy-weight</literal> respectively.  The
 
2913
functions&nbsp;<inlineequation> <mml:math> <mml:csymbol> <mml:msub>
 
2914
<mml:mi>f</mml:mi> <mml:mi mathvariant="normal">exp</mml:mi>
 
2915
</mml:msub> </mml:csymbol> </mml:math> </inlineequation>,
 
2916
<inlineequation> <mml:math> <mml:csymbol> <mml:msub>
 
2917
<mml:mi>f</mml:mi> <mml:mi mathvariant="normal">sat</mml:mi>
 
2918
</mml:msub> </mml:csymbol> </mml:math> </inlineequation>,
 
2919
<inlineequation> <mml:math> <mml:csymbol> <mml:msub>
 
2920
<mml:mi>f</mml:mi> <mml:mi mathvariant="normal">cont</mml:mi>
 
2921
</mml:msub> </mml:csymbol> </mml:math> </inlineequation>, and
 
2922
<inlineequation> <mml:math> <mml:csymbol> <mml:msub>
 
2923
<mml:mi>f</mml:mi> <mml:mi mathvariant="normal">ent</mml:mi>
 
2924
</mml:msub> </mml:csymbol> </mml:math> </inlineequation> along with
 
2925
the window sizes&nbsp;<inlineequation> <mml:math> <mml:csymbol>
 
2926
<mml:msub> <mml:mi>r</mml:mi> <mml:mi
 
2927
mathvariant="normal">cont</mml:mi> </mml:msub>
 
2928
</mml:csymbol></mml:math> </inlineequation> and <inlineequation>
 
2929
<mml:math> <mml:csymbol> <mml:msub> <mml:mi>r</mml:mi> <mml:mi
 
2930
mathvariant="normal">ent</mml:mi> </mml:msub> </mml:csymbol>
 
2931
</mml:math> </inlineequation> are explained in the next sections.
 
2932
@end docbook
 
2933
 
 
2934
@menu
 
2935
* Weighted Average::            Enfuse's default weighting algorithm
 
2936
* Disabling Averaging::         ``Super Trouper'' weighting for focus stacks
 
2937
* Single Criterion Fusing::     Fusing with only one of the criteria
 
2938
@end menu
 
2939
 
 
2940
 
 
2941
@node Weighted Average
 
2942
@subsection Weighted Average
 
2943
@cindex weighted average
 
2944
@cindex average, weighted
 
2945
 
 
2946
By default, Enfuse uses a weighted average, where @emph{each} pixel
 
2947
contributes as much as its weight demands.  Of course the weights can
 
2948
be extreme, favoring only a few pixels or even only one pixel in the
 
2949
input stack.  Extremes are not typical, however.
 
2950
 
 
2951
Equal weights are another extreme that turns @equationW{} into an
 
2952
arithmetic average.  This is why we sometimes speak of the ``averaging
 
2953
property'' of this weighting algorithm, like smoothing out noise.
 
2954
 
 
2955
 
 
2956
@node Disabling Averaging
 
2957
@subsection Disabling Averaging: Option@tie{}@option{--hard-mask}
 
2958
@cindex disabling average
 
2959
@cindex average, disabling
 
2960
@opindex --hard-mask
 
2961
 
 
2962
The weighted average computation as described above has proven to be
 
2963
widely successful with the exception of one special case: focus
 
2964
stacking (@pxref{Focus Stacks}), where the averaging noticeably
 
2965
softens the final image.
 
2966
 
 
2967
Use @option{--hard-mask} to switch Enfuse into a different (``Super
 
2968
Trouper'') weighting mode, where the pixel with the highest weight
 
2969
wins, this is, gets weight@tie{}one, and all other pixels get the
 
2970
weight of zero
 
2971
(@uref{http://@/en.wikipedia.org/@/wiki/@/The_@/Winner_@/Takes_@/It_@/All,,``The
 
2972
Winner Takes It All.''}).  With @option{--hard-mask} Equation@tie{}@equationW{}
 
2973
becomes
 
2974
@ifinfo
 
2975
@display
 
2976
@math{P(i, x, y) --> Q(x, y),}
 
2977
@end display
 
2978
 
 
2979
@noindent
 
2980
where
 
2981
@display
 
2982
@math{w(P(i, x, y)) >= w(P(j, x, y))} for all @math{1 <= j <= n}.
 
2983
@end display
 
2984
@end ifinfo
 
2985
@html
 
2986
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
2987
    <mrow>
 
2988
        <mrow>
 
2989
            <mrow>
 
2990
                <mi>P</mi>
 
2991
                <mfenced>
 
2992
                    <mi>i</mi>
 
2993
                    <mi>x</mi>
 
2994
                    <mi>y</mi>
 
2995
                </mfenced>
 
2996
            </mrow>
 
2997
            <mo>&rightarrow;</mo>
 
2998
            <mrow>
 
2999
                <mi>Q</mi>
 
3000
                <mfenced>
 
3001
                    <mi>x</mi>
 
3002
                    <mi>y</mi>
 
3003
                </mfenced>
 
3004
            </mrow>
 
3005
            <mtext>,</mtext>
 
3006
        </mrow>
 
3007
        <mtext>&ThickSpace;where&ThickSpace;</mtext>
 
3008
        <mrow>
 
3009
            <mi>w</mi>
 
3010
            <mo>&ApplyFunction;</mo>
 
3011
            <mrow>
 
3012
                <mo>(</mo>
 
3013
                <mi>P</mi>
 
3014
                <mfenced>
 
3015
                    <mi>i</mi>
 
3016
                    <mi>x</mi>
 
3017
                    <mi>y</mi>
 
3018
                </mfenced>
 
3019
                <mo>)</mo>
 
3020
            </mrow>
 
3021
            <mo>&ge;</mo>
 
3022
            <mi>w</mi>
 
3023
            <mo>&ApplyFunction;</mo>
 
3024
            <mrow>
 
3025
                <mo>(</mo>
 
3026
                <mi>P</mi>
 
3027
                <mfenced>
 
3028
                    <mi>j</mi>
 
3029
                    <mi>x</mi>
 
3030
                    <mi>y</mi>
 
3031
                </mfenced>
 
3032
                <mo>)</mo>
 
3033
            </mrow>
 
3034
        </mrow>
 
3035
        <mtext>&ThickSpace;for all&ThickSpace;</mtext>
 
3036
        <mrow>
 
3037
            <mn>1</mn>
 
3038
            <mo>&le;</mo>
 
3039
            <mi>j</mi>
 
3040
            <mo>&le;</mo>
 
3041
            <mi>n</mi>
 
3042
        </mrow>
 
3043
        <mtext>.</mtext>
 
3044
    </mrow>
 
3045
</math>
 
3046
@end html
 
3047
@tex
 
3048
$$
 
3049
    P(i, x, y) \rightarrow Q(x, y),
 
3050
    \hbox{ where } w(P(i, x, y)) \ge w(P(j, x, y))
 
3051
    \hbox{ for all } 1 \le j \le n.
 
3052
$$
 
3053
@end tex
 
3054
@docbook
 
3055
<informalequation>
 
3056
    <mml:math>
 
3057
        <mml:lambda>
 
3058
            <mml:bvar>
 
3059
                <mml:apply>
 
3060
                    <mml:ci>P</mml:ci>
 
3061
                    <mml:ci>i</mml:ci>
 
3062
                    <mml:ci>x</mml:ci>
 
3063
                    <mml:ci>y</mml:ci>
 
3064
                </mml:apply>
 
3065
            </mml:bvar>
 
3066
            <mml:apply>
 
3067
                <mml:ci>Q</mml:ci>
 
3068
                <mml:ci>x</mml:ci>
 
3069
                <mml:ci>y</mml:ci>
 
3070
            </mml:apply>
 
3071
        </mml:lambda>
 
3072
    </mml:math>
 
3073
</informalequation>
 
3074
where
 
3075
<informalequation>
 
3076
    <mml:math>
 
3077
        <mml:apply>
 
3078
            <mml:forall/>
 
3079
            <mml:bvar>
 
3080
                <mml:condition>
 
3081
                    <mml:reln>
 
3082
                        <mml:leq/>
 
3083
                        <mml:cn>1</mml:cn>
 
3084
                        <mml:ci>j</mml:ci>
 
3085
                        <mml:ci>n</mml:ci>
 
3086
                    </mml:reln>
 
3087
                </mml:condition>
 
3088
            </mml:bvar>
 
3089
            <mml:reln>
 
3090
                <mml:geq/>
 
3091
                <mml:apply>
 
3092
                    <mml:ci>w</mml:ci>
 
3093
                    <mml:apply>
 
3094
                        <mml:ci>P</mml:ci>
 
3095
                        <mml:ci>i</mml:ci>
 
3096
                        <mml:ci>x</mml:ci>
 
3097
                        <mml:ci>y</mml:ci>
 
3098
                    </mml:apply>
 
3099
                </mml:apply>
 
3100
                <mml:apply>
 
3101
                    <mml:ci>w</mml:ci>
 
3102
                    <mml:apply>
 
3103
                        <mml:ci>P</mml:ci>
 
3104
                        <mml:ci>j</mml:ci>
 
3105
                        <mml:ci>x</mml:ci>
 
3106
                        <mml:ci>y</mml:ci>
 
3107
                    </mml:apply>
 
3108
                </mml:apply>
 
3109
            </mml:reln>
 
3110
        </mml:apply>
 
3111
    </mml:math>
 
3112
</informalequation>
 
3113
@end docbook
 
3114
 
 
3115
@noindent
 
3116
Note that this ``averaging'' scheme lacks the nice noise-reduction
 
3117
property of the weighted average@tie{}@equationW{}, because only a
 
3118
single input pixel contributes to the output.
 
3119
 
 
3120
 
 
3121
@node Single Criterion Fusing
 
3122
@subsection Single Criterion Fusing
 
3123
@cindex single criterion fusing
 
3124
@cindex fusing, single criterion
 
3125
 
 
3126
Enfuse allows the user to weight each pixel of an input image by up to
 
3127
four different criteria (@pxref{Overview}).  However, it does not
 
3128
force the user to do so.  For some applications and more often simply
 
3129
to gain further insight into the weighting and fusing process, looking
 
3130
at only a single criterion is the preferred way to work.
 
3131
 
 
3132
@cindex active criterion
 
3133
@cindex criterion, active
 
3134
The version of Enfuse for which this documentation was prepared, uses
 
3135
the default weights as stated in @ref{Table:default-weights}.  Notice
 
3136
that by default @emph{more than one} weight is larger than zero, which
 
3137
means they are @emph{active}.
 
3138
 
 
3139
@float Table,Table:default-weights
 
3140
@multitable {Local Contrast} {0.0}
 
3141
@headitem Criterion  @tab Weight
 
3142
@item Exposure       @tab @value{src::default-weight-exposure}
 
3143
@item Saturation     @tab @value{src::default-weight-saturation}
 
3144
@item Local Contrast @tab @value{src::default-weight-contrast}
 
3145
@item Local Entropy  @tab @value{src::default-weight-entropy}
 
3146
@end multitable
 
3147
 
 
3148
@caption{Enfuse's default weights as compiled into version@tie{}@value{VERSION}.}
 
3149
 
 
3150
@shortcaption{Default weights}
 
3151
 
 
3152
@cindex default weights
 
3153
@cindex weights, default
 
3154
@end float
 
3155
 
 
3156
To disable a particular criterion set its weight to zero as for
 
3157
example
 
3158
@example
 
3159
enfuse \
 
3160
    --exposure-weight=1 --saturation-weight=0 \
 
3161
    --contrast-weight=0 --entropy-weight=0 \
 
3162
    img_[1-3].png
 
3163
@end example
 
3164
instructs Enfuse to consider only the exposure weight.  Combine this
 
3165
with option@tie{}@option{--save-masks} and it will become clearer how
 
3166
Enfuse computes the exposure weight for the set of images.
 
3167
 
 
3168
@cindex overpowering criteria
 
3169
@cindex criteria, overpowering one another
 
3170
Another problem that can be inspected by fusing with just a single
 
3171
active criterion and saving the masks is if the weights of one
 
3172
criterion completely overpower all others.
 
3173
 
 
3174
 
 
3175
@node Exposure Weighting
 
3176
@section Exposure Weighting
 
3177
@cindex weighting, exposure
 
3178
 
 
3179
Exposure weighting prefers pixels with a luminance@tie{}@math{Y} close
 
3180
to the center of the normalized, real-valued luminance
 
3181
interval@tie{}@math{[0, 1]}.
 
3182
 
 
3183
@acronym{RGB}-pixels get converted to luminance using the grayscale
 
3184
projector given by @option{--gray-@/projector}, which defaults to
 
3185
@code{average}.  Grayscale pixels are identified with luminance.
 
3186
 
 
3187
In the normalized luminance interval 0.0 represents pure black and 1.0
 
3188
represents pure white independently of the data type of the input
 
3189
image.  This is, for a @acronym{JPEG} image the luminance@tie{}255
 
3190
maps to 1.0 in the normalized interval and for a 32@dmn{bit}
 
3191
@acronym{TIFF} picture the highest luminance value@tie{}4294967295
 
3192
also maps to 1.0.  The middle of the luminance interval, 0.5, is where
 
3193
a neutral gray tone ends up with every camera that had no exposure
 
3194
correction dialed in, for example the image of a gray- or white-card.
 
3195
 
 
3196
The exposure weighting algorithm only looks at a single pixel at a
 
3197
time; the pixel's neighborhood is not taken into account.
 
3198
 
 
3199
The weighting function is the Gaussian
 
3200
@ifinfo
 
3201
@display
 
3202
@math{w_exp(Y) = exp(-0.5 * ((Y - Mu) / Sigma)^2),}
 
3203
@end display
 
3204
@end ifinfo
 
3205
@html
 
3206
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
3207
    <mrow>
 
3208
        <mrow>
 
3209
            <msub>
 
3210
                <mi>w</mi>
 
3211
                <mtext>exp</mtext>
 
3212
            </msub>
 
3213
            <mo>&ApplyFunction;</mo>
 
3214
            <mrow>
 
3215
                <mo>(</mo>
 
3216
                <mi>Y</mi>
 
3217
                <mo>)</mo>
 
3218
            </mrow>
 
3219
        </mrow>
 
3220
        <mo>=</mo>
 
3221
        <mrow>
 
3222
            <mtext>exp</mtext>
 
3223
            <mo>&ApplyFunction;</mo>
 
3224
            <mrow>
 
3225
                <mo>(</mo>
 
3226
                <mo>-</mo>
 
3227
                <mfrac>
 
3228
                    <mn>1</mn>
 
3229
                    <mn>2</mn>
 
3230
                </mfrac>
 
3231
                <mo>&InvisibleTimes;</mo>
 
3232
                <msup>
 
3233
                    <mrow>
 
3234
                        <mo>(</mo>
 
3235
                        <mfrac>
 
3236
                            <mrow>
 
3237
                                <mi>Y</mi>
 
3238
                                <mo>-</mo>
 
3239
                                <mi mathvariant="italic">Mu</mi>
 
3240
                            </mrow>
 
3241
                            <mi mathvariant="italic">Sigma</mi>
 
3242
                        </mfrac>
 
3243
                        <mo>)</mo>
 
3244
                    </mrow>
 
3245
                    <mn>2</mn>
 
3246
                </msup>
 
3247
                <mo>)</mo>
 
3248
            </mrow>
 
3249
        </mrow>
 
3250
    </mrow>
 
3251
</math>
 
3252
@end html
 
3253
@tex
 
3254
$$
 
3255
    w_{\mathrm{exp}}(Y) =
 
3256
    \exp\left(-{1 \over 2}
 
3257
              \left(Y - \mathit{Mu} \over \mathit{Sigma} \right)^2\right),
 
3258
$$
 
3259
@end tex
 
3260
@docbook
 
3261
<informalequation>
 
3262
    <mml:math>
 
3263
        <mml:reln>
 
3264
            <mml:eq/>
 
3265
            <mml:apply>
 
3266
                <mml:csymbol>
 
3267
                    <mml:msub>
 
3268
                        <mml:mi>w</mml:mi>
 
3269
                        <mml:mi mathvariant="normal">exp</mml:mi>
 
3270
                    </mml:msub>
 
3271
                </mml:csymbol>
 
3272
                <mml:ci>Y</mml:ci>
 
3273
            </mml:apply>
 
3274
            <mml:apply>
 
3275
                <mml:exp/>
 
3276
                <mml:apply>
 
3277
                    <mml:times/>
 
3278
                    <mml:apply>
 
3279
                        <mml:minus/>
 
3280
                        <mml:apply>
 
3281
                            <mml:divide/>
 
3282
                            <mml:cn>1</mml:cn>
 
3283
                            <mml:cn>2</mml:cn>
 
3284
                        </mml:apply>
 
3285
                    </mml:apply>
 
3286
                    <mml:apply>
 
3287
                        <mml:power/>
 
3288
                        <mml:apply>
 
3289
                            <mml:divide/>
 
3290
                            <mml:apply>
 
3291
                                <mml:minus/>
 
3292
                                <mml:ci>Y</mml:ci>
 
3293
                                <mml:ci>Mu</mml:ci>
 
3294
                            </mml:apply>
 
3295
                            <mml:ci>Sigma</mml:ci>
 
3296
                        </mml:apply>
 
3297
                        <mml:cn>2</mml:cn>
 
3298
                    </mml:apply>
 
3299
                </mml:apply>
 
3300
            </mml:apply>
 
3301
        </mml:reln>
 
3302
    </mml:math>
 
3303
</informalequation>
 
3304
@end docbook
 
3305
 
 
3306
@noindent
 
3307
whose center@tie{}@math{Mu} and width@tie{}@math{Sigma} are controlled
 
3308
by the command line options@tie{}@option{--exposure-mu} and @option{--exposure-sigma}
 
3309
respectively.  @math{Mu} defaults to @value{src::default-exposure-mu}
 
3310
and @math{Sigma} defaults to @value{src::default-exposure-sigma}.
 
3311
@ref{Figure:gaussian} shows a Gaussian.
 
3312
 
 
3313
@float Figure,Figure:gaussian
 
3314
@vimage{gaussian}
 
3315
 
 
3316
@caption{Gaussian function with the parameters @var{Mu} = 0.5 and @var{Sigma} = 0.2.}
 
3317
 
 
3318
@shortcaption{Gaussian function}
 
3319
@end float
 
3320
 
 
3321
The options@tie{}@option{--exposure-mu} and @option{--exposure-sigma} are for
 
3322
fine-tuning the final result without changing the set of input images.
 
3323
Option@tie{}@option{--exposure-mu} sets the point @var{Mu} of optimum
 
3324
exposure.  Increasing @var{Mu} makes Enfuse prefer lighter pixels,
 
3325
rendering the final image lighter, and vice versa.
 
3326
Option@tie{}@option{--exposure-sigma} defines the range @var{Sigma} of
 
3327
acceptable exposures.  Small values of @var{Sigma} penalize exposures
 
3328
that deviate from @var{Mu} more, and vice versa.
 
3329
 
 
3330
@optionsummaryheading{}
 
3331
 
 
3332
@table @option
 
3333
@item --exposure-weight
 
3334
@ref{Fusion Options}
 
3335
 
 
3336
@item --exposure-mu
 
3337
@ref{Fusion Options}
 
3338
 
 
3339
@item --exposure-sigma
 
3340
@ref{Fusion Options}
 
3341
 
 
3342
@item --gray-projector
 
3343
@ref{Expert Options}
 
3344
@end table
 
3345
 
 
3346
 
 
3347
@node Saturation Weighting
 
3348
@section Saturation Weighting
 
3349
@cindex weighting, saturation
 
3350
 
 
3351
Saturation weighting prefers pixels with a high saturation.
 
3352
 
 
3353
Enfuse computes the saturation of a pixel according to the following
 
3354
algorithm.
 
3355
 
 
3356
@example
 
3357
@group
 
3358
@var{max} := maximum(@var{R}, @var{G}, @var{B})
 
3359
@var{min} := minimum(@var{R}, @var{G}, @var{B})
 
3360
@b{if} @var{max} = @var{min} @b{then}
 
3361
    @var{saturation} := 0
 
3362
@b{else}
 
3363
    @var{sum} := @var{max} + @var{min}
 
3364
    @var{difference} := @var{max} - @var{min}
 
3365
    @b{if} @var{sum} @leq{} 1 @b{then}
 
3366
        @var{saturation} := @var{difference} / @var{sum}
 
3367
    @b{else}
 
3368
        @var{saturation} := @var{difference} / (2 - @var{sum})
 
3369
    @b{end if}
 
3370
@b{end if}
 
3371
@end group
 
3372
@end example
 
3373
 
 
3374
@noindent
 
3375
Obviously, saturation weighting can only be defined for @acronym{RGB}
 
3376
images, not for grayscale ones!  If you need something similar, check
 
3377
out @ref{Local Entropy Weighting}; entropy weighting works for both
 
3378
@acronym{RGB} and grayscale pictures.
 
3379
 
 
3380
The saturation weighting algorithm only looks at a single pixel at a
 
3381
time; the pixel's neighborhood is not taken into account.
 
3382
 
 
3383
@optionsummaryheading{}
 
3384
 
 
3385
@table @option
 
3386
@item --saturation-weight
 
3387
@ref{Fusion Options}
 
3388
@end table
 
3389
 
 
3390
 
 
3391
@node Local Contrast Weighting
 
3392
@section Local Contrast Weighting
 
3393
@cindex weighting, local contrast
 
3394
 
 
3395
Local contrast weighting favors pixels inside a high contrast
 
3396
neighborhood.  The notion of ``high contrast'' is defined either by
 
3397
two different criteria or by a blend of both:
 
3398
 
 
3399
@itemize
 
3400
@item
 
3401
The standard deviation (@acronym{SDev}) of all the pixels in the local
 
3402
analysis window is large.  @xref{Standard Deviation}.
 
3403
 
 
3404
@item
 
3405
The Laplacian-of-Gaussian (@acronym{LoG}) has a large magnitude.
 
3406
@xref{Laplacian of Gaussian}.
 
3407
 
 
3408
@item
 
3409
If the @acronym{LoG} magnitude is below a given threshold, use
 
3410
@acronym{SDev} data, otherwise stick with @acronym{LoG}.
 
3411
@xref{Blend SDev and LoG}.
 
3412
@end itemize
 
3413
 
 
3414
Enfuse converts every @acronym{RGB} image to grayscale before it
 
3415
determines its contrast.  Option@tie{}@option{--gray-projector}
 
3416
(@pxref{Expert Options}) controls the projector function.  Depending
 
3417
on the subject, one of several grayscale projectors may yield the best
 
3418
black-and-white contrast for image fusion.
 
3419
 
 
3420
In the following sections we describe each algorithm in detail.
 
3421
 
 
3422
@menu
 
3423
* Standard Deviation::          Standard deviation (@acronym{SDev})
 
3424
* Laplacian of Gaussian::       @acronym{LoG}, a second derivative method
 
3425
* Blend SDev and LoG::          Mix and match @acronym{SDev} and @acronym{LoG}
 
3426
* Scaling and Choice of Mode::  How parameters do not scale; neither does mode
 
3427
@end menu
 
3428
 
 
3429
 
 
3430
@node Standard Deviation
 
3431
@subsection Standard Deviation
 
3432
@cindex weighting, contrast using standard deviation
 
3433
@cindex contrast weighting using standard deviation
 
3434
 
 
3435
@cindex local analysis window
 
3436
@cindex window, local-analysis
 
3437
The pixel under consideration@tie{}C sits exactly in the center of a
 
3438
square, the so-called @dfn{local analysis window}.  It always has an
 
3439
uneven edge length.  The user sets the size with
 
3440
option@tie{}@option{--contrast-window-size}.
 
3441
@ref{Figure:local-analysis-window} shows two windows with different
 
3442
sizes.
 
3443
 
 
3444
@float Figure,Figure:local-analysis-window
 
3445
@vimage{local-analysis-window}
 
3446
 
 
3447
@caption{Examples of local analysis windows for the sizes 3 and 5.  ``C'' marks the center where the pixel gets the weight.  ``N'' are neighboring pixels, which all contribute equally to the weight.}
 
3448
 
 
3449
@shortcaption{Local analysis window}
 
3450
@end float
 
3451
 
 
3452
During the analysis, Enfuse scans the local analysis window across all
 
3453
rows and all columns@footnote{In the current implementation a
 
3454
@code{floor(contrast-window-size / 2)} wide border around the images
 
3455
remains unprocessed and gets a weight of zero.} of each of the input
 
3456
images to compute the contrast weight of every pixel.
 
3457
 
 
3458
@optionsummaryheading{}
 
3459
 
 
3460
@table @option
 
3461
@item --contrast-weight
 
3462
@ref{Fusion Options}
 
3463
 
 
3464
@item --hard-mask
 
3465
@ref{Fusion Options}
 
3466
 
 
3467
@item --contrast-window-size
 
3468
@ref{Expert Options}
 
3469
 
 
3470
@item --gray-projector
 
3471
@ref{Expert Options}
 
3472
@end table
 
3473
 
 
3474
 
 
3475
@subsubsection Statistical Moments
 
3476
@cindex statistical moments
 
3477
 
 
3478
@cindex probability function
 
3479
We start with the @dfn{probability function} @math{w} of the random
 
3480
variable@tie{}@math{X}:
 
3481
@ifinfo
 
3482
@display
 
3483
@math{w: x --> p(@{omega: X(omega) = x@})}.
 
3484
@end display
 
3485
@end ifinfo
 
3486
@html
 
3487
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
3488
    <mrow>
 
3489
        <mi>w</mi>
 
3490
        <mo>:</mo>
 
3491
        <mrow>
 
3492
            <mi>x</mi>
 
3493
            <mo>&rightarrow;</mo>
 
3494
            <mi>p</mi>
 
3495
            <mo>&ApplyFunction;</mo>
 
3496
            <mo>(</mo>
 
3497
            <mrow>
 
3498
                <mo>&lcub;</mo>
 
3499
                <mrow>
 
3500
                    <mi>&omega;</mi>
 
3501
                    <mo>:</mo>
 
3502
                    <mrow>
 
3503
                        <mi>X</mi>
 
3504
                        <mo>&ApplyFunction;</mo>
 
3505
                        <mrow>
 
3506
                            <mo>(</mo>
 
3507
                            <mi>&omega;</mi>
 
3508
                            <mo>)</mo>
 
3509
                        </mrow>
 
3510
                        <mo>=</mo>
 
3511
                        <mi>x</mi>
 
3512
                    </mrow>
 
3513
                </mrow>
 
3514
                <mo>&rcub;</mo>
 
3515
            </mrow>
 
3516
            <mo>)</mo>
 
3517
        </mrow>
 
3518
        <mtext>.</mtext>
 
3519
    </mrow>
 
3520
</math>
 
3521
@end html
 
3522
@tex
 
3523
$$
 
3524
    w: x \rightarrow p(\{\omega: X(\omega) = x\}).
 
3525
$$
 
3526
@end tex
 
3527
@docbook
 
3528
<informalequation>
 
3529
    <mml:math>
 
3530
        <mml:apply>
 
3531
            <mml:csymbol>
 
3532
                <mml:mo>:</mml:mo>
 
3533
            </mml:csymbol>
 
3534
            <mml:ci>w</mml:ci>
 
3535
            <mml:lambda>
 
3536
                <mml:bvar>
 
3537
                    <mml:ci>x</mml:ci>
 
3538
                </mml:bvar>
 
3539
                <mml:apply>
 
3540
                    <mml:ci>p</mml:ci>
 
3541
                    <mml:set>
 
3542
                        <mml:bvar>
 
3543
                            <mml:ci>&omega;</mml:ci>
 
3544
                        </mml:bvar>
 
3545
                        <mml:condition>
 
3546
                            <mml:reln>
 
3547
                                <mml:eq/>
 
3548
                                <mml:apply>
 
3549
                                    <mml:ci>X</mml:ci>
 
3550
                                    <mml:ci>&omega;</mml:ci>
 
3551
                                </mml:apply>
 
3552
                                <mml:ci>x</mml:ci>
 
3553
                            </mml:reln>
 
3554
                        </mml:condition>
 
3555
                    </mml:set>
 
3556
                </mml:apply>
 
3557
            </mml:lambda>
 
3558
        </mml:apply>
 
3559
    </mml:math>
 
3560
</informalequation>
 
3561
@end docbook
 
3562
 
 
3563
@noindent
 
3564
It associates a probability@tie{}@math{p} with each of the @math{n}
 
3565
different possible outcomes@tie{}@inlineomega{} of the random
 
3566
variable@tie{}@math{X}.
 
3567
@cindex expectation value
 
3568
Based on @math{w}, we define the @dfn{expectation value} or ``First
 
3569
Moment'' of the random variable@tie{}@math{X}:
 
3570
@ifinfo
 
3571
@display
 
3572
@math{Ex X := sum(x_i * w(x_i), i = 1..n).}
 
3573
@end display
 
3574
@end ifinfo
 
3575
@html
 
3576
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
3577
    <mrow>
 
3578
        <mrow>
 
3579
            <mo mathvariant="sans-serif">Ex</mo>
 
3580
            <mo>&ApplyFunction;</mo>
 
3581
            <mi>X</mi>
 
3582
        </mrow>
 
3583
        <mo>:=</mo>
 
3584
        <mrow>
 
3585
            <munderover>
 
3586
                <mo>&sum;</mo>
 
3587
                <mrow>
 
3588
                    <mi>i</mi>
 
3589
                    <mo>=</mo>
 
3590
                    <mn>1</mn>
 
3591
                </mrow>
 
3592
                <mi>n</mi>
 
3593
            </munderover>
 
3594
            <msub>
 
3595
                <mi>x</mi>
 
3596
                <mi>i</mi>
 
3597
            </msub>
 
3598
            <mo>&times;</mo>
 
3599
            <mi>w</mi>
 
3600
            <mo>&ApplyFunction;</mo>
 
3601
            <mrow>
 
3602
                <mo>(</mo>
 
3603
                <msub>
 
3604
                    <mi>x</mi>
 
3605
                    <mi>i</mi>
 
3606
                </msub>
 
3607
                <mo>)</mo>
 
3608
            </mrow>
 
3609
            <mtext>.</mtext>
 
3610
        </mrow>
 
3611
    </mrow>
 
3612
</math>
 
3613
@end html
 
3614
@tex
 
3615
$$
 
3616
    \hbox{\sf Ex } X := \sum_{i = 1}^n x_i w(x_i).
 
3617
$$
 
3618
@end tex
 
3619
@docbook
 
3620
<informalequation>
 
3621
    <mml:math>
 
3622
        <mml:reln>
 
3623
            <mml:eq/>
 
3624
            <mml:apply>
 
3625
                <mml:csymbol>
 
3626
                    <mml:mtext mathvariant="sans-serif">Ex</mml:mtext>
 
3627
                </mml:csymbol>
 
3628
                <mml:ci>X</mml:ci>
 
3629
            </mml:apply>
 
3630
            <mml:apply>
 
3631
                <mml:moment/>
 
3632
                <mml:degree>
 
3633
                    <mml:cn>1</mml:cn>
 
3634
                </mml:degree>
 
3635
                <mml:ci>X</mml:ci>
 
3636
            </mml:apply>
 
3637
            <mml:apply>
 
3638
                <mml:sum/>
 
3639
                <mml:bvar>
 
3640
                    <mml:ci>i</mml:ci>
 
3641
                </mml:bvar>
 
3642
                <mml:lowlimit>
 
3643
                    <mml:cn>1</mml:cn>
 
3644
                </mml:lowlimit>
 
3645
                <mml:uplimit>
 
3646
                    <mml:ci>n</mml:ci>
 
3647
                </mml:uplimit>
 
3648
                <mml:apply>
 
3649
                    <mml:times/>
 
3650
                    <mml:apply>
 
3651
                        <mml:selector/>
 
3652
                        <mml:ci>x</mml:ci>
 
3653
                        <mml:ci>i</mml:ci>
 
3654
                    </mml:apply>
 
3655
                    <mml:apply>
 
3656
                        <mml:ci>w</mml:ci>
 
3657
                        <mml:apply>
 
3658
                            <mml:selector/>
 
3659
                            <mml:ci>x</mml:ci>
 
3660
                            <mml:ci>i</mml:ci>
 
3661
                        </mml:apply>
 
3662
                    </mml:apply>
 
3663
                </mml:apply>
 
3664
            </mml:apply>
 
3665
        </mml:reln>
 
3666
    </mml:math>
 
3667
</informalequation>
 
3668
@end docbook
 
3669
 
 
3670
@cindex variance
 
3671
@noindent
 
3672
Using the definition of the expectation value, we define the
 
3673
@dfn{variance}, or ``Second Moment'' as
 
3674
@ifinfo
 
3675
@display
 
3676
@math{Var X := Ex((X - Ex X)^2)},
 
3677
@end display
 
3678
@end ifinfo
 
3679
@html
 
3680
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
3681
    <mrow>
 
3682
        <mo mathvariant="sans-serif">Var</mo>
 
3683
        <mo>&ApplyFunction;</mo>
 
3684
        <mi>X</mi>
 
3685
    </mrow>
 
3686
    <mo>:=</mo>
 
3687
    <mrow>
 
3688
        <mo mathvariant="sans-serif">Ex</mo>
 
3689
        <mo>&ApplyFunction;</mo>
 
3690
        <mrow>
 
3691
            <mo>(</mo>
 
3692
            <msup>
 
3693
                <mrow>
 
3694
                    <mo>(</mo>
 
3695
                    <mi>X</mi>
 
3696
                    <mo>-</mo>
 
3697
                    <mrow>
 
3698
                        <mo mathvariant="sans-serif">Ex</mo>
 
3699
                        <mo>&ApplyFunction;</mo>
 
3700
                        <mi>X</mi>
 
3701
                    </mrow>
 
3702
                    <mo>)</mo>
 
3703
                </mrow>
 
3704
                <mn>2</mn>
 
3705
            </msup>
 
3706
            <mo>)</mo>
 
3707
        </mrow>
 
3708
    </mrow>
 
3709
</math>
 
3710
@end html
 
3711
@tex
 
3712
$$
 
3713
    \hbox{\sf Var } X := \hbox{\sf Ex}\left( (X - \hbox{\sf Ex } X)^2 \right),
 
3714
$$
 
3715
@end tex
 
3716
@docbook
 
3717
<informalequation>
 
3718
    <mml:math>
 
3719
        <mml:reln>
 
3720
            <mml:eq/>
 
3721
            <mml:apply>
 
3722
                <mml:csymbol>
 
3723
                    <mml:mtext mathvariant="sans-serif">Var</mml:mtext>
 
3724
                </mml:csymbol>
 
3725
                <mml:ci>X</mml:ci>
 
3726
            </mml:apply>
 
3727
            <mml:apply>
 
3728
                <mml:variance/>
 
3729
                <mml:ci>X</mml:ci>
 
3730
            </mml:apply>
 
3731
            <mml:apply>
 
3732
                <mml:moment/>
 
3733
                <mml:degree>
 
3734
                    <mml:cn>2</mml:cn>
 
3735
                </mml:degree>
 
3736
                <mml:ci>X</mml:ci>
 
3737
            </mml:apply>
 
3738
            <mml:apply>
 
3739
                <mml:csymbol>
 
3740
                    <mml:mtext mathvariant="sans-serif">Ex</mml:mtext>
 
3741
                </mml:csymbol>
 
3742
                <mml:apply>
 
3743
                    <mml:power/>
 
3744
                    <mml:apply>
 
3745
                        <mml:minus/>
 
3746
                        <mml:ci>X</mml:ci>
 
3747
                        <mml:apply>
 
3748
                            <mml:csymbol>
 
3749
                                <mml:mtext mathvariant="sans-serif">Ex</mml:mtext>
 
3750
                            </mml:csymbol>
 
3751
                            <mml:ci>X</mml:ci>
 
3752
                        </mml:apply>
 
3753
                    </mml:apply>
 
3754
                    <mml:cn>2</mml:cn>
 
3755
                </mml:apply>
 
3756
            </mml:apply>
 
3757
        </mml:reln>
 
3758
    </mml:math>
 
3759
</informalequation>
 
3760
@end docbook
 
3761
 
 
3762
@cindex standard deviation
 
3763
@noindent
 
3764
and the @dfn{standard deviation} as
 
3765
@ifinfo
 
3766
@display
 
3767
@math{Sdev X := sqrt(Var X)}.
 
3768
@end display
 
3769
@end ifinfo
 
3770
@html
 
3771
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
3772
    <mrow>
 
3773
        <mrow>
 
3774
            <mo>&sigma;</mo>
 
3775
            <mo>&ApplyFunction;</mo>
 
3776
            <mi>X</mi>
 
3777
        </mrow>
 
3778
        <mo>:=</mo>
 
3779
        <msqrt>
 
3780
            <mo mathvariant="sans-serif">Var</mo>
 
3781
            <mo>&ApplyFunction;</mo>
 
3782
            <mi>X</mi>
 
3783
        </msqrt>
 
3784
        <mtext>.</mtext>
 
3785
    </mrow>
 
3786
</math>
 
3787
@end html
 
3788
@tex
 
3789
$$
 
3790
    \sigma X := \sqrt{\hbox{\sf Var } X}.
 
3791
$$
 
3792
@end tex
 
3793
@docbook
 
3794
<informalequation>
 
3795
    <mml:math>
 
3796
        <mml:reln>
 
3797
            <mml:eq/>
 
3798
            <mml:apply>
 
3799
                <mml:sdev/>
 
3800
                <mml:ci>X</mml:ci>
 
3801
            </mml:apply>
 
3802
            <mml:apply>
 
3803
                <mml:root/>
 
3804
                <mml:degree>
 
3805
                    <mml:cn>2</mml:cn>
 
3806
                </mml:degree>
 
3807
                <mml:apply>
 
3808
                    <mml:moment/>
 
3809
                    <mml:degree>
 
3810
                        <mml:cn>2</mml:cn>
 
3811
                    </mml:degree>
 
3812
                    <mml:ci>X</mml:ci>
 
3813
                </mml:apply>
 
3814
            </mml:apply>
 
3815
            <mml:apply>
 
3816
                <mml:root/>
 
3817
                <mml:degree>
 
3818
                    <mml:cn>2</mml:cn>
 
3819
                </mml:degree>
 
3820
                <mml:apply>
 
3821
                    <mml:csymbol>
 
3822
                        <mml:mtext mathvariant="sans-serif">Var</mml:mtext>
 
3823
                    </mml:csymbol>
 
3824
                    <mml:ci>X</mml:ci>
 
3825
                </mml:apply>
 
3826
            </mml:apply>
 
3827
        </mml:reln>
 
3828
    </mml:math>
 
3829
</informalequation>
 
3830
@end docbook
 
3831
 
 
3832
Obviously, the variance of @math{X} is the expectation value of the
 
3833
squared deviation from the expectation value of @math{X} itself.  Note
 
3834
that the variance's dimension is @math{X}'s dimension squared; the
 
3835
standard deviation rectifies the dimension to make it comparable with
 
3836
@math{X} itself again.
 
3837
 
 
3838
 
 
3839
@subsubsection Estimators
 
3840
@cindex estimators
 
3841
 
 
3842
In Enfuse, we assume that @math{X} follows a uniform probability
 
3843
function@tie{}@math{w(x)} = const.  That is, all pixel values in the
 
3844
local analysis window are considered to be equally probable.  Thus,
 
3845
the expectation value and the variance can be estimated from the pixel
 
3846
values like this
 
3847
@ifinfo
 
3848
@display
 
3849
@math{Ex X = sum(x_i, i = 1..n) / n.}
 
3850
@end display
 
3851
@end ifinfo
 
3852
@html
 
3853
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
3854
    <mrow>
 
3855
        <mrow>
 
3856
            <mo mathvariant="sans-serif">Ex</mo>
 
3857
            <mo>&ApplyFunction;</mo>
 
3858
            <mi>X</mi>
 
3859
        </mrow>
 
3860
        <mo>:=</mo>
 
3861
        <mrow>
 
3862
            <mfrac>
 
3863
                <mn>1</mn>
 
3864
                <mi>n</mi>
 
3865
            </mfrac>
 
3866
            <mo>&InvisibleTimes;</mo>
 
3867
            <mrow>
 
3868
                <munderover>
 
3869
                    <mo>&sum;</mo>
 
3870
                    <mrow>
 
3871
                        <mi>i</mi>
 
3872
                        <mo>=</mo>
 
3873
                        <mn>1</mn>
 
3874
                    </mrow>
 
3875
                    <mi>n</mi>
 
3876
                </munderover>
 
3877
                <msub>
 
3878
                    <mi>x</mi>
 
3879
                    <mi>i</mi>
 
3880
                </msub>
 
3881
            </mrow>
 
3882
        </mrow>
 
3883
        <mtext>.</mtext>
 
3884
    </mrow>
 
3885
</math>
 
3886
@end html
 
3887
@tex
 
3888
$$
 
3889
    \hbox{\sf Ex } X := {1 \over n} \sum_{i = 1}^n x_i.
 
3890
$$
 
3891
@end tex
 
3892
@docbook
 
3893
<informalequation>
 
3894
    <mml:math>
 
3895
        <mml:reln>
 
3896
            <mml:eq/>
 
3897
            <mml:apply>
 
3898
                <mml:csymbol>
 
3899
                    <mml:mtext mathvariant="sans-serif">Ex</mml:mtext>
 
3900
                </mml:csymbol>
 
3901
                <mml:ci>X</mml:ci>
 
3902
            </mml:apply>
 
3903
            <mml:apply>
 
3904
                <mml:times/>
 
3905
                <mml:apply>
 
3906
                    <mml:divide/>
 
3907
                    <mml:cn>1</mml:cn>
 
3908
                    <mml:ci>n</mml:ci>
 
3909
                </mml:apply>
 
3910
                <mml:apply>
 
3911
                    <mml:sum/>
 
3912
                    <mml:bvar>
 
3913
                        <mml:ci>i</mml:ci>
 
3914
                    </mml:bvar>
 
3915
                    <mml:lowlimit>
 
3916
                        <mml:cn>1</mml:cn>
 
3917
                    </mml:lowlimit>
 
3918
                    <mml:uplimit>
 
3919
                        <mml:ci>n</mml:ci>
 
3920
                    </mml:uplimit>
 
3921
                    <mml:apply>
 
3922
                        <mml:selector/>
 
3923
                        <mml:ci>x</mml:ci>
 
3924
                        <mml:ci>i</mml:ci>
 
3925
                    </mml:apply>
 
3926
                </mml:apply>
 
3927
            </mml:apply>
 
3928
        </mml:reln>
 
3929
    </mml:math>
 
3930
</informalequation>
 
3931
@end docbook
 
3932
 
 
3933
@noindent
 
3934
In other words: the expectation value is the arithmetic mean of the
 
3935
lightness of all pixels in the local analysis window.  Analogously,
 
3936
the variance becomes
 
3937
@ifinfo
 
3938
@display
 
3939
@math{Var X = sum((x_i - Ex x)^2, i = 1..n) / (n - 1).}
 
3940
@end display
 
3941
@end ifinfo
 
3942
@html
 
3943
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
3944
    <mrow>
 
3945
        <mrow>
 
3946
            <mo mathvariant="sans-serif">Var</mo>
 
3947
            <mo>&ApplyFunction;</mo>
 
3948
            <mi>X</mi>
 
3949
        </mrow>
 
3950
        <mo>:=</mo>
 
3951
        <mfrac>
 
3952
            <mn>1</mn>
 
3953
            <mrow>
 
3954
                <mi>n</mi>
 
3955
                <mo>-</mo>
 
3956
                <mn>1</mn>
 
3957
            </mrow>
 
3958
        </mfrac>
 
3959
        <mo>&InvisibleTimes;</mo>
 
3960
        <mrow>
 
3961
            <mo mathvariant="sans-serif">Ex</mo>
 
3962
            <mo>&ApplyFunction;</mo>
 
3963
            <mrow>
 
3964
                <mo>(</mo>
 
3965
                <msup>
 
3966
                    <mrow>
 
3967
                        <mo>(</mo>
 
3968
                        <mi>X</mi>
 
3969
                        <mo>-</mo>
 
3970
                        <mrow>
 
3971
                            <mo mathvariant="sans-serif">Ex</mo>
 
3972
                            <mo>&ApplyFunction;</mo>
 
3973
                            <mi>X</mi>
 
3974
                        </mrow>
 
3975
                        <mo>)</mo>
 
3976
                    </mrow>
 
3977
                    <mn>2</mn>
 
3978
                </msup>
 
3979
                <mo>)</mo>
 
3980
            </mrow>
 
3981
        </mrow>
 
3982
        <mtext>.</mtext>
 
3983
    </mrow>
 
3984
</math>
 
3985
@end html
 
3986
@tex
 
3987
$$
 
3988
    \hbox{\sf Var } X :=
 
3989
    {1 \over {n - 1}} \, \hbox{\sf Ex}\left( (X - \hbox{\sf Ex } X)^2 \right).
 
3990
$$
 
3991
@end tex
 
3992
@docbook
 
3993
<informalequation>
 
3994
    <mml:math>
 
3995
        <mml:reln>
 
3996
            <mml:eq/>
 
3997
            <mml:apply>
 
3998
                <mml:csymbol>
 
3999
                    <mml:mtext mathvariant="sans-serif">Var</mml:mtext>
 
4000
                </mml:csymbol>
 
4001
                <mml:ci>X</mml:ci>
 
4002
            </mml:apply>
 
4003
            <mml:apply>
 
4004
                <mml:times/>
 
4005
                <mml:apply>
 
4006
                    <mml:divide/>
 
4007
                    <mml:cn>1</mml:cn>
 
4008
                    <mml:apply>
 
4009
                        <mml:minus/>
 
4010
                        <mml:ci>n</mml:ci>
 
4011
                        <mml:cn>1</mml:cn>
 
4012
                    </mml:apply>
 
4013
                </mml:apply>
 
4014
                <mml:apply>
 
4015
                    <mml:csymbol>
 
4016
                        <mml:mtext mathvariant="sans-serif">Ex</mml:mtext>
 
4017
                    </mml:csymbol>
 
4018
                    <mml:apply>
 
4019
                        <mml:power/>
 
4020
                        <mml:apply>
 
4021
                            <mml:minus/>
 
4022
                            <mml:ci>X</mml:ci>
 
4023
                            <mml:apply>
 
4024
                                <mml:csymbol>
 
4025
                                    <mml:mtext mathvariant="sans-serif">Ex</mml:mtext>
 
4026
                                </mml:csymbol>
 
4027
                                <mml:ci>X</mml:ci>
 
4028
                            </mml:apply>
 
4029
                        </mml:apply>
 
4030
                        <mml:cn>2</mml:cn>
 
4031
                    </mml:apply>
 
4032
                </mml:apply>
 
4033
            </mml:apply>
 
4034
        </mml:reln>
 
4035
    </mml:math>
 
4036
</informalequation>
 
4037
@end docbook
 
4038
 
 
4039
 
 
4040
@node Laplacian of Gaussian
 
4041
@subsection Laplacian of Gaussian
 
4042
@cindex weighting, contrast using laplacian-of--gaussian
 
4043
@cindex contrast weighting using laplacian-of--gaussian
 
4044
 
 
4045
@cindex Laplacian of Gaussian (@acronym{LoG})
 
4046
The @dfn{Laplacian of Gaussian} (@acronym{LoG}) is an operator to
 
4047
detect edges in an image.  Sometimes the @acronym{LoG}-operator is
 
4048
also called @sc{Marr}-@sc{Hildreth} operator.  A Laplacian-of-Gaussian
 
4049
operator,
 
4050
@uref{http://@/hci.iwr.uni-@/heidelberg.de/@/vigra/@/doc/@/vigra/@/group__@/Common@/Convolution@/Filters.html,
 
4051
@code{vigra::@/laplacian@/Of@/Gaussian}} is part of the
 
4052
package@tie{}@uref{http://@/hci.iwr.uni-@/heidelberg.de/@/vigra/,
 
4053
@acronym{VIGRA}} that Enfuse is built upon and is used for edge
 
4054
detection if option@tie{}@option{--contrast-edge-scale} is non-zero and
 
4055
@option{--contrast-min-curvature} equal to or less than zero.
 
4056
 
 
4057
Let the Gaussian function be
 
4058
@ifinfo
 
4059
@display
 
4060
@math{g(x, y) = 1/pi * exp((x^2 + y^2) / (2 * sigma^2))/(2 * sigma^2)}
 
4061
@end display
 
4062
@end ifinfo
 
4063
@html
 
4064
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
4065
    <mrow>
 
4066
        <mrow>
 
4067
            <mi>g</mi>
 
4068
            <mfenced>
 
4069
                <mi>x</mi>
 
4070
                <mi>y</mi>
 
4071
            </mfenced>
 
4072
        </mrow>
 
4073
        <mo>=</mo>
 
4074
        <mrow>
 
4075
            <mfrac>
 
4076
                <mn>1</mn>
 
4077
                <mrow>
 
4078
                    <mn>2</mn>
 
4079
                    <mo>&InvisibleTimes;</mo>
 
4080
                    <mi>&pi;</mi>
 
4081
                    <mo>&InvisibleTimes;</mo>
 
4082
                    <msup>
 
4083
                        <mi>&sigma;</mi>
 
4084
                        <mn>2</mn>
 
4085
                    </msup>
 
4086
                </mrow>
 
4087
            </mfrac>
 
4088
            <mo>&InvisibleTimes;</mo>
 
4089
            <mtext>exp</mtext>
 
4090
            <mo>&ApplyFunction;</mo>
 
4091
            <mrow>
 
4092
                <mo>(</mo>
 
4093
                <mo>-</mo>
 
4094
                <mfrac>
 
4095
                    <mrow>
 
4096
                        <msup>
 
4097
                            <mi>x</mi>
 
4098
                            <mn>2</mn>
 
4099
                        </msup>
 
4100
                        <mo>+</mo>
 
4101
                        <msup>
 
4102
                            <mi>y</mi>
 
4103
                            <mn>2</mn>
 
4104
                        </msup>
 
4105
                    </mrow>
 
4106
                    <mrow>
 
4107
                        <mn>2</mn>
 
4108
                        <mo>&InvisibleTimes;</mo>
 
4109
                        <msup>
 
4110
                            <mi>&sigma;</mi>
 
4111
                            <mn>2</mn>
 
4112
                        </msup>
 
4113
                    </mrow>
 
4114
                </mfrac>
 
4115
                <mo>)</mo>
 
4116
            </mrow>
 
4117
        </mrow>
 
4118
    </mrow>
 
4119
</math>
 
4120
@end html
 
4121
@tex
 
4122
$$
 
4123
    g(x, y) =
 
4124
    {1 \over {2 \pi \sigma^2}} \,
 
4125
    {\exp\left(-{{x^2 + y^2} \over {2 \sigma^2}}\right)}
 
4126
$$
 
4127
@end tex
 
4128
@docbook
 
4129
<informalequation>
 
4130
    <mml:math>
 
4131
        <mml:reln>
 
4132
            <mml:eq/>
 
4133
            <mml:apply>
 
4134
                <mml:ci>g</mml:ci>
 
4135
                <mml:ci>x</mml:ci>
 
4136
                <mml:ci>y</mml:ci>
 
4137
            </mml:apply>
 
4138
            <mml:apply>
 
4139
                <mml:times/>
 
4140
                <mml:apply>
 
4141
                    <mml:divide/>
 
4142
                    <mml:cn>1</mml:cn>
 
4143
                    <mml:apply>
 
4144
                        <mml:times/>
 
4145
                        <mml:cn>2</mml:cn>
 
4146
                        <mml:csymbol>&pi;</mml:csymbol>
 
4147
                        <mml:apply>
 
4148
                            <mml:power/>
 
4149
                            <mml:ci>&sigma;</mml:ci>
 
4150
                            <mml:cn>2</mml:cn>
 
4151
                        </mml:apply>
 
4152
                    </mml:apply>
 
4153
                </mml:apply>
 
4154
                <mml:apply>
 
4155
                    <mml:exp/>
 
4156
                    <mml:apply>
 
4157
                        <mml:minus/>
 
4158
                        <mml:apply>
 
4159
                            <mml:divide/>
 
4160
                            <mml:apply>
 
4161
                                <mml:plus/>
 
4162
                                <mml:apply>
 
4163
                                    <mml:power/>
 
4164
                                    <mml:ci>x</mml:ci>
 
4165
                                    <mml:cn>2</mml:cn>
 
4166
                                </mml:apply>
 
4167
                                <mml:apply>
 
4168
                                    <mml:power/>
 
4169
                                    <mml:ci>y</mml:ci>
 
4170
                                    <mml:cn>2</mml:cn>
 
4171
                                </mml:apply>
 
4172
                            </mml:apply>
 
4173
                            <mml:apply>
 
4174
                                <mml:times/>
 
4175
                                <mml:cn>2</mml:cn>
 
4176
                                <mml:apply>
 
4177
                                    <mml:power/>
 
4178
                                    <mml:ci>&sigma;</mml:ci>
 
4179
                                    <mml:cn>2</mml:cn>
 
4180
                                </mml:apply>
 
4181
                            </mml:apply>
 
4182
                        </mml:apply>
 
4183
                    </mml:apply>
 
4184
                </mml:apply>
 
4185
            </mml:apply>
 
4186
        </mml:reln>
 
4187
    </mml:math>
 
4188
</informalequation>
 
4189
@end docbook
 
4190
 
 
4191
@noindent
 
4192
The parameter@tie{}@inlinesigma{}, the argument of
 
4193
option@tie{}@option{--contrast-edge-scale}, is the length scale on which edges
 
4194
are detected by @math{g(x, y)}.  We apply the Laplacian operator in
 
4195
Cartesian coordinates
 
4196
@ifinfo
 
4197
@display
 
4198
@math{Delta := Nabla o Nabla = (d^2/dx^2 + d^2/dy^2)}
 
4199
@end display
 
4200
@end ifinfo
 
4201
@html
 
4202
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
4203
    <mrow>
 
4204
        <mrow>
 
4205
            <mi>&Delta;</mi>
 
4206
        </mrow>
 
4207
        <mo>&equiv;</mo>
 
4208
        <mrow>
 
4209
            <mi>&nabla;</mi>
 
4210
            <mo>&CenterDot;</mo>
 
4211
            <mi>&nabla;</mi>
 
4212
        </mrow>
 
4213
        <mo>=</mo>
 
4214
        <mrow>
 
4215
            <mfrac>
 
4216
                <msup>
 
4217
                    <mo>&PartialD;</mo>
 
4218
                    <mn>2</mn>
 
4219
                </msup>
 
4220
                <mrow>
 
4221
                    <mo>&PartialD;</mo>
 
4222
                    <msup>
 
4223
                        <mi>x</mi>
 
4224
                        <mn>2</mn>
 
4225
                    </msup>
 
4226
                </mrow>
 
4227
            </mfrac>
 
4228
            <mo>+</mo>
 
4229
            <mfrac>
 
4230
                <msup>
 
4231
                    <mo>&PartialD;</mo>
 
4232
                    <mn>2</mn>
 
4233
                </msup>
 
4234
                <mrow>
 
4235
                    <mo>&PartialD;</mo>
 
4236
                    <msup>
 
4237
                        <mi>y</mi>
 
4238
                        <mn>2</mn>
 
4239
                    </msup>
 
4240
                </mrow>
 
4241
            </mfrac>
 
4242
        </mrow>
 
4243
    </mrow>
 
4244
</math>
 
4245
@end html
 
4246
@tex
 
4247
$$
 
4248
    \bigtriangleup \equiv \nabla \cdot \nabla =
 
4249
    {\partial^2 \over \partial x^2} + {\partial^2 \over \partial y^2}
 
4250
$$
 
4251
@end tex
 
4252
@docbook
 
4253
<informalequation>
 
4254
    <mml:math>
 
4255
        <mml:reln>
 
4256
            <mml:eq/>
 
4257
            <mml:apply>
 
4258
                <mml:laplacian/>
 
4259
            </mml:apply>
 
4260
            <mml:apply>
 
4261
                <mml:scalarproduct/>
 
4262
                <mml:apply>
 
4263
                    <mml:grad/>
 
4264
                </mml:apply>
 
4265
                <mml:apply>
 
4266
                    <mml:grad/>
 
4267
                </mml:apply>
 
4268
            </mml:apply>
 
4269
            <mml:apply>
 
4270
                <mml:plus/>
 
4271
                <mml:apply>
 
4272
                    <mml:partialdiff/>
 
4273
                    <mml:bvar>
 
4274
                        <mml:ci>x</mml:ci>
 
4275
                        <mml:degree>
 
4276
                            <mml:cn>2</mml:cn>
 
4277
                        </mml:degree>
 
4278
                    </mml:bvar>
 
4279
                </mml:apply>
 
4280
                <mml:apply>
 
4281
                    <mml:partialdiff/>
 
4282
                    <mml:bvar>
 
4283
                        <mml:ci>y</mml:ci>
 
4284
                        <mml:degree>
 
4285
                            <mml:cn>2</mml:cn>
 
4286
                        </mml:degree>
 
4287
                    </mml:bvar>
 
4288
                </mml:apply>
 
4289
            </mml:apply>
 
4290
        </mml:reln>
 
4291
    </mml:math>
 
4292
</informalequation>
 
4293
@end docbook
 
4294
 
 
4295
to @math{g(x, y)}, to arrive at a continuous representation of the
 
4296
two-dimensional filter kernel
 
4297
@ifinfo
 
4298
@display
 
4299
@math{k(x, y) = (xi^2 - 1) * exp(-xi^2) / (pi * sigma^4),}
 
4300
@end display
 
4301
@end ifinfo
 
4302
@html
 
4303
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
4304
    <mrow>
 
4305
        <mrow>
 
4306
            <mi>k</mi>
 
4307
            <mfenced>
 
4308
                <mi>x</mi>
 
4309
                <mi>y</mi>
 
4310
            </mfenced>
 
4311
        </mrow>
 
4312
        <mo>=</mo>
 
4313
        <mrow>
 
4314
            <mfrac>
 
4315
                <mrow>
 
4316
                    <msup>
 
4317
                        <mi>&xi;</mi>
 
4318
                        <mn>2</mn>
 
4319
                    </msup>
 
4320
                    <mo>-</mo>
 
4321
                    <mn>1</mn>
 
4322
                </mrow>
 
4323
                <mrow>
 
4324
                    <mi>&pi;</mi>
 
4325
                    <mo>&InvisibleTimes;</mo>
 
4326
                    <msup>
 
4327
                        <mi>&sigma;</mi>
 
4328
                        <mn>4</mn>
 
4329
                    </msup>
 
4330
                </mrow>
 
4331
            </mfrac>
 
4332
            <mo>&InvisibleTimes;</mo>
 
4333
            <mo>exp</mo>
 
4334
            <mo>&ApplyFunction;</mo>
 
4335
            <mrow>
 
4336
                <mo>(</mo>
 
4337
                <mo>-</mo>
 
4338
                <msup>
 
4339
                    <mi>&xi;</mi>
 
4340
                    <mn>2</mn>
 
4341
                </msup>
 
4342
                <mo>)</mo>
 
4343
            </mrow>
 
4344
        </mrow>
 
4345
        <mtext>,</mtext>
 
4346
    </mrow>
 
4347
</math>
 
4348
@end html
 
4349
@tex
 
4350
$$
 
4351
    k(x, y) = {{\xi^2 - 1} \over {\pi \sigma^4}} \exp(-\xi^2),
 
4352
$$
 
4353
@end tex
 
4354
@docbook
 
4355
<informalequation>
 
4356
    <mml:math>
 
4357
        <mml:reln>
 
4358
            <mml:eq/>
 
4359
            <mml:apply>
 
4360
                <mml:ci>k</mml:ci>
 
4361
                <mml:ci>x</mml:ci>
 
4362
                <mml:ci>y</mml:ci>
 
4363
            </mml:apply>
 
4364
            <mml:apply>
 
4365
                <mml:times/>
 
4366
                <mml:apply>
 
4367
                    <mml:divide/>
 
4368
                    <mml:apply>
 
4369
                        <mml:minus/>
 
4370
                        <mml:apply>
 
4371
                            <mml:power/>
 
4372
                            <mml:ci>&xi;</mml:ci>
 
4373
                            <mml:cn>2</mml:cn>
 
4374
                        </mml:apply>
 
4375
                        <mml:cn>1</mml:cn>
 
4376
                    </mml:apply>
 
4377
                    <mml:apply>
 
4378
                        <mml:times/>
 
4379
                        <mml:csymbol>&pi;</mml:csymbol>
 
4380
                        <mml:apply>
 
4381
                            <mml:power/>
 
4382
                            <mml:ci>&sigma;</mml:ci>
 
4383
                            <mml:cn>4</mml:cn>
 
4384
                        </mml:apply>
 
4385
                    </mml:apply>
 
4386
                </mml:apply>
 
4387
                <mml:apply>
 
4388
                    <mml:exp/>
 
4389
                    <mml:apply>
 
4390
                        <mml:minus/>
 
4391
                        <mml:apply>
 
4392
                            <mml:power/>
 
4393
                            <mml:ci>&xi;</mml:ci>
 
4394
                            <mml:cn>2</mml:cn>
 
4395
                        </mml:apply>
 
4396
                    </mml:apply>
 
4397
                </mml:apply>
 
4398
            </mml:apply>
 
4399
        </mml:reln>
 
4400
    </mml:math>
 
4401
</informalequation>
 
4402
@end docbook
 
4403
 
 
4404
where we have used the dimensionless distance@tie{}@inlinexi{} from
 
4405
the origin
 
4406
@ifinfo
 
4407
@display
 
4408
@math{xi^2 = (x^2 + y^2) / (2 * sigma^2).}
 
4409
@end display
 
4410
@end ifinfo
 
4411
@html
 
4412
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
4413
    <mrow>
 
4414
        <mrow>
 
4415
            <msup>
 
4416
                <mi>&xi;</mi>
 
4417
                <mn>2</mn>
 
4418
            </msup>
 
4419
        </mrow>
 
4420
        <mo>=</mo>
 
4421
        <mrow>
 
4422
            <mfrac>
 
4423
                <mrow>
 
4424
                    <msup>
 
4425
                        <mi>x</mi>
 
4426
                        <mn>2</mn>
 
4427
                    </msup>
 
4428
                    <mo>+</mo>
 
4429
                    <msup>
 
4430
                        <mi>y</mi>
 
4431
                        <mn>2</mn>
 
4432
                    </msup>
 
4433
                </mrow>
 
4434
                <mrow>
 
4435
                    <mn>2</mn>
 
4436
                    <mo>&InvisibleTimes;</mo>
 
4437
                    <msup>
 
4438
                        <mi>&sigma;</mi>
 
4439
                        <mn>2</mn>
 
4440
                    </msup>
 
4441
                </mrow>
 
4442
            </mfrac>
 
4443
        </mrow>
 
4444
        <mtext>.</mtext>
 
4445
    </mrow>
 
4446
</math>
 
4447
@end html
 
4448
@tex
 
4449
$$
 
4450
    \xi^2 = {{x^2 + y^2} \over {2 \sigma^2}}.
 
4451
$$
 
4452
@end tex
 
4453
@docbook
 
4454
<informalequation>
 
4455
    <mml:math>
 
4456
        <mml:reln>
 
4457
            <mml:eq/>
 
4458
            <mml:apply>
 
4459
                <mml:power/>
 
4460
                <mml:ci>&xi;</mml:ci>
 
4461
                <mml:cn>2</mml:cn>
 
4462
            </mml:apply>
 
4463
            <mml:apply>
 
4464
                <mml:divide/>
 
4465
                <mml:apply>
 
4466
                    <mml:plus/>
 
4467
                    <mml:apply>
 
4468
                        <mml:power/>
 
4469
                        <mml:ci>x</mml:ci>
 
4470
                        <mml:cn>2</mml:cn>
 
4471
                    </mml:apply>
 
4472
                    <mml:apply>
 
4473
                        <mml:power/>
 
4474
                        <mml:ci>y</mml:ci>
 
4475
                        <mml:cn>2</mml:cn>
 
4476
                    </mml:apply>
 
4477
                </mml:apply>
 
4478
                <mml:apply>
 
4479
                    <mml:times/>
 
4480
                    <mml:cn>2</mml:cn>
 
4481
                    <mml:apply>
 
4482
                        <mml:power/>
 
4483
                        <mml:ci>&sigma;</mml:ci>
 
4484
                        <mml:cn>2</mml:cn>
 
4485
                    </mml:apply>
 
4486
                </mml:apply>
 
4487
            </mml:apply>
 
4488
        </mml:reln>
 
4489
    </mml:math>
 
4490
</informalequation>
 
4491
@end docbook
 
4492
 
 
4493
@noindent
 
4494
Enfuse uses a discrete approximation of @math{k} in the convolution
 
4495
with the image.  The operator is radially symmetric with respect to
 
4496
the origin, which is why we can easily plot it in
 
4497
@ref{Figure:laplacian-of-gaussian}, setting
 
4498
@ifinfo
 
4499
@math{R = sqrt(x^2 + y^2)}.
 
4500
@end ifinfo
 
4501
@html
 
4502
<mathinline xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
 
4503
    <mrowinline>
 
4504
        <mi>R</mi>
 
4505
        <mo>=</mo>
 
4506
        <mrowinline>
 
4507
            <msqrtinline>
 
4508
                <msupinline>
 
4509
                    <mi>x</mi>
 
4510
                    <mn>2</mn>
 
4511
                </msupinline>
 
4512
                <mo>+</mo>
 
4513
                <msupinline>
 
4514
                    <mi>y</mi>
 
4515
                    <mn>2</mn>
 
4516
                </msupinline>
 
4517
            </msqrtinline>
 
4518
        </mrowinline>
 
4519
        <mtext>.</mtext>
 
4520
    </mrowinline>
 
4521
</mathinline>
 
4522
@end html
 
4523
@tex
 
4524
$R = \sqrt{x^2 + y^2}$.
 
4525
@end tex
 
4526
@docbook
 
4527
<inlineequation>
 
4528
    <mml:math>
 
4529
        <mml:reln>
 
4530
            <mml:eq/>
 
4531
            <mml:ci>R</mml:ci>
 
4532
            <mml:apply>
 
4533
                <mml:root/>
 
4534
                <mml:degree>
 
4535
                    <mml:cn>2</mml:cn>
 
4536
                </mml:degree>
 
4537
                <mml:apply>
 
4538
                    <mml:plus/>
 
4539
                    <mml:apply>
 
4540
                        <mml:power/>
 
4541
                        <mml:ci>x</mml:ci>
 
4542
                        <mml:cn>2</mml:cn>
 
4543
                    </mml:apply>
 
4544
                    <mml:apply>
 
4545
                        <mml:power/>
 
4546
                        <mml:ci>y</mml:ci>
 
4547
                        <mml:cn>2</mml:cn>
 
4548
                    </mml:apply>
 
4549
                </mml:apply>
 
4550
            </mml:apply>
 
4551
        </mml:reln>
 
4552
    </mml:math>
 
4553
</inlineequation>
 
4554
@end docbook
 
4555
 
 
4556
@float Figure,Figure:laplacian-of-gaussian
 
4557
@vimage{laplacian-of-gaussian}
 
4558
 
 
4559
@caption{Laplacian-of-Gaussian function for @inlinesigma{} = 0.5.}
 
4560
 
 
4561
@shortcaption{Laplacian-of-Gaussian}
 
4562
@end float
 
4563
 
 
4564
@noindent
 
4565
See also
 
4566
@uref{http://@/homepages.inf.ed.ac.uk/@/rbf/@/HIPR2/@/log.htm,
 
4567
@acronym{HIPR2}: Laplacian of Gaussian}.
 
4568
 
 
4569
Sometimes the @acronym{LoG} is plagued by noise in the input images.
 
4570
After all, it is a numerical approximation of the second derivative
 
4571
and deriving always ``roughens'' a function.  The (normalized) mask
 
4572
files relentlessly disclose such problems.  Use
 
4573
option@tie{}@option{--contrast-min-curvature} with a @emph{negative}
 
4574
argument@tie{}@var{CURVATURE} to suppress all edges with a curvature
 
4575
below @minus{}@var{CURVATURE} (which is a positive value).  Check the
 
4576
effects with the mask files and particularly the hard-mask files
 
4577
(@file{@value{src::default-hard-mask-template}}) if using
 
4578
option@tie{}@option{--hard-mask}.
 
4579
 
 
4580
To indicate the @var{CURVATURE} in relative terms, which is
 
4581
particularly comprehensible for humans, append a percent sign
 
4582
(@samp{%}).  Try minimum curvatures starting from @minus{}0.5% to
 
4583
@minus{}3%.
 
4584
 
 
4585
@optionsummaryheading{}
 
4586
 
 
4587
@table @option
 
4588
@item --contrast-weight
 
4589
@ref{Fusion Options}
 
4590
 
 
4591
@item --hard-mask
 
4592
@ref{Fusion Options}
 
4593
 
 
4594
@item --contrast-edge-scale
 
4595
@ref{Expert Options}
 
4596
 
 
4597
@item --contrast-min-curvature
 
4598
@ref{Expert Options}
 
4599
@end table
 
4600
 
 
4601
@node Blend SDev and LoG
 
4602
@subsection Blend Standard Deviation and Laplacian of Gaussian
 
4603
@cindex weighting, contrast using a blend of methods
 
4604
@cindex contrast weighting using a blend of methods
 
4605
 
 
4606
Enfuse can team the standard deviation computation and Laplacian of
 
4607
Gaussian to deliver the best of both methods.  Use a @emph{positive}
 
4608
argument@tie{}@var{CURVATURE} with option@tie{}@option{--contrast-min-curvature}
 
4609
to combine both algorithms.  In this mode of operation Enfuse computes
 
4610
the @acronym{SDev}-weight and the @acronym{LoG}-weight, then uses the
 
4611
@acronym{LoG} to decide whether to go with that value or prefer the
 
4612
@acronym{SDev} data.  If the @acronym{LoG} is greater than
 
4613
@var{CURVATURE} Enfuse uses the weight delivered by the @acronym{LoG},
 
4614
otherwise the @acronym{SDev}-weight is rescaled such that its maximum
 
4615
is equal to @var{CURVATURE}, and the scaled @acronym{SDev} is used as
 
4616
weight.
 
4617
 
 
4618
This technique merges the two edge detection methods where they are
 
4619
best.  The @acronym{LoG} excels with clear edges and cannot be fooled
 
4620
by strong but smooth gradients.  However, it is bad at detecting faint
 
4621
edges and it is susceptible to noise.  The @acronym{SDev} on the other
 
4622
hand shines with even the most marginal edges, and resists noise quite
 
4623
well.  Its weakness is that is is easily deceived by strong and smooth
 
4624
gradients.  Tuning @var{CURVATURE} the user can pick the best
 
4625
threshold for a given set of images.
 
4626
 
 
4627
@optionsummaryheading{}
 
4628
 
 
4629
@table @option
 
4630
@item --contrast-weight
 
4631
@ref{Fusion Options}
 
4632
 
 
4633
@item --hard-mask
 
4634
@ref{Fusion Options}
 
4635
 
 
4636
@item --contrast-window-size
 
4637
@ref{Expert Options}
 
4638
 
 
4639
@item --gray-projector
 
4640
@ref{Expert Options}
 
4641
 
 
4642
@item --contrast-edge-scale
 
4643
@ref{Expert Options}
 
4644
 
 
4645
@item --contrast-min-curvature
 
4646
@ref{Expert Options}
 
4647
@end table
 
4648
 
 
4649
 
 
4650
@node Scaling and Choice of Mode
 
4651
@subsection Scaling and Choice of Mode
 
4652
@cindex scaling of parameters
 
4653
@cindex mode of operation (@acronym{SDev}, @acronym{LoG}, @dots{})
 
4654
 
 
4655
Experience has shown that neither the parameters @var{EDGESCALE} and
 
4656
@var{CURVATURE} nor the mode of operation (@acronym{SDev}-only,
 
4657
@acronym{LoG}-only, or a blend of both) scales to different image
 
4658
sizes.  In practice, this means that if you start with a set of
 
4659
reduced size images, say 2808@classictimes{}1872 pixels, carefully
 
4660
optimize @var{EDGESCALE}, @var{CURVATURE} and so on, and find
 
4661
@acronym{LoG}-only the best mode, and then switch to the original
 
4662
resolution of 5616@classictimes{}3744 pixels, multiplying (or
 
4663
dividing) the parameters by four and sticking to @acronym{LoG}-only
 
4664
might @emph{not} result in the best fused image.  For best quality,
 
4665
perform the parameter optimization and the search for the most
 
4666
appropriate mode at the final resolution.
 
4667
 
 
4668
 
 
4669
@node Local Entropy Weighting
 
4670
@section Local Entropy Weighting
 
4671
@cindex weighting, local entropy
 
4672
 
 
4673
Entropy weighting prefers pixels inside a high entropy neighborhood.
 
4674
 
 
4675
@cindex entropy, definition
 
4676
Let @math{S} be an @math{n}-ary source.  Watching the output of
 
4677
@math{S} an observer on average gains the information
 
4678
@ifinfo
 
4679
@display
 
4680
@math{H_a(n) := sum(p(x) * log_a(1 / p(x)), x in S)}
 
4681
@end display
 
4682
@end ifinfo
 
4683
@html
 
4684
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
4685
    <mrow>
 
4686
        <mrow>
 
4687
            <msub>
 
4688
                <mi>H</mi>
 
4689
                <mi>a</mi>
 
4690
            </msub>
 
4691
            <mo>&ApplyFunction;</mo>
 
4692
            <mrow>
 
4693
                <mo>(</mo>
 
4694
                <mi>n</mi>
 
4695
                <mo>)</mo>
 
4696
            </mrow>
 
4697
        </mrow>
 
4698
        <mo>:=</mo>
 
4699
        <mrow>
 
4700
            <munder>
 
4701
                <mo>&Sum;</mo>
 
4702
                <mrow>
 
4703
                    <mi>x</mi>
 
4704
                    <mo>&Element;</mo>
 
4705
                    <mi>S</mi>
 
4706
                </mrow>
 
4707
            </munder>
 
4708
            <mrow>
 
4709
                <mi>p</mi>
 
4710
                <mo>&ApplyFunction;</mo>
 
4711
                <mrow>
 
4712
                    <mo>(</mo>
 
4713
                    <mi>x</mi>
 
4714
                    <mo>)</mo>
 
4715
                </mrow>
 
4716
                <mo>&times;</mo>
 
4717
                <mrow>
 
4718
                    <msub>
 
4719
                        <mtext>log</mtext>
 
4720
                        <mi>a</mi>
 
4721
                    </msub>
 
4722
                    <mo>&ApplyFunction;</mo>
 
4723
                    <mrow>
 
4724
                        <mo>(</mo>
 
4725
                        <mn>1</mn>
 
4726
                        <mo>/</mo>
 
4727
                        <mrow>
 
4728
                            <mi>p</mi>
 
4729
                            <mo>&ApplyFunction;</mo>
 
4730
                            <mrow>
 
4731
                                <mo>(</mo>
 
4732
                                <mi>x</mi>
 
4733
                                <mo>)</mo>
 
4734
                            </mrow>
 
4735
                        </mrow>
 
4736
                        <mo>)</mo>
 
4737
                    </mrow>
 
4738
                </mrow>
 
4739
            </mrow>
 
4740
        </mrow>
 
4741
    </mrow>
 
4742
</math>
 
4743
@end html
 
4744
@tex
 
4745
$$
 
4746
    H_a(n) := \sum_{x \in S} p(x) \log_a(1 / p(x))
 
4747
$$
 
4748
@end tex
 
4749
@docbook
 
4750
<informalequation>
 
4751
    <mml:math>
 
4752
        <mml:reln>
 
4753
            <mml:eq/>
 
4754
            <mml:apply>
 
4755
                <mml:apply>
 
4756
                    <mml:selector/>
 
4757
                    <mml:ci>H</mml:ci>
 
4758
                    <mml:ci>a</mml:ci>
 
4759
                </mml:apply>
 
4760
                <mml:ci>n</mml:ci>
 
4761
            </mml:apply>
 
4762
            <mml:apply>
 
4763
                <mml:sum/>
 
4764
                <mml:bvar>
 
4765
                    <mml:ci>x</mml:ci>
 
4766
                </mml:bvar>
 
4767
                <mml:condition>
 
4768
                    <mml:apply>
 
4769
                        <mml:in/>
 
4770
                        <mml:ci>x</mml:ci>
 
4771
                        <mml:ci>S</mml:ci>
 
4772
                    </mml:apply>
 
4773
                </mml:condition>
 
4774
                <mml:apply>
 
4775
                    <mml:times/>
 
4776
                    <mml:apply>
 
4777
                        <mml:ci>p</mml:ci>
 
4778
                        <mml:ci>x</mml:ci>
 
4779
                    </mml:apply>
 
4780
                    <mml:apply>
 
4781
                        <mml:log/>
 
4782
                        <mml:logbase>
 
4783
                            <mml:ci>a</mml:ci>
 
4784
                        </mml:logbase>
 
4785
                        <mml:apply other='display="scriptstyle"'>
 
4786
                            <mml:divide/>
 
4787
                            <mml:cn>1</mml:cn>
 
4788
                            <mml:apply>
 
4789
                                <mml:ci>p</mml:ci>
 
4790
                                <mml:ci>x</mml:ci>
 
4791
                            </mml:apply>
 
4792
                        </mml:apply>
 
4793
                    </mml:apply>
 
4794
                </mml:apply>
 
4795
            </mml:apply>
 
4796
        </mml:reln>
 
4797
    </mml:math>
 
4798
</informalequation>
 
4799
@end docbook
 
4800
 
 
4801
@cindex entropy
 
4802
@noindent
 
4803
per emitted message, where we assume the knowledge of the probability
 
4804
function@tie{}@math{p(S)}.  The expectation value@tie{}@math{H_a(n)}
 
4805
is called @dfn{entropy} of the source@tie{}@math{S}.  Entropy measures
 
4806
our uncertainty if we are to guess which message gets chosen by the
 
4807
source in the future.  The unit of the entropy depends on the choice
 
4808
of the constant@tie{}@math{a > 1}.  Obviously
 
4809
@ifinfo
 
4810
@display
 
4811
@math{H_b(n) = H_a(n) / log_a(b)}
 
4812
@end display
 
4813
@end ifinfo
 
4814
@html
 
4815
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
4816
    <mrow>
 
4817
        <mrow>
 
4818
            <msub>
 
4819
                <mi>H</mi>
 
4820
                <mi>b</mi>
 
4821
            </msub>
 
4822
            <mo>&ApplyFunction;</mo>
 
4823
            <mrow>
 
4824
                <mo>(</mo>
 
4825
                <mi>n</mi>
 
4826
                <mo>)</mo>
 
4827
            </mrow>
 
4828
        </mrow>
 
4829
        <mo>=</mo>
 
4830
        <mrow>
 
4831
            <mrow>
 
4832
                <msub>
 
4833
                    <mi>H</mi>
 
4834
                    <mi>a</mi>
 
4835
                </msub>
 
4836
                <mo>&ApplyFunction;</mo>
 
4837
                <mrow>
 
4838
                    <mo>(</mo>
 
4839
                    <mi>n</mi>
 
4840
                    <mo>)</mo>
 
4841
                </mrow>
 
4842
            </mrow>
 
4843
            <mo>/</mo>
 
4844
            <mrow>
 
4845
                <msub>
 
4846
                    <mtext>log</mtext>
 
4847
                    <mi>a</mi>
 
4848
                </msub>
 
4849
                <mo>&ApplyFunction;</mo>
 
4850
                <mrow>
 
4851
                    <mo>(</mo>
 
4852
                    <mi>b</mi>
 
4853
                    <mo>)</mo>
 
4854
                </mrow>
 
4855
            </mrow>
 
4856
        </mrow>
 
4857
    </mrow>
 
4858
</math>
 
4859
@end html
 
4860
@tex
 
4861
$$
 
4862
    H_b(n) = H_a(n) / \log_a(b)
 
4863
$$
 
4864
@end tex
 
4865
@docbook
 
4866
<informalequation>
 
4867
    <mml:math>
 
4868
        <mml:reln>
 
4869
            <mml:eq/>
 
4870
            <mml:apply>
 
4871
                <mml:apply>
 
4872
                    <mml:selector/>
 
4873
                    <mml:ci>H</mml:ci>
 
4874
                    <mml:ci>b</mml:ci>
 
4875
                </mml:apply>
 
4876
                <mml:ci>n</mml:ci>
 
4877
            </mml:apply>
 
4878
             <mml:apply>
 
4879
                <mml:divide/>
 
4880
                <mml:apply>
 
4881
                    <mml:apply>
 
4882
                        <mml:selector/>
 
4883
                        <mml:ci>H</mml:ci>
 
4884
                        <mml:ci>a</mml:ci>
 
4885
                    </mml:apply>
 
4886
                    <mml:ci>n</mml:ci>
 
4887
                </mml:apply>
 
4888
                <mml:apply>
 
4889
                    <mml:log/>
 
4890
                    <mml:logbase>
 
4891
                        <mml:ci>a</mml:ci>
 
4892
                    </mml:logbase>
 
4893
                    <mml:ci>b</mml:ci>
 
4894
                </mml:apply>
 
4895
            </mml:apply>
 
4896
        </mml:reln>
 
4897
    </mml:math>
 
4898
</informalequation>
 
4899
@end docbook
 
4900
 
 
4901
@noindent
 
4902
holds for all @math{b > 1}.  We use @math{a = 2} for entropy weighting
 
4903
and set the entropy of the ``impossible message'' to zero according to
 
4904
@ifinfo
 
4905
@display
 
4906
@math{lim(p * log_a(1 / p), p -> 0) = 0.}
 
4907
@end display
 
4908
@end ifinfo
 
4909
@html
 
4910
<math xmlns="http://www.w3.org/1998/Math/MathML" display="separate">
 
4911
    <mrow>
 
4912
        <mrow>
 
4913
            <munder>
 
4914
                <mtext>lim</mtext>
 
4915
                <mrow>
 
4916
                    <mi>p</mi>
 
4917
                    <mo>&rightarrow;</mo>
 
4918
                    <mn>0</mn>
 
4919
                </mrow>
 
4920
            </munder>
 
4921
            <mrow>
 
4922
                <mi>p</mi>
 
4923
                <mo>&times;</mo>
 
4924
                <mrow>
 
4925
                    <msub>
 
4926
                        <mtext>log</mtext>
 
4927
                        <mi>a</mi>
 
4928
                    </msub>
 
4929
                    <mo>&ApplyFunction;</mo>
 
4930
                    <mrow>
 
4931
                        <mo>(</mo>
 
4932
                        <mn>1</mn>
 
4933
                        <mo>/</mo>
 
4934
                        <mi>p</mi>
 
4935
                        <mo>)</mo>
 
4936
                    </mrow>
 
4937
                </mrow>
 
4938
            </mrow>
 
4939
        </mrow>
 
4940
        <mo>=</mo>
 
4941
        <mn>0</mn>
 
4942
        <mtext>.</mtext>
 
4943
    </mrow>
 
4944
</math>
 
4945
@end html
 
4946
@tex
 
4947
$$
 
4948
    \lim_{p \rightarrow 0} \, p \, \log_a(1 / p) = 0.
 
4949
$$
 
4950
@end tex
 
4951
@docbook
 
4952
<informalequation>
 
4953
    <mml:math>
 
4954
        <mml:reln>
 
4955
            <mml:eq/>
 
4956
            <mml:apply>
 
4957
                <mml:limit/>
 
4958
                <mml:bvar>
 
4959
                    <mml:ci>p</mml:ci>
 
4960
                </mml:bvar>
 
4961
                <mml:condition>
 
4962
                    <mml:apply>
 
4963
                        <mml:tendsto/>
 
4964
                        <mml:ci>p</mml:ci>
 
4965
                        <mml:ci>0</mml:ci>
 
4966
                    </mml:apply>
 
4967
                </mml:condition>
 
4968
                <mml:apply>
 
4969
                    <mml:times/>
 
4970
                    <mml:ci>p</mml:ci>
 
4971
                    <mml:apply>
 
4972
                        <mml:log/>
 
4973
                        <mml:logbase>
 
4974
                            <mml:ci>a</mml:ci>
 
4975
                        </mml:logbase>
 
4976
                        <mml:apply>
 
4977
                            <mml:divide/>
 
4978
                            <mml:cn>1</mml:cn>
 
4979
                            <mml:ci>p</mml:ci>
 
4980
                        </mml:apply>
 
4981
                    </mml:apply>
 
4982
                </mml:apply>
 
4983
            </mml:apply>
 
4984
            <mml:cn>0</mml:cn>
 
4985
        </mml:reln>
 
4986
    </mml:math>
 
4987
</informalequation>
 
4988
@end docbook
 
4989
 
 
4990
@noindent
 
4991
@ref{Figure:entropy} shows an entropy function.
 
4992
 
 
4993
@float Figure,Figure:entropy
 
4994
@vimage{entropy}
 
4995
 
 
4996
@caption{Entropy function@tie{}H for an experiment with exactly two outcomes.}
 
4997
 
 
4998
@shortcaption{Entropy function}
 
4999
@end float
 
5000
 
 
5001
For more on (information) entropy visit
 
5002
@uref{http://@/en.wikipedia.org/@/wiki/@/Information_@/entropy,
 
5003
Wikipedia}.
 
5004
 
 
5005
Enfuse computes a pixel's entropy by considering the pixel itself and
 
5006
its surrounding pixels quite similar to @ref{Local Contrast
 
5007
Weighting}.  The size of the window is set by
 
5008
@option{--entropy-window-size}.  Choosing the right size is difficult,
 
5009
because there is a serious tradeoff between the locality of the data
 
5010
and the size of the sample used to compute @math{H}.  A large window
 
5011
results in a large sample size and therefore in a reliable entropy,
 
5012
but considering pixels far away from the center degrades @math{H} into
 
5013
a non-local measure.  For small windows the opposite holds true.
 
5014
 
 
5015
Another difficulty arises from the use of entropy as a weighting
 
5016
function in dark parts of an image, that is, in areas where the
 
5017
signal-to-noise ratio is low.  Without any precautions, high noise is
 
5018
taken to be high entropy, which might not be desired.  Use
 
5019
option@tie{}@option{--entropy-cutoff} to control the black level when
 
5020
computing the entropy.
 
5021
 
 
5022
On the other extreme side of lightness, very light parts of an image,
 
5023
the sensor might already have overflown without the signal reaching
 
5024
1.0 in the normalized luminance interval.  For these pixels the
 
5025
entropy is zero and Enfuse can be told of the threshold by properly
 
5026
setting the second argument of @option{--entropy-cutoff}.
 
5027
 
 
5028
@optionsummaryheading{}
 
5029
 
 
5030
@table @option
 
5031
@item --entropy-weight
 
5032
@ref{Fusion Options}
 
5033
 
 
5034
@item --entropy-window-size
 
5035
@ref{Expert Options}
 
5036
 
 
5037
@item --entropy-cutoff
 
5038
@ref{Expert Options}
 
5039
@end table
 
5040
 
 
5041
 
 
5042
@node Understanding Masks
 
5043
@chapter Understanding Masks
 
5044
@cindex understanding masks
 
5045
@cindex masks, understanding
 
5046
 
 
5047
@include understanding-masks.texi
 
5048
 
 
5049
 
 
5050
@node Tuning Memory Usage
 
5051
@chapter Tuning Memory Usage
 
5052
@cindex memory, tuning usage of
 
5053
@opindex -b
 
5054
@opindex -m
 
5055
 
 
5056
@include tuning-memory-usage.texi
 
5057
 
 
5058
 
 
5059
@node Applications
 
5060
@chapter Applications of Enfuse
 
5061
@cindex applications of enfuse
 
5062
 
 
5063
This section describes some of the novel possibilities that Enfuse
 
5064
offers the photographer.  In contrast to the previous chapters, it
 
5065
centers around the image effects.
 
5066
 
 
5067
@menu
 
5068
* What Images::                 What makes images fusable?
 
5069
* Repetition::                  Just taking the same shot multiple times
 
5070
* Exposure Series::             Varying the exposure time
 
5071
* Flash Exposure Series::       Varying the flash output
 
5072
* Polarization Series::         Changing the polarizer angle
 
5073
* Focus Stacks::                Stacking images with different in-focus distance
 
5074
@end menu
 
5075
 
 
5076
@node What Images
 
5077
@section What Makes Images Fusable?
 
5078
@cindex images, fusable
 
5079
 
 
5080
Images should align well to be suitable for fusion.  However, there is
 
5081
no hard mathematical rule what ``well'' means.  The alignment
 
5082
requirements for 16@dmn{MPixel} images to yield a sharp
 
5083
4"@classictimes{}6" print at 300@dmn{dpi} (``dpi'' means dots per
 
5084
inch) or even for web presentation are relatively low, whereas the
 
5085
alignment of 8@dmn{MPixel} images for a 12"@classictimes{}18" print
 
5086
ought to be tight.
 
5087
 
 
5088
@pindex hugin
 
5089
If the input images need to be aligned, Hugin (@pxref{Helpful
 
5090
Programs}) is the tool of choice.  It produces images exactly in the
 
5091
format that Enfuse expects.
 
5092
 
 
5093
Sometimes images naturally align extremely well so that no
 
5094
re-alignment is required.  An image series with preprogrammed exposure
 
5095
steps taken in rapid succession where the camera is mounted on a heavy
 
5096
tripod and a humongous ball head, mirror lockup, and a cable release
 
5097
are used, comes to mind.
 
5098
 
 
5099
When in doubt about what will work, try it, and judge for yourself.
 
5100
 
 
5101
@noindent
 
5102
Useful ideas for a good alignment:
 
5103
 
 
5104
@itemize
 
5105
@item
 
5106
Fix all camera parameters that are not explicitly varied.
 
5107
 
 
5108
@table @emph
 
5109
@item Aperture
 
5110
Engage full manual (@key{M}) or aperture-priority (@key{A}) mode.
 
5111
 
 
5112
@item Auto-focus
 
5113
Disable ``Auto Focus''.  Be aware that the auto-focus function could
 
5114
be linked to shutter-release button position ``half pressed'' or to
 
5115
the shutter release in insidious ways.
 
5116
 
 
5117
@item Closed eyepiece
 
5118
(This applies only to single lens reflex cameras.) Close the eyepiece
 
5119
when using a cable release to suppress variations in stray light.
 
5120
 
 
5121
@item Exposure time/Shutter speed
 
5122
Use the shortest possible exposure time or, in other words, use the
 
5123
fastest shutter speed to avoid blur caused by camera shake or motion
 
5124
blur.
 
5125
 
 
5126
@item Flash power
 
5127
Explicitly control the flash power of @emph{all} flashes.  This is
 
5128
sometimes called ``flash exposure lock''.
 
5129
 
 
5130
@item Sensitivity
 
5131
Disable ``Auto @acronym{ISO}''.
 
5132
 
 
5133
@item White balance
 
5134
Disable ``Auto White Balance''.  Instead, use the most suitable fixed
 
5135
white balance or take the white balance off a white card.  When in
 
5136
doubt, use the setting ``Daylight'' or equivalent.
 
5137
@end table
 
5138
 
 
5139
@item
 
5140
Steady the camera by any means.
 
5141
 
 
5142
@itemize
 
5143
@item
 
5144
Apply your best camera bracing technique combined with controlled
 
5145
breathing.
 
5146
 
 
5147
@item
 
5148
Prefer a monopod, or better, a rigid tripod with a heavy head.
 
5149
 
 
5150
@item
 
5151
Use a cable release if possible.
 
5152
 
 
5153
@item
 
5154
(This applies to cameras with a moving mirror only.)  Engage ``mirror
 
5155
lockup''.
 
5156
 
 
5157
@item
 
5158
Consider automatic bracketing when applicable.
 
5159
 
 
5160
@item
 
5161
Activate camera- or lens-based image stabilization if you are sure
 
5162
that it improves the image quality in your particular case; otherwise
 
5163
disengage the feature.
 
5164
 
 
5165
For some lens-based image stabilization systems, it is known that they
 
5166
``lock'' into different positions every time they are activated.
 
5167
Moreover, some stabilization systems decrease the image quality when
 
5168
the lens is mounted on a tripod.
 
5169
@end itemize
 
5170
 
 
5171
@item
 
5172
Fire in rapid succession.
 
5173
@end itemize
 
5174
 
 
5175
@c http://www.usa.canon.com/dlc/controller?act=GetArticleAct&articleID=1786
 
5176
 
 
5177
 
 
5178
@node Repetition
 
5179
@section Repetition -- Noise Reduction
 
5180
@cindex simple series
 
5181
@cindex series, simple
 
5182
@cindex noise reduction
 
5183
 
 
5184
@mainpurpose Reduce noise
 
5185
 
 
5186
@noindent
 
5187
With the default settings, Enfuse computes a weighted average of the
 
5188
input pixels.  For a series of images, repeated with identical
 
5189
settings, this results in a reduction of (photon shot) noise.  In
 
5190
other words, the dynamic range increases slightly, because the higher
 
5191
signal-to-noise ratio makes darker shades usable.  Furthermore, smooth
 
5192
or glossy surfaces get a ``cleaner'' look, and edges become visually
 
5193
sharper.  The nitty-gritty reportage look that sometimes stems from a
 
5194
high sensitivity setting disappears.
 
5195
 
 
5196
Averaged images, and therefore low-noise images, are the base for a
 
5197
multitude of techniques like, for example, differences.  The most
 
5198
prominent method in this class is dark-frame subtraction.
 
5199
 
 
5200
The defaults set
 
5201
@samp{--exposure-weight=@value{src::default-weight-exposure}} and
 
5202
@samp{--saturation-weight=@value{src::default-weight-saturation}}.
 
5203
Eliminating the saturation component with @samp{--saturation-weight=0.0} can
 
5204
be worth an extra run.
 
5205
 
 
5206
 
 
5207
@node Exposure Series
 
5208
@section Exposure Series -- Dynamic Range Increase
 
5209
@cindex exposure series
 
5210
@cindex series, exposure
 
5211
@cindex dynamic range increase
 
5212
 
 
5213
@mainpurpose Increase manageable dynamic range
 
5214
 
 
5215
@noindent
 
5216
An exposure series is a set of images taken with identical parameters
 
5217
except for the exposure time.  Some cameras even provide special
 
5218
functions to automate recording exposure series.  See the instruction
 
5219
manual of your model for details.
 
5220
 
 
5221
Enfuse's defaults,
 
5222
@samp{--exposure-weight=@value{src::default-weight-exposure}} and
 
5223
@samp{--saturation-weight=@value{src::default-weight-saturation}} are
 
5224
well suited for fusion of @emph{color} images.  Remember that
 
5225
saturation weighting only works for @acronym{RGB} data.
 
5226
Option@tie{}@option{--saturation-weight} helps to control burnt-out
 
5227
highlights, as these are heavily desaturated.  Alternatively, use
 
5228
option@tie{}@option{--exposure-cutoff} to suppress noise or blown-out
 
5229
highlights without altering the overall brightness too much.  If no
 
5230
image suffers from troublesome highlights, the relative saturation
 
5231
weight can be reduced and even be set to zero.
 
5232
 
 
5233
For black and white images @option{--entropy-weight} can be an
 
5234
alternative to @option{--saturation-weight} because it suppresses
 
5235
overexposed pixels, as these contain little information.  However,
 
5236
entropy weighting is not limited to gray-scale data; it has been
 
5237
successfully applied to @acronym{RGB} images, too.  Note that entropy
 
5238
weighting considers @emph{each} color channel of an @acronym{RGB}
 
5239
image separately and chooses the channel with the minimum entropy as
 
5240
representative for the whole pixel.
 
5241
 
 
5242
Enfuse offers the photographer tremendous flexibility in fusing
 
5243
differently exposed images.  Whether you combine only two pictures or
 
5244
a series of 21, Enfuse imposes no limits on you.  Accordingly, the
 
5245
photographic effects achieved range from subtle to surreal, like the
 
5246
late 1980s ``Max Headroom'' @acronym{TV}-Series, to really unreal.
 
5247
Like some time ago in the chemical days of photography, when a new
 
5248
developer opened unseen possibilities for artists, exposure fusion
 
5249
extends a photographer's expressive space in the digital age.  Whether
 
5250
the results look good or bad, whether the images are dull or exciting,
 
5251
is entirely up the artist.
 
5252
 
 
5253
In the next sections we give assistance to starters, and rectify
 
5254
several misconceptions about Enfuse.
 
5255
 
 
5256
@menu
 
5257
* Exposure Series Tips::            Some hints for beginners
 
5258
* Exposure Series Misconceptions::  What works despite the hype
 
5259
@end menu
 
5260
 
 
5261
 
 
5262
@node Exposure Series Tips
 
5263
@subsection Tips For Beginners
 
5264
@cindex exposure series, tips for beginners
 
5265
 
 
5266
Here are some tips to get you in business quickly.
 
5267
 
 
5268
@table @emph
 
5269
@item Include the best single exposure.
 
5270
Include the exposure you would have taken if you did not use Enfuse in
 
5271
your series.  It gives you a solid starting point.  Think of the other
 
5272
images as augmenting this best single exposure to bring out the light
 
5273
and dark features you would like to see.
 
5274
 
 
5275
@item Begin with as small a number of images as possible.
 
5276
Pre-visualizing the results of Enfuse is difficult.  The more images
 
5277
put into the fusion process and the wider their @acronym{EV}-spacing
 
5278
is, the more challenging visualizing the output image becomes.
 
5279
Therefore, start off with as few images as possible.
 
5280
 
 
5281
You can take a larger series of images and only use part of it.
 
5282
 
 
5283
@item Start with a moderate @acronym{EV}-spacing.
 
5284
As has been pointed out in the previous item, a wide
 
5285
@acronym{EV}-spacing makes pre-visualization harder.  So start out
 
5286
with a spacing of 2/3@dmn{EV} to 1+1/3@dmn{EV}.
 
5287
@end table
 
5288
 
 
5289
 
 
5290
@node Exposure Series Misconceptions
 
5291
@subsection Common Misconceptions
 
5292
@cindex exposure series, common misconceptions
 
5293
 
 
5294
Here are some surprisingly common misconceptions about exposure
 
5295
series.
 
5296
 
 
5297
@table @emph
 
5298
@item A single image cannot be the source of an exposure series.
 
5299
@cindex digital blending
 
5300
@cindex blending exposures
 
5301
Raw-files in particular lend themselves to be converted multiple times
 
5302
and the results being fused together.  The technique is simpler,
 
5303
faster, and usually even looks better than
 
5304
@uref{http://@/luminous-@/landscape.com/@/tutorials/@/digital-@/blending.shtml,
 
5305
digital blending} (as opposed to using a graduated neutral density
 
5306
filter) or
 
5307
@uref{http://@/www.gimpguru.org/@/Tutorials/@/Blending@/Exposures/,
 
5308
blending exposures} in an image manipulation program.  Moreover,
 
5309
perfect alignment comes free of charge!
 
5310
 
 
5311
@item An exposure series must feature symmetrically-spaced exposures.
 
5312
Twice wrong!  Neither do the exposures have to be ``symmetric'' like
 
5313
@{0@dmn{EV}, @minus{}2/3@dmn{EV}, +2/3@dmn{EV}@}, nor does the number
 
5314
of exposures have to be odd.  Series like
 
5315
@{@minus{}1@minus{}1/3@dmn{EV}, @minus{}1/3@dmn{EV}, +1/3@dmn{EV}@} or
 
5316
@{@minus{}1@dmn{EV}, 1@dmn{EV}@} might be just right.  By the way, the
 
5317
order in which the images were taken does not matter either.
 
5318
 
 
5319
@item An exposure series must cover the whole dynamic range of the scene.
 
5320
@cindex light probe
 
5321
If you do not want to cover the whole range, you do not have to.  Some
 
5322
@acronym{HDR} programs require the user to take a light
 
5323
probe,@footnote{@uref{http://@/www.debevec.org/, Paul E.@tie{}Debevec}
 
5324
defines: ``A @dfn{light probe} image is an omnidirectional, high
 
5325
dynamic range image that records the incident illumination conditions
 
5326
at a particular point in space.''} whereas Enfuse offers the user
 
5327
complete freedom of exposure.
 
5328
 
 
5329
@item All exposure values must be different.
 
5330
You can repeat any exposure as often as you like.  That way you
 
5331
combine an exposure series with parts of @ref{Repetition}, emphasizing
 
5332
the multiply occuring exposures and reducing noise.
 
5333
@end table
 
5334
 
 
5335
 
 
5336
@node Flash Exposure Series
 
5337
@section Flash Exposure Series -- Directed Lighting
 
5338
@cindex flash exposure series
 
5339
@cindex series, flash exposure
 
5340
@cindex dynamic range increase
 
5341
 
 
5342
@mainpurpose ???
 
5343
 
 
5344
...
 
5345
 
 
5346
 
 
5347
@node Polarization Series
 
5348
@section Polarization Series -- Saturation Enhancement
 
5349
@cindex polarization series
 
5350
@cindex series, polarization
 
5351
@cindex saturation enhancement
 
5352
 
 
5353
@mainpurpose Reflection suppression, saturation enhancement
 
5354
 
 
5355
In the current implementation of Enfuse, it is not possible in general
 
5356
to fuse a polarization series.  Naively abusing
 
5357
@option{--saturation-weight} will not work.
 
5358
 
 
5359
 
 
5360
@node Focus Stacks
 
5361
@section Focus Stacks -- Depth-of-Field Increase
 
5362
@cindex focus stacks
 
5363
@cindex depth-of-focus increase
 
5364
 
 
5365
@mainpurpose Synthetic Depth-of-Field Increase
 
5366
 
 
5367
A @dfn{focus stack} is a series of images where the distance of the
 
5368
focal plane from the sensor varies.  Sloppily speaking, the images
 
5369
were focussed at different distances.  Fusing such a stack increases
 
5370
the depth-of-field (@acronym{DOF}) beyond the physical limits of
 
5371
diffraction.
 
5372
 
 
5373
@menu
 
5374
* Why Focus Stacks::            Why take the hassle?
 
5375
* Preparing Focus Stacks::      How to get suitable input images
 
5376
* Local Contrast Based Fusing:: Fundamental command line options
 
5377
* Basic Focus Stacking::        Simple, standard deviation method
 
5378
* Advanced Focus Stacking::     Advanced, Laplacian technique
 
5379
* Expert Stacking::             Tips for focus stacking experts
 
5380
@end menu
 
5381
 
 
5382
 
 
5383
@node Why Focus Stacks
 
5384
@subsection Why create focus stacks?
 
5385
@cindex focus stacks, why create them
 
5386
 
 
5387
Given
 
5388
 
 
5389
@itemize
 
5390
@item
 
5391
a fixed sensor or film size,
 
5392
@item
 
5393
a lens' particular focal length, and
 
5394
@item
 
5395
@cindex circle-of-confusion
 
5396
a notion about ``sharpness'', technically speaking the size of the
 
5397
circle-of-confusion (@acronym{CoC})
 
5398
@end itemize
 
5399
 
 
5400
@cindex depth-of-field
 
5401
@noindent
 
5402
the photographer controls the depth-of-field with the aperture.
 
5403
Smaller apertures -- this is larger aperture numbers -- increase the
 
5404
@acronym{DOF} and vice versa.  However, smaller apertures increase
 
5405
diffraction which in turn renders the image unsharp.  So, there is an
 
5406
optimum aperture where the photographer gets maximum @acronym{DOF}.
 
5407
Sadly, for some purposes like macro shots it is not enough.  One way
 
5408
out is to combine the sharp parts of images focused at different
 
5409
distances, thereby artificially increasing the total @acronym{DOF}.
 
5410
This is exactly what Enfuse can do.
 
5411
 
 
5412
@cindex sweet spot aperture
 
5413
@cindex aperture, sweet spot
 
5414
All lenses have a so called ``sweet spot'' aperture, where their
 
5415
resolution is best.  Taking pictures at this aperture, the
 
5416
photographer squeezes the maximum quality out of the lens.  But: the
 
5417
``sweet spot'' aperture often is only one or two stops away from wide
 
5418
open.  Wouldn't it be great to be able combine these best-possible
 
5419
images to form one high-quality, sufficient-@acronym{DOF} image?
 
5420
Welcome to Enfuse's local-contrast selection abilities.
 
5421
 
 
5422
 
 
5423
@node Preparing Focus Stacks
 
5424
@subsection Preparing Focus Stacks
 
5425
@cindex focus stacks, preparation
 
5426
 
 
5427
We are going to combine images with limited @acronym{DOF} to increase
 
5428
their in-focus parts.  The whole process is about image sharpness.
 
5429
Therefore, the input images must align very well, not just well, but
 
5430
very well.  For optimum results the maximum control point distance in
 
5431
Hugin (@pxref{Helpful Programs}) should not exceed
 
5432
0.3--0.5@dmn{pixels} to ensure perfect blending.
 
5433
 
 
5434
As in all image fusion operations it is preferable to use 16@dmn{bit}
 
5435
linear (gamma = 1) images throughout, but 8@dmn{bit} gamma encoded
 
5436
images will do.  Naturally, high @acronym{SNR} input data always is
 
5437
welcome.
 
5438
 
 
5439
 
 
5440
@node Local Contrast Based Fusing
 
5441
@subsection Local Contrast Based Fusing
 
5442
@cindex local-contrast-based fusing
 
5443
@cindex fusing, local-contrast-based
 
5444
@cindex focus stacks, fusing
 
5445
 
 
5446
A bare bones call to Enfuse for focus stacking could look like this.
 
5447
 
 
5448
@example
 
5449
enfuse \
 
5450
    --exposure-weight=0 \
 
5451
    --saturation-weight=0 \
 
5452
    --contrast-weight=1 \
 
5453
    --hard-mask \
 
5454
    @dots{} \
 
5455
    --output=output.tif \
 
5456
    input-<0000-9999>.tif
 
5457
@end example
 
5458
 
 
5459
@noindent
 
5460
Here is what each option causes:
 
5461
 
 
5462
@table @option
 
5463
@item --exposure-weight=0
 
5464
Switch @strong{off} exposure based pixel selection.  The default
 
5465
weight is @value{src::default-weight-exposure}.
 
5466
 
 
5467
@item --saturation-weight=0
 
5468
Switch @strong{off} saturation based pixel selection.  The default
 
5469
weight is @value{src::default-weight-saturation}.
 
5470
 
 
5471
@item --contrast-weight=1
 
5472
Switch @strong{on} pixel selection based on local contrast.
 
5473
 
 
5474
@item --hard-mask
 
5475
Select the best pixel from the image stack and ignore all others.
 
5476
Without this option, Enfuse uses all pixels in the stack and weights
 
5477
them according to their respective quality, which in our case is local
 
5478
contrast.  Without @option{--hard-mask}, the result will always look a
 
5479
bit soft.  @xref{Local Contrast Weighting}.
 
5480
@end table
 
5481
 
 
5482
@noindent
 
5483
If you want to see some entertaining progress messages --
 
5484
local-contrast weighting takes a while --, also pass the
 
5485
@option{--verbose}@tie{}option for a verbose progress report.
 
5486
 
 
5487
 
 
5488
@node Basic Focus Stacking
 
5489
@subsection Basic Focus Stacking
 
5490
@cindex basic focus stacking
 
5491
@cindex focus stacking, basic
 
5492
 
 
5493
For a large class of image stacks Enfuse's default algorithm, as
 
5494
selected in @ref{Local Contrast Based Fusing}, to determine the
 
5495
sharpness produces nice results.  The algorithm uses a moving square
 
5496
window, the so-called contrast window.  It computes the standard
 
5497
deviation of the pixels inside of the window.  The program then
 
5498
selects the window's center pixel of the image in the stack where the
 
5499
standard deviation is largest, that is, the local contrast reaches the
 
5500
maximum.
 
5501
 
 
5502
However, the algorithm fails to deliver good masks for images which
 
5503
exhibit high contrast edges on the scale of the contrast window size.
 
5504
The typical artifacts that show up are
 
5505
 
 
5506
@itemize
 
5507
@item
 
5508
faint dark seams on the light side of the high contrast edges and
 
5509
 
 
5510
@item
 
5511
extremely soft, slightly lighter seams on the dark side of the high
 
5512
contrast edges,
 
5513
@end itemize
 
5514
 
 
5515
@noindent
 
5516
where the distance of the seams from the middle of the edge is
 
5517
comparable to the contrast window size.
 
5518
 
 
5519
If your results do not show any of these artifacts, stick with the
 
5520
basic algorithm.  Advanced focus stacking, as described in the next
 
5521
sections, delivers superior results in case of artifacts, though
 
5522
requires manually tuning several parameters.
 
5523
 
 
5524
 
 
5525
@node Advanced Focus Stacking
 
5526
@subsection Advanced Focus Stacking
 
5527
@cindex advanced focus stacking
 
5528
@cindex focus stacking, advanced
 
5529
 
 
5530
If your fused image shows any of the defects described in the previous
 
5531
section, you can try a more difficult-to-use algorithm that
 
5532
effectively works around the seam artifacts.  It is described in the
 
5533
next section.
 
5534
 
 
5535
@menu
 
5536
* Local Contrast Problem::        What is the problem Kenneth?
 
5537
* Laplacian Edge Detection::      Using a Laplacian-of-Gaussian to detect edges
 
5538
* Local Contrast Enhancement::    Boosting local contrast before weighting
 
5539
* Suppressing Noise or Recognizing Faint Edges::  The best of both worlds
 
5540
* Focus Stacking Decision Tree::  What to do and how to fuse
 
5541
@end menu
 
5542
 
 
5543
 
 
5544
@node Local Contrast Problem
 
5545
@subsubsection A Detailed Look at the Problem
 
5546
@cindex local contrast problem
 
5547
@cindex problem, local contrast
 
5548
 
 
5549
Let us use an example to illustrate the problem of relating the
 
5550
sharpness with the local contrast variations.  Say we use a
 
5551
5@classictimes{}5 contrast window.  Moreover, let @code{sharp_edge}
 
5552
and @code{smooth_edge} be two specific configurations:
 
5553
 
 
5554
@example
 
5555
sharp_edge =  [    0,    0,  200,    0,    0;
 
5556
                   0,  225,    0,    0,    0;
 
5557
                   0,  255,    0,    0,    0;
 
5558
                 215,    0,    0,    0,    0;
 
5559
                 200,    0,    0,    0,    0]
 
5560
@end example
 
5561
 
 
5562
@example
 
5563
smooth_edge = [    0,   62,  125,  187,  250;
 
5564
                   1,   63,  126,  188,  251;
 
5565
                   2,   65,  127,  190,  252;
 
5566
                   3,   66,  128,  191,  253;
 
5567
                   5,   67,  130,  192,  255]
 
5568
@end example
 
5569
 
 
5570
where @samp{;} separates the rows and @samp{,} separates the columns.
 
5571
This is in fact @uref{http://@/www.gnu.org/@/software/@/octave/,
 
5572
Octave} syntax.
 
5573
 
 
5574
@ref{Figure:sharp-edge} and @ref{Figure:smooth-edge} show plots of the
 
5575
matrices @code{sharp_edge} and @code{smooth_edge}.
 
5576
 
 
5577
@float Figure,Figure:sharp-edge
 
5578
@vimage{sharp-edge}
 
5579
 
 
5580
@caption{3D plot augmented by contour plot of the matrix@tie{}@code{sharp_edge}.}
 
5581
 
 
5582
@shortcaption{Sharp edge}
 
5583
@end float
 
5584
 
 
5585
@float Figure,Figure:smooth-edge
 
5586
@vimage{smooth-edge}
 
5587
 
 
5588
@caption{3D plot augmented by contour plot of the matrix@tie{}@code{smooth_edge}.}
 
5589
 
 
5590
@shortcaption{Smooth edge}
 
5591
@end float
 
5592
 
 
5593
@noindent
 
5594
Our intuition lets us ``see'' an extremely sharp edge in the first
 
5595
matrix, whereas the second one describes an extraordinarily smooth
 
5596
diagonal intensity ramp.  Which one will be selected?  Well,
 
5597
@code{sharp_edge} has a standard deviation of 88.07 and
 
5598
@code{smooth_edge} has 88.41.  Thus, @code{smooth_edge} wins,
 
5599
contradicting our intuition, and even worse, our intention!
 
5600
 
 
5601
Sadly, configurations like @code{smooth_edge} occur more often with
 
5602
high-quality, good
 
5603
@uref{http://@/www.luminous-@/landscape.com/@/essays/@/bokeh.shtml,
 
5604
bokeh} lenses.  In fact, they are the very manifestation of ``good
 
5605
bokeh''.  Therefore, Laplacian edge detection plays an important role
 
5606
when working with high-quality lenses.
 
5607
 
 
5608
 
 
5609
@node Laplacian Edge Detection
 
5610
@subsubsection Laplacian Edge Detection
 
5611
@cindex laplacian edge detection
 
5612
@cindex edge detection, laplacian
 
5613
 
 
5614
Enfuse provides a Laplacian-based algorithm that can help in
 
5615
situations where weighting based on the standard deviation fails.  It
 
5616
is activated with a positive value for @var{SCALE} in
 
5617
@code{--contrast-edge-scale}=@/@var{SCALE}.  The Laplacian will detect
 
5618
two-dimensional @emph{curvature} on the scale of @var{SCALE}.  Here
 
5619
and in the following we simply speak of ``curvature'' where we mean
 
5620
``magnitude of curvature''.  That is, we shall not distinguish between
 
5621
convex and concave edges.  Enfuse always use the magnitude of
 
5622
curvature for weighting.
 
5623
 
 
5624
Typically, @var{SCALE} ranges between 0.1@dmn{pixels} and
 
5625
0.5@dmn{pixels}, where 0.3@dmn{pixels} is a good starting point.  To
 
5626
find the best value for @var{SCALE} though, usually some
 
5627
experimentation will be necessary.  Use @option{--save-masks} to get
 
5628
all soft-mask (default:
 
5629
@file{@value{src::default-soft-mask-template}}) and hard-mask files
 
5630
(default: @file{@value{src::default-hard-mask-template}}).  Check how
 
5631
different scales affect the artifacts.  Also @pxref{Understanding
 
5632
Masks}.
 
5633
 
 
5634
 
 
5635
@node Local Contrast Enhancement
 
5636
@subsubsection Local Contrast Enhancement
 
5637
@cindex local contrast enhancement
 
5638
@cindex contrast enhancement, local
 
5639
 
 
5640
Sometimes Enfuse misses smoother edges with
 
5641
@option{--contrast-edge-scale} and a little local contrast enhancement
 
5642
(@acronym{LCE}) helps.  Set
 
5643
@code{--contrast-edge-scale}=@/@var{SCALE}:@/@var{LCE-SCALE}:@/@var{LCE-FACTOR}.
 
5644
where @var{LCE-SCALE} and @var{LCE-FACTOR} work like the
 
5645
@uref{http://@/www.cambridgeincolour.com/@/tutorials/@/unsharp-@/mask.htm,
 
5646
unsharp mask} filters in various image manipulation programs.  Start
 
5647
with @var{LCE-SCALE} ten times the value of @var{SCALE} and a
 
5648
@var{LCE-FACTOR} of 2--5.
 
5649
 
 
5650
@var{LCE-SCALE} can be specified as a percentage of @var{SCALE}.
 
5651
@var{LCE-FACTOR} also can be specified as a percentage.  Examples:
 
5652
 
 
5653
@example
 
5654
--contrast-edge-scale=0.3:3.0:3
 
5655
--contrast-edge-scale=0.3:1000%:3.0
 
5656
--contrast-edge-scale=0.3:3:300%
 
5657
--contrast-edge-scale=0.3:1000%:300%
 
5658
@end example
 
5659
 
 
5660
@noindent
 
5661
By default @acronym{LCE} is turned off.
 
5662
 
 
5663
 
 
5664
@node Suppressing Noise or Recognizing Faint Edges
 
5665
@subsubsection Suppressing Noise or Recognizing Faint Edges
 
5666
@cindex advanced focus stacking, suppressing noise
 
5667
@cindex advanced focus stacking, recognizing faint edges
 
5668
 
 
5669
The Laplacian-based algorithm is much better at resisting the seam
 
5670
problem than the local-contrast algorithm, but it has two
 
5671
shortcomings:
 
5672
 
 
5673
@enumerate
 
5674
@item
 
5675
The Laplacian is very susceptible to noise and
 
5676
@item
 
5677
it fails to recognize faint edges.
 
5678
@end enumerate
 
5679
 
 
5680
@noindent
 
5681
The @option{--contrast-min-curvature} option helps to mitigate both
 
5682
flaws.
 
5683
 
 
5684
The argument to @code{--contrast-min-curvature}=@var{CURVATURE} either
 
5685
is an absolute lightness value, for example 0..255 for 8@dmn{bit} data
 
5686
and 0..65535 for 16@dmn{bit} data, or, when given with a @samp{%}-sign
 
5687
it is a relative lightness value ranging from 0% to 100%.
 
5688
 
 
5689
To suppress unreal edges or counter excessive noise, use the
 
5690
@option{--contrast-min-curvature} option with a @emph{negative}
 
5691
curvature measure @var{CURVATURE}.  This forces all curvatures less
 
5692
than @minus{}@var{CURVATURE} to zero.
 
5693
 
 
5694
A @emph{positive} curvature measure @var{CURVATURE} makes Enfuse merge
 
5695
the @acronym{LoG} data with the local-contrast data.  Every curvature
 
5696
larger than or equal to @var{CURVATURE} is left unchanged, and every
 
5697
curvature less than @var{CURVATURE} gets replaced with the rescaled
 
5698
local-contrast data, such that the largest local contrast is just
 
5699
below @var{CURVATURE}.  This combines the best parts of both
 
5700
techniques and ensures a precise edge detection over the whole range
 
5701
of edge curvatures.
 
5702
 
 
5703
@noindent
 
5704
@strong{Summary}
 
5705
 
 
5706
@table @code
 
5707
@item -@/-contrast-edge-scale=0.3
 
5708
Use @acronym{LoG} to detect edges on a scale of 0.3@dmn{pixels}.
 
5709
Apply the default grayscale projector: @code{average}.
 
5710
 
 
5711
@item -@/-contrast-edge-scale=0.3 -@/-gray-projector=l-star
 
5712
Use @acronym{LoG} to detect edges on a scale of 0.3@dmn{pixels}.
 
5713
Apply the L*-grayscale projector.
 
5714
 
 
5715
@item -@/-contrast-edge-scale=0.3:3:300%
 
5716
Use @acronym{LoG} to detect edges on a scale of 0.3@dmn{pixels},
 
5717
pre-sharpen the input images by 300% on a scale of 3@dmn{pixels}.
 
5718
Apply the default grayscale projector: @code{average}.
 
5719
 
 
5720
@item -@/-contrast-edge-scale=0.3 -@/-contrast-min-curvature=@minus{}0.5%
 
5721
Use @acronym{LoG} to detect edges on a scale of 0.3@dmn{pixels}.
 
5722
Apply the default grayscale projector: @code{average} and throw away
 
5723
all edges with a curvature of less than 0.5%.
 
5724
 
 
5725
@item -@/-contrast-edge-scale=0.3 -@/-contrast-min-curvature=0.5% -@/-contrast-window-size=7
 
5726
Use @acronym{LoG} to detect edges on a scale of 0.3@dmn{pixels}.
 
5727
Apply the default grayscale projector: @code{average} and throw away
 
5728
all edges with a curvature of less than 0.5% and replace the
 
5729
@acronym{LoG} data between 0% and 0.5% with @acronym{SDev} data.  Use
 
5730
a window of 7@classictimes{}7@dmn{pixel} window to compute the
 
5731
@acronym{SDev}.
 
5732
@end table
 
5733
 
 
5734
 
 
5735
@page
 
5736
@node Focus Stacking Decision Tree
 
5737
@subsubsection Focus Stacking Decision Tree
 
5738
@cindex focus stacking decision tree
 
5739
@cindex decision tree, focus stacking
 
5740
 
 
5741
@ref{Figure:focus-stacking-decision-tree} helps the user to arrive at
 
5742
a well-fused focus stack with as few steps as possible.
 
5743
 
 
5744
@float Figure,Figure:focus-stacking-decision-tree
 
5745
@vimage{focus-stack-decision-tree}
 
5746
 
 
5747
@caption{Focus stacking decision tree.}
 
5748
 
 
5749
@shortcaption{Focus stacking decision tree}
 
5750
@end float
 
5751
 
 
5752
Always start with the default, contrast weighting with a local
 
5753
contrast window.  Only if seams appear as described in @ref{Advanced
 
5754
Focus Stacking} switch to Laplacian-of-Gaussian contrast detection.
 
5755
 
 
5756
If some seams remain even in @acronym{LoG}-mode, decrease the
 
5757
sensitivity of the edge detection with a positive
 
5758
@option{--contrast-min-curvature}.  A too high value of
 
5759
@option{--contrast-min-curvature} suppresses fine detail though.  Part
 
5760
of the detail can be brought back with pre-sharpening, that is,
 
5761
@ref{Local Contrast Enhancement} or combining @acronym{LoG} with
 
5762
local-contrast-window mode by using a negative
 
5763
@option{--contrast-min-curvature}.
 
5764
 
 
5765
Carefully examining the masks (option@tie{}@option{--save-masks}) that
 
5766
Enfuse uses helps to judge the effects of the parameters.
 
5767
 
 
5768
 
 
5769
@node Expert Stacking
 
5770
@subsection Tips For Focus Stacking Experts
 
5771
@cindex expert focus stacking tips
 
5772
@cindex tips, focus stacking experts
 
5773
 
 
5774
We have collected some advice with which even focus-stacking adepts
 
5775
can benefit.
 
5776
 
 
5777
@itemize
 
5778
@item
 
5779
@cindex sensor, use of clean
 
5780
Ensure that the sensor is clean.
 
5781
 
 
5782
Aligning focus stacks requires varying the viewing angle, which
 
5783
corresponds to a changing focal length.  Hence, the same pixel on the
 
5784
sensor gets mapped onto different positions in the final image.  Dirt
 
5785
spots will occur not only once but as many times as there are images
 
5786
in the stack -- something that is no fun to correct in postprocessing.
 
5787
 
 
5788
@cindex dark frame
 
5789
@cindex subtraction of dark frame
 
5790
@cindex hot pixels
 
5791
@cindex pixels, hot
 
5792
Along the same lines, the photographer may want to consider to prepare
 
5793
dark frames before, and possibly also after, the shoot of the focus
 
5794
stack, to subtract hot pixels before fusion.
 
5795
 
 
5796
@item
 
5797
@opindex --hard-mask
 
5798
Prefer a low-sensitivity setting (``@acronym{ISO}'') on the camera to
 
5799
get low-noise images.
 
5800
 
 
5801
Fusing with @option{--hard-mask} does not average, and thus does not
 
5802
suppress any noise in the input images.
 
5803
 
 
5804
@item
 
5805
If the transition of in-focus to out-of-focus areas is too abrupt,
 
5806
record the images with closest and farthest focusing distances twice:
 
5807
first with the intended working aperture, and a second time with a
 
5808
small aperture (large aperture number).
 
5809
 
 
5810
@cindex natural sharp-unsharp transition
 
5811
@cindex transition, natural sharp-unsharp
 
5812
The small aperture will give the fused image a more natural in-focus
 
5813
to out-of-focus transition and the working-aperture shots supply the
 
5814
detail in the in-focus regions.
 
5815
@end itemize
 
5816
 
 
5817
 
 
5818
@node Helpful Programs
 
5819
@chapter Helpful Additional Programs
 
5820
@cindex helpful programs
 
5821
@cindex programs, helpful additional
 
5822
 
 
5823
@include helpful-programs.texi
 
5824
 
 
5825
 
 
5826
@node Bug Reports
 
5827
@appendix Bug Reports
 
5828
@cindex bug reports
 
5829
 
 
5830
@include bug-reports.texi
 
5831
 
 
5832
 
 
5833
@node Authors
 
5834
@appendix Authors
 
5835
@cindex authors, list of
 
5836
 
 
5837
@include authors.texi
 
5838
 
 
5839
 
 
5840
@node FDL
 
5841
@appendix @acronym{GNU} Free Documentation License
 
5842
@cindex free documentation license (@acronym{FDL})
 
5843
@cindex @acronym{GNU} free documentation license
 
5844
 
 
5845
@include fdl.texi
 
5846
 
 
5847
 
 
5848
@c
 
5849
@c End of Document
 
5850
@c
 
5851
 
 
5852
@c The List-of-Tables and List-of-Figures go right before the indices
 
5853
@c in all formats but TeX.  For the TeX output they appear right after
 
5854
@c the Table-of-Contents.
 
5855
@ifnotdocbook
 
5856
@ifnottex
 
5857
@node List of Tables
 
5858
@unnumbered List of Tables
 
5859
@listoffloats Table
 
5860
 
 
5861
 
 
5862
@node List of Figures
 
5863
@unnumbered List of Figures
 
5864
@listoffloats Figure
 
5865
@end ifnottex
 
5866
 
 
5867
 
 
5868
@node Program Index
 
5869
@unnumbered Program Index
 
5870
@cindex program index
 
5871
@cindex index, program
 
5872
 
 
5873
@printindex pg
 
5874
 
 
5875
 
 
5876
@node Syntactic-Comment Index
 
5877
@unnumbered Syntactic-Comment Index
 
5878
@cindex syntactic-comment index
 
5879
@cindex index, syntactic-comment
 
5880
 
 
5881
@printindex sc
 
5882
 
 
5883
 
 
5884
@node Option Index
 
5885
@unnumbered Option Index
 
5886
@cindex option index
 
5887
@cindex index, option
 
5888
 
 
5889
@printindex op
 
5890
 
 
5891
 
 
5892
@node General Index
 
5893
@unnumbered General Index
 
5894
@cindex general index
 
5895
@cindex index, general
 
5896
 
 
5897
@printindex cp
 
5898
@end ifnotdocbook
 
5899
 
 
5900
@bye