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


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

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

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


desc
@Initial neighborhood version of the Median-Filter.
@


1.3
log
@Added algorithm name to header.  Correct spelling errors.
Made style changes.  Added support for median-gamma<T> instantiation.
@
text
@// test-median-nbhd.c   Section: 2.8  Median Filter
//      Copyright 1994, Center for Computer Vision and Visualization,
//      University of Florida.  All rights reserved.
// Test the median code


#include "median.h"
#include "shaped-pointset.h"


///////////////////////////////////////////////////////////////////

int main(int argc, char *argv[]) {
    
    // Radius value ?
    unsigned int  argvalue = ( argc > 1 ? atoi(argv[1]) : 1);
    unsigned int  radius   = (argvalue > 1 ? argvalue : 1);
    cerr << "Using radius = " << radius << endl;

    // Point set shape ?
    //   == 0 => digital_disc()
    //   == 1 => cross_hair()
    int psShape = ( argc > 2 ? atoi(argv[2]) : 0);
    cerr << "Using point set shape = " <<
	    (psShape ? "cross_hair()" : "digital_disc()" ) << endl;


    IA_Image<IA_Point<int>,u_char>
	a = read_uchar_PGM(cin);

    // By using the dimension of the image we can make this
    //   generalize to 1, 2, 3 or N-dimensional images.
    // For now we will use the digital_disc() neighborhood.
    unsigned int
	aDimen = a.domain().dim();

    IA_Point<int>  origin = extend_to_point( int(0), aDimen );
    IA_Set<IA_Point<int> >
	median_ps( ( psShape
		     ? digital_disc( origin, radius )
		     : cross_hair( origin, radius ) ) );

    IA_Neighborhood<IA_Point<int>,IA_Point<int> >
	median_nbhd( aDimen, median_ps );
    
    median( a, median_nbhd ).write_PGM(cout);

    return 0;
}
@


1.2
log
@Added exit() stmt to main() for picky systems.
@
text
@d1 1
a1 1
// test-median-nbhd.c   Section: 2.8
d17 1
a17 1
    unsigned int  radius(argvalue > 1 ? argvalue : 1);
d29 1
a29 1
	a = IA_Image<IA_Point<int>,u_char>::read_PGM(cin);
d37 1
a37 1
    IA_Point<int>  origin( extend_to_point( int(0), aDimen ) );
d48 1
a48 1
    exit( 0 );
@


1.1
log
@Initial revision
@
text
@d13 1
a13 1
void main(int argc, char *argv[]) {
d47 2
a49 1

@
