d2::image::defined_scale_by_half(): Replace incorrect operators for geometric mean.
[Ale.git] / device / nikon_d50.h
blob923436e120cee29edb8229aaf3993318ba300e12
1 // code by HJ Hornbeck, based on code copyright David Hilvert
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it
7 and/or modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be
12 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14 Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __nikon_d50_h__
22 #define __nikon_d50_h__
24 #include "../d2.h"
25 #include "../d2/render/psf/psf.h"
28 * Device module for the Nikon D50.
30 * Much like the Canon, alignment works best with RAW input created by
31 * dcraw, with the -D/-d and -4 flags enabled. If you get bayer patterns
32 * in the output image, and have Irani-Peleg iteration on, try swapping
33 * the inputs from RAW to processed (but lossless) and ditch the device
34 * setting.
38 class nikon_d50 {
39 public:
42 * Linear colorspace PSF
44 * This PSF isn't an exact match, instead balancing quality, speed, and
45 * robustness. While some blur will probably remain, at scale factors
46 * less than 3 it's easily corrected for in the GIMP (or similar).
47 * Larger diameters perform more sharpening, but run time increases
48 * by the square of the diameter. Finally, the PSF should vary by
49 * lens and focal length, but this mild one works relatively well
50 * across a wide range of lenses.
53 static d2::psf *lpsf() {
55 return d2::psf_parse::get( 1, "box=1^circle=1.1^circle=1.1" );
59 * Non-linear colorspace PSF
61 * The linear PSF works perfectly with RAW input, and even performs
62 * well if I substitute images with non-linear colourspace. I
63 * haven't found a need for this, yet.
66 static d2::psf *nlpsf() {
68 return NULL;
72 * Exposure
74 * The defaults for the Canon work well enough.
77 class exposure : public d2::exposure_default {
78 d2::pixel linearize(d2::pixel input) const {
79 return input * get_multiplier();
81 d2::pixel unlinearize(d2::pixel input) const {
82 return input / get_multiplier();
87 * View Angle
89 * Copy/Paste from the Canon again.
92 static ale_pos view_angle() {
93 fprintf(stderr, "\n\n*** Error: tried to obtain view angle for a sensor device. ***\n\n");
94 exit(1);
95 // return 30;
99 * Bayer pattern
101 * Adding this function because this info should be here, instead
102 * of hard-wired into the argument parsing code.
105 static unsigned int bayer() {
106 return IMAGE_BAYER_BGRG;
110 #undef LPSF_ROWS
111 #undef LPSF_COLS
112 #undef NLPSF_ROWS
113 #undef NLPSF_COLS
115 #endif