head	1.1;
access;
symbols;
locks; strict;
comment	@ * @;


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


desc
@This is old code by dsp, but might be useful.
It may have to be edited to successfully compile under iac++ 1.1
@


1.1
log
@Initial revision
@
text
@// create_thresh_test2.c
//      Copyright 1994, Center for Computer Vision and Visualization,
//      University of Florida.  All rights reserved.
// Image Algebra C++ program to create a test image
//      that can be used for the threshold determination
//      algorithms


#include "FloatDI.h"


IA_Image<IA_Point<int>,float>
smooth(IA_Image<IA_Point<int>,float> a) {

    IA_Point<int> t_points[9];
    t_points[0] = IA_Point<int>(0,0);      
    t_points[1] = IA_Point<int>(0,1);      
    t_points[2] = IA_Point<int>(-1,1);     
    t_points[3] = IA_Point<int>(-1,0);
    t_points[4] = IA_Point<int>(-1,-1);
    t_points[5] = IA_Point<int>(0,-1);
    t_points[6] = IA_Point<int>(1,-1);
    t_points[7] = IA_Point<int>(1,0);
    t_points[8] = IA_Point<int>(1,1);

    IA_Set<IA_Point<int> >
	t_pointset(2,t_points,9); 

    IA_Image<IA_Point<int>,float> t_image(t_pointset,float(1.0));

    IA_DDTemplate<IA_Image<IA_Point<int>, float> > t(2,t_image); 

    IA_Image<IA_Point<int>,float> b;

    b = 0.111111 * linear_product(a,t);

    return b;

} // end smooth


main()
{
    IA_Set<IA_Point<int> >
	ps1=IA_boxy_pset(IA_Point<int>(0,0),IA_Point<int>(255,255)),
	ps2=IA_boxy_pset(IA_Point<int>(64,64),IA_Point<int>(192,192)),
	ps4=IA_boxy_pset(IA_Point<int>(96,96),IA_Point<int>(160,160));

    IA_Image<IA_Point<int>,float>
	w(ps4,240.0),
	x(ps1,80.0),
	y(ps2,160.0);

    w = w.extend(y);
    y = w.extend(x);

    y = smooth(y);
    y = smooth(y);
    y = smooth(y);

    y = smooth(y);
    y = smooth(y);
    y = smooth(y);

    y = smooth(y);
    y = smooth(y);
    y = smooth(y);

    y = smooth(y);
    y = smooth(y);
    y = smooth(y);

    y = smooth(y);
    y = smooth(y);
    y = smooth(y);

    y = smooth(y);
    y = smooth(y);
    y = smooth(y);

    y = smooth(y);
    y = smooth(y);
    y = smooth(y);

    y = smooth(y);
    y = smooth(y);
    y = smooth(y);

    IA_Set<IA_Point<int> >
	ps3=IA_boxy_pset(IA_Point<int>(32,32), IA_Point<int>(224,224));

    y = y.restrict(ps3);

    IA_Image<IA_Point<int>,int> z;

    z = IA_Image<IA_Point<int>,u_char>( to_uchar(y) );

    z.write_PGM(cout);
} //end main
@
