IMP logo
IMP Reference Guide  2.6.2
The Integrative Modeling Platform
FFToperations.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em2d/FFToperations.h
3  * \brief Operations involving FFT
4  * Copyright 2007-2016 IMP Inventors. All rights reserved.
5 */
6 
7 #ifndef IMPEM2D_FF_TOPERATIONS_H
8 #define IMPEM2D_FF_TOPERATIONS_H
9 
10 #include "IMP/em2d/em2d_config.h"
12 
13 IMPEM2D_BEGIN_NAMESPACE
14 
15 /**
16  * Transforms a matrix as is given by FFT functions, into a image
17  * interpretation. Works the opposite way too.
18  * @param m The matrix to flip. The it is changed in situ
19  */
20 IMPEM2DEXPORT void do_matrix_to_image_flip(cv::Mat &m);
21 
22 //! Autocorrelation without preprocessing
23 /**
24  \param[in] M matrix containing the dft
25  \param[out] corr the matrix to store the autocorrelation. Must have the
26  proper dimensions when passed
27 */
28 IMPEM2DEXPORT void get_autocorrelation2d_no_preprocessing(const cv::Mat &M,
29  cv::Mat &corr);
30 
31 //! Computes the autocorrelation matrix
32 /** @param m The input matrix
33  @param corr The result matrix containing the autocorrelation
34  */
35 IMPEM2DEXPORT void get_autocorrelation2d(const cv::Mat &m, cv::Mat &corr);
36 
37 //! Correlation matrix between two 2D matrices using FFT
38 /**
39  \param[in] A first matrix
40  \param[in] B second matrix
41  \param[out] corr matrix of results
42 */
43 IMPEM2DEXPORT void get_correlation2d(const cv::Mat &A, const cv::Mat &B,
44  cv::Mat &corr);
45 
46 //! Correlation without preprocessing
47 /** \returns the correlation matrix between two 2D matrices using FFT
48  \param[in] M1 matrix containing the dft of the first matrix
49  \param[in] M2 matrix containing the dft of the second matrix
50  \param[out] corr matrix of results (It MUST have the right size in advance)
51 */
52 IMPEM2DEXPORT void get_correlation2d_no_preprocessing(const cv::Mat &M1,
53  const cv::Mat &M2,
54  cv::Mat &corr);
55 
56 /**
57  * Get the FFT of a matrix using padding with other matrix that can be
58  * computed with FFT in an optimal way. i.e. with a size that makes the
59  * FFT algorithm work faster
60  * @param m The input matrix
61  * @param M The output matrix with the FFT
62  * @note The output matrix can have (and frequently will have) different
63  * dimensions than the input matrix
64  */
65 IMPEM2DEXPORT void get_fft_using_optimal_size(const cv::Mat &m, cv::Mat &M);
66 
67 //! Computes the fft of a matrix and returns the real and imaginary matrices
68 /** @param m The input matrix
69  @param real The matrix with the real part of the FFT matrix
70  @param imag The imaginary part of the FFT matrix
71  */
72 IMPEM2DEXPORT void get_spectrum(const cv::Mat &m, cv::Mat &real, cv::Mat &imag);
73 
74 IMPEM2D_END_NAMESPACE
75 
76 #endif /* IMPEM2D_FF_TOPERATIONS_H */
void get_autocorrelation2d_no_preprocessing(const cv::Mat &M, cv::Mat &corr)
Autocorrelation without preprocessing.
void get_correlation2d(const cv::Mat &A, const cv::Mat &B, cv::Mat &corr)
Correlation matrix between two 2D matrices using FFT.
void get_autocorrelation2d(const cv::Mat &m, cv::Mat &corr)
Computes the autocorrelation matrix.
Interface with OpenCV Copyright 2007-2016 IMP Inventors. All rights reserved.
void get_fft_using_optimal_size(const cv::Mat &m, cv::Mat &M)
void do_matrix_to_image_flip(cv::Mat &m)
void get_correlation2d_no_preprocessing(const cv::Mat &M1, const cv::Mat &M2, cv::Mat &corr)
Correlation without preprocessing.
void get_spectrum(const cv::Mat &m, cv::Mat &real, cv::Mat &imag)
Computes the fft of a matrix and returns the real and imaginary matrices.