Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
9b9afc01
Commit
9b9afc01
authored
Nov 10, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgraded fft() and ifft() to support 2D matrices.
parent
e9ad3351
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
11 deletions
+68
-11
matrix_fft.h
dlib/matrix/matrix_fft.h
+0
-0
matrix_fft_abstract.h
dlib/matrix/matrix_fft_abstract.h
+68
-11
fft.cpp
dlib/test/fft.cpp
+0
-0
No files found.
dlib/matrix/matrix_fft.h
View file @
9b9afc01
This diff is collapsed.
Click to expand it.
dlib/matrix/matrix_fft_abstract.h
View file @
9b9afc01
...
@@ -29,19 +29,19 @@ namespace dlib
...
@@ -29,19 +29,19 @@ namespace dlib
/*!
/*!
requires
requires
- data contains elements of type std::complex<>
- data contains elements of type std::complex<>
- is_
vector(data
) == true
- is_
power_of_two(data.nr()
) == true
- is_power_of_two(data.
size
()) == true
- is_power_of_two(data.
nc
()) == true
ensures
ensures
- Computes the
discrete Fourier transform of the given data vector and
- Computes the
1 or 2 dimensional discrete Fourier transform of the given data
returns it. In particular, we return a matrix D such that:
matrix and
returns it. In particular, we return a matrix D such that:
- D.nr() == data.nr()
- D.nr() == data.nr()
- D.nc() == data.nc()
- D.nc() == data.nc()
- D(0) == the DC term of the Fourier transform.
- D(0
,0
) == the DC term of the Fourier transform.
- starting with D(0), D contains progressively higher frequency components
- starting with D(0
,0
), D contains progressively higher frequency components
of the input data.
of the input data.
- ifft(D) == D
- ifft(D) == D
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
library when given
double precision matrice
s instead of dlib's default fft
library when given
matrix<double> object
s instead of dlib's default fft
implementation. Note that you must also link to the fftw3 library to use
implementation. Note that you must also link to the fftw3 library to use
this feature.
this feature.
!*/
!*/
...
@@ -55,14 +55,71 @@ namespace dlib
...
@@ -55,14 +55,71 @@ namespace dlib
/*!
/*!
requires
requires
- data contains elements of type std::complex<>
- data contains elements of type std::complex<>
- is_
vector(data
) == true
- is_
power_of_two(data.nr()
) == true
- is_power_of_two(data.
size
()) == true
- is_power_of_two(data.
nc
()) == true
ensures
ensures
- Computes the inverse discrete Fourier transform of the given data vector and
- Computes the 1 or 2 dimensional inverse discrete Fourier transform of the
returns it. In particular, we return a matrix D such that:
given data vector and returns it. In particular, we return a matrix D such
that:
- D.nr() == data.nr()
- D.nr() == data.nr()
- D.nc() == data.nc()
- D.nc() == data.nc()
- fft(D) == data
- fft(D) == data
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
library when given matrix<double> objects instead of dlib's default fft
implementation. Note that you must also link to the fftw3 library to use
this feature.
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
T
,
long
NR
,
long
NC
,
typename
MM
,
typename
L
>
void
fft_inplace
(
matrix
<
std
::
complex
<
T
>
,
NR
,
NC
,
MM
,
L
>&
data
);
/*!
requires
- data contains elements of type std::complex<>
- is_power_of_two(data.nr()) == true
- is_power_of_two(data.nc()) == true
ensures
- This function is identical to fft() except that it does the FFT in-place.
That is, after this function executes we will have:
- #data == fft(data)
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
library when given double precision matrices instead of dlib's default fft
implementation. Note that you must also link to the fftw3 library to use
this feature.
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
T
,
long
NR
,
long
NC
,
typename
MM
,
typename
L
>
void
ifft_inplace
(
matrix
<
std
::
complex
<
T
>
,
NR
,
NC
,
MM
,
L
>&
data
);
/*!
requires
- data contains elements of type std::complex<>
- is_power_of_two(data.nr()) == true
- is_power_of_two(data.nc()) == true
ensures
- This function is identical to ifft() except that it does the inverse FFT
in-place. That is, after this function executes we will have:
- #data == ifft(data)*data.size()
- Note that the output needs to be divided by data.size() to complete the
inverse transformation.
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
library when given double precision matrices instead of dlib's default fft
library when given double precision matrices instead of dlib's default fft
implementation. Note that you must also link to the fftw3 library to use
implementation. Note that you must also link to the fftw3 library to use
...
...
dlib/test/fft.cpp
View file @
9b9afc01
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment