Implement scoping using yet-unimplemented stream diversion operations; implement...
[Ale.git] / device / ov7620_raw_linear.h
blobffcef1f3b29f934e1b16d2fc3fe8f137c5c49e1e
1 // Copyright 2003, 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
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 __ov7620_raw_linear_h__
22 #define __ov7620_raw_linear_h__
24 #include "../d2.h"
27 * Device module for the OmniView OV7620 chip.
29 * This module is designed for use with the Linux 2.6.x driver patched with
30 * code available at:
32 * http://auricle.dyndns.org/ov7620/
36 class ov7620_raw_linear {
37 public:
40 * Linear colorspace PSF
43 class lpsf : public d2::box {
44 public:
46 * A box filter of diameter ~0.6325 results in an optical fill
47 * factor of 40%. Experimentation shows that filters of about
48 * this size perform well with this sensor, and the fill factor
49 * value matches data available on the web about this sensor:
51 * http://www.stanford.edu/class/ee109/reference/camera/DS-OV7620-1.3.pdf
54 lpsf() : d2::box (0.3162) {
59 * Exposure
62 class exposure : public d2::exposure_default {
63 d2::pixel linearize(d2::pixel input) const {
64 ale_real lo = 16 / (ale_real) 255;
65 ale_real scale = 255 / (ale_real) 224;
66 return (input - d2::pixel(lo, lo, lo)) * scale * get_multiplier();
68 d2::pixel unlinearize(d2::pixel input) const {
69 ale_real lo = 16 / (ale_real) 255;
70 ale_real scale = 224 / (ale_real) 255;
71 return (input / get_multiplier()) * scale + d2::pixel(lo, lo, lo);
76 * View Angle
79 static ale_pos view_angle() {
80 fprintf(stderr, "\n\n*** Error: tried to obtain view angle for a sensor device. ***\n\n");
81 exit(1);
82 // return 30;
86 #undef LPSF_ROWS
87 #undef LPSF_COLS
88 #undef NLPSF_ROWS
89 #undef NLPSF_COLS
91 #endif