libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CRNMatrixComplex.h
Go to the documentation of this file.
1 /* Copyright 2013-2016 INSA-Lyon, ENS-Lyon
2  *
3  * This file is part of libcrn.
4  *
5  * libcrn is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * libcrn is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libcrn. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * file: CRNMatrixComplex.h
19  * \author Yann LEYDIER
20  */
21 
22 #ifndef CRNMATRIXComplex_HEADER
23 #define CRNMATRIXComplex_HEADER
24 
25 #include <CRNMath/CRNMatrix.h>
26 #include <complex>
27 
28 namespace crn
29 {
31  void FFT(std::vector<std::complex<double> > &sig, bool direct);
32 
33  class MatrixDouble;
34  class Point2DInt;
35 
36  /****************************************************************************/
46  class MatrixComplex: public Matrix<std::complex<double>>
47  {
48  public:
50  MatrixComplex(const Matrix<std::complex<double>> &m) : Matrix(m) {}
51  MatrixComplex(Matrix<std::complex<double>> &&m) : Matrix(std::move(m)) {}
52  MatrixComplex(const MatrixComplex &) = default;
53  MatrixComplex(MatrixComplex &&) = default;
54 
56  virtual ~MatrixComplex() override = default;
57 
58  MatrixComplex& operator=(const MatrixComplex &) = default;
59  MatrixComplex& operator=(MatrixComplex &&) = default;
60 
62  void GrowToPowerOf2(bool make_square, const std::complex<double> &fill_value = std::complex<double>(0, 0));
63 
65  MatrixDouble MakeModule() const;
66 
68  void FFT(bool direct);
69 
71  std::pair<Point2DInt, double> CrossCorrelation(const MatrixComplex &other, const std::complex<double> &fill1 = std::complex<double>(0, 0), const std::complex<double> &fill2 = std::complex<double>(0, 0));
72 
74  };
75  template<> struct IsClonable<MatrixComplex> : public std::true_type {};
76 
78 
79 
80  inline void FFT(MatrixComplex &m, bool direct) { m.FFT(direct); }
81 
82  template<> struct TypeInfo<MatrixComplex>
83  {
87  };
88 }
89 
90 #endif
91 
MatrixComplex & operator=(const MatrixComplex &)=default
void FFT(std::vector< std::complex< double > > &sig, bool direct)
Fast Fourier transform.
MatrixDouble MakeModule() const
Returns a matrix containing the modules of the inner values.
MatrixComplex(Matrix< std::complex< double >> &&m)
Base matrix class.
Definition: CRNMatrix.h:43
MatrixComplex(const Matrix< std::complex< double >> &m)
double matrix class
std::pair< Point2DInt, double > CrossCorrelation(const MatrixComplex &other, const std::complex< double > &fill1=std::complex< double >(0, 0), const std::complex< double > &fill2=std::complex< double >(0, 0))
Cross correlation.
void GrowToPowerOf2(bool make_square, const std::complex< double > &fill_value=std::complex< double >(0, 0))
Grows the matrix to power of 2 sizes (for FFT)
virtual ~MatrixComplex() override=default
Destructor.
Complex matrix class.
#define CRN_DECLARE_CLASS_CONSTRUCTOR(classname)
Declares a class constructor.
Definition: CRNObject.h:173
void FFT(bool direct)
Inplace fast Fourier transform.
CRN_ALIAS_SMART_PTR(ImageBW)
A class containing informations on a type.
Definition: CRNType.h:176
Matrix(size_t nrow, size_t ncol, const std::complex< double > &value=std::complex< double >(0))
Constructor.
Definition: CRNMatrix.h:52