head	1.4;
access;
symbols;
locks; strict;
comment	@// @;


1.4
date	95.01.06.05.32.01;	author rjj;	state Exp;
branches;
next	1.3;

1.3
date	94.10.20.05.37.50;	author rjj;	state Exp;
branches;
next	1.2;

1.2
date	94.05.27.01.40.43;	author rjj;	state Exp;
branches;
next	1.1;

1.1
date	94.02.20.04.09.11;	author rjj;	state Exp;
branches;
next	;


desc
@This version utilizes the composition fft-nd algorithm, bu
produces an output to the file: test-fft-all.pgm
which is the output of the fft and input to the fft_inv().
@


1.4
log
@Major change was to use abs_f( CDI ) and scale_to_uchar().
@
text
@// test-fft-all.c       Section 8.3  Fast Fourier Transform
//      Copyright 1994, Center for Computer Vision and Visualization,
//      University of Florida.  All rights reserved.
// Test the Fast Fourier Transform using spatial transforms.
// Note that this version also displays the complext image.
//

#include "FloatDI.h"
#include "UcharDI.h"
#include "fft.h"
#include "scale-to-uchar.h"


IA_Image<IA_Point<int>,u_char>
normalize( const IA_Image<IA_Point<int>,complex> & cim ) {
    // first convert to a real-valued image
    IA_Image<IA_Point<int>,float>
	y = abs_f( cim );

    // Scale to [0..255]
    return
	scale_to_uchar( y );
}


int main() {
    // Read in the image
    IA_Image<IA_Point<int>,int>
	e = IA_Image<IA_Point<int>,int>::read_PGM(cin);

    IA_Image<IA_Point<int>,complex> x(e);  // Convert to a complex image

    x = fft(x);                    // Calculate the FFT

    normalize(x).write_PGM("test-fft-all.pgm");

    x = fft_inv(x);                // Reverse effect to see if it worked

    IA_Image<IA_Point<int>,u_char>(
	to_uchar( real_f(x) ) ).write_PGM(cout);

    return 0;
}
@


1.3
log
@Added algorithm name to header.
Added return 0; to test files.
@
text
@d4 1
a4 1
// Test the Fast Fourier transform using spatial transforms.
a7 1
#include "fft.h"
d10 2
d18 1
a18 1
	y = sqrt( sqr(real_f(cim)) + sqr(imag_f(cim)) );
d21 2
a22 3
    y = y * (255 / max(y));

    return to_uchar( y );
@


1.2
log
@Sanitized IA type names to be v1.0 compliant.
Added/modifed to have standard header.
@
text
@d1 1
a1 1
// test-fft-all.c     Section 8.3
d26 1
a26 1
main() {
d41 2
@


1.1
log
@Initial revision
@
text
@d1 5
a5 3
// Emacs: -*- C++ -*-
// test-fft-all.c
//         Test the Fast Fourier transform using spatial transforms
a7 1
#include "imagealgebra.h"
d9 2
d13 2
a14 2
IA_UcharDiscreteImage
normalize( const IA_ComplexDiscreteImage & cim ) {
d16 1
a16 1
    IA_FloatDiscreteImage
d28 2
a29 1
    IA_IntDiscreteImage e = IA_IntDiscreteImage::read_PGM(cin);
d31 1
a31 1
    IA_ComplexDiscreteImage x(e);  // Convert to a complex image
d39 2
a40 1
    IA_UcharDiscreteImage( to_uchar( real_f(x) ) ).write_PGM(cout);
@
