Hugin trunk 0.1
Loading...
Searching...
No Matches
MathStuff.h
Go to the documentation of this file.
1/*
2* Copyright (C) 2007-2008 Anael Orlinski
3*
4* This file is part of Panomatic.
5*
6* Panomatic is free software; you can redistribute it and/or modify
7* it under the terms of the GNU General Public License as published by
8* the Free Software Foundation; either version 2 of the License, or
9* (at your option) any later version.
10*
11* Panomatic is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with Panomatic; if not, write to the Free Software
18* <http://www.gnu.org/licenses/>.
19*/
20
21#ifndef __lfeat_math_h
22#define __lfeat_math_h
23
24#include <vector>
25
26#define PI 3.14159
27
28namespace lfeat
29{
30struct Math
31{
32
33 static bool SolveLinearSystem33(double* solution, double sq[3][3]);
34 static bool Normalize(double* iVec, int iLen);
35
36
37};
38
39template <int LBound = -128, int UBound = 127, class TResult = double, class TArg = double>
40class LUT
41{
42public:
43 explicit LUT (TResult (*f) (TArg), double coeffadd = 0, double coeffmul = 1)
44 {
46 for (int i = LBound; i <= UBound; i++)
47 {
48 lut[i] = f(coeffmul * (i+coeffadd));
49 }
50 }
51
52 const TResult& operator()(int i) const
53 {
54 return lut[i];
55 }
56private:
59};
60
61}
62
63#endif //__lfeat_math_h
TResult * lut
Definition MathStuff.h:58
LUT(TResult(*f)(TArg), double coeffadd=0, double coeffmul=1)
Definition MathStuff.h:43
const TResult & operator()(int i) const
Definition MathStuff.h:52
TResult lut_array[UBound - LBound+1]
Definition MathStuff.h:57
static bool SolveLinearSystem33(double *solution, double sq[3][3])
Definition MathStuff.cpp:24
static bool Normalize(double *iVec, int iLen)
Definition MathStuff.cpp:84
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41