Commit 870ac7ad authored by Roland Levillain's avatar Roland Levillain
Browse files

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.
parent 1e9b9bdc
2012-10-09 Roland Levillain <roland@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@lrde.epita.fr>
 
Update copyright headers.
......@@ -46,4 +46,5 @@ MOSTLYCLEANFILES = \
fft_copy.pgm \
fft_low_pass.pgm \
fft_trans_clipped.pgm \
fft_trans_cropped.pgm \
fft_trans_log.pgm
......@@ -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");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment