* tests/transform/fft.cc: Ensure the inverse transform of the
transform is pretty much the same as the input image.
Save the cropped transform.
Remove dead code.
* tests/transform/Makefile.am (MOSTLYCLEANFILES):
Add fft_trans_cropped.pgm.
---
milena/ChangeLog | 11 +++++++++++
milena/tests/transform/Makefile.am | 1 +
milena/tests/transform/fft.cc | 18 ++++++++++++++++--
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index eb7148d..9cfd3a6 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,16 @@
2012-10-09 Roland Levillain <roland(a)lrde.epita.fr>
+ Improve the test of the Fast Fourier Transform.
+
+ * tests/transform/fft.cc: Ensure the inverse transform of the
+ transform is pretty much the same as the input image.
+ Save the cropped transform.
+ Remove dead code.
+ * tests/transform/Makefile.am (MOSTLYCLEANFILES):
+ Add fft_trans_cropped.pgm.
+
+2012-10-09 Roland Levillain <roland(a)lrde.epita.fr>
+
Update copyright headers.
* mln/transform/fft.hh,
diff --git a/milena/tests/transform/Makefile.am b/milena/tests/transform/Makefile.am
index b266926..a49ae65 100644
--- a/milena/tests/transform/Makefile.am
+++ b/milena/tests/transform/Makefile.am
@@ -46,4 +46,5 @@ MOSTLYCLEANFILES = \
fft_copy.pgm \
fft_low_pass.pgm \
fft_trans_clipped.pgm \
+ fft_trans_cropped.pgm \
fft_trans_log.pgm
diff --git a/milena/tests/transform/fft.cc b/milena/tests/transform/fft.cc
index c5c5bec..1dce9df 100644
--- a/milena/tests/transform/fft.cc
+++ b/milena/tests/transform/fft.cc
@@ -30,6 +30,12 @@
#include <mln/opt/at.hh>
#include <mln/debug/println.hh>
+#include <mln/core/image/flat_image.hh>
+#include <mln/fun/vv2b/le.hh>
+#include <mln/fun/vv2v/diff_abs.hh>
+#include <mln/data/transform.hh>
+#include <mln/test/predicate.hh>
+
#include "tests/data.hh"
#define CHECK(Condition) \
@@ -61,11 +67,16 @@ int main ()
io::pgm::save(im3, "fft_copy.pgm");
image2d<int_u8> fft = fourier.transformed_image_log_magn<int_u8>(true);
- // debug::println(fourier.transformed_image());
io::pgm::save(fft, "fft.pgm");
std::cout << "Test: Image == F-1(F(Image)) ... " << std::flush;
- // CHECK (im1 == im3);
+ /* FIXME: Milena lacks some feature to make write the following in a
+ shorter fashion (fun-morpher accepting binary (vv2v) functions or
+ function composition in pw-functions. */
+ CHECK(test::predicate(data::transform(im1, im3,
+ fun::vv2v::diff_abs<int_u8>()),
+ flat_image<int_u8, box2d>(1, im1.domain()),
+ fun::vv2b::le<int_u8>()));
image2d<int_u8> out =
fourier.transformed_image_clipped_magn<int_u8>(0.01);
@@ -83,6 +94,9 @@ int main ()
for (int col = 40; col < im2.ncols() - 40; ++col)
opt::at(im2, row, col) = 0;
+ fft = fourier.transformed_image_log_magn<int_u8>(true);
+ io::pgm::save(fft, "fft_trans_cropped.pgm");
+
out = fourier.transform_inv<int_u8>();
io::pgm::save(out, "fft_low_pass.pgm");
--
1.7.10.4
Show replies by date