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