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


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

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

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


desc
@Placing under RCS.  This should be the source corresponding to UM 1.0
@


1.3
log
@Modified to use 'return 0;' rather than 'exit(0);'.
@
text
@// template_example.01.c

#include "DDTempl.h"
#include "UcharConv.h"


////////////////////////////////////////////////////////////////
// Binary Image Boundaries
////////////////////////////////////////////////////////////////

int main() {

// The first order of business is to create the two templates
// we need.  The 4-boundary template image is a little harder to
// create because we must create an array of Point<int>s to initialize
// the point set with.  The 8-boundary template image is easier, since
// it is rectangular.


// Create the 4-boundary template image sImage

    IA_Point<int>  sipa[5];  // Declare an array for the 5 points
    sipa[0] = IA_Point<int>( 0, 0 );
    sipa[1] = IA_Point<int>( 1, 0 );
    sipa[2] = IA_Point<int>( 0, 1 );
    sipa[3] = IA_Point<int>( 0,-1 );
    sipa[4] = IA_Point<int>(-1, 0 );

    IA_Set<IA_Point<int> >
	sips( 2,     // Dimension 2
	      sipa,  // The array of Point<int>s
	      5 );   // The number of Point<int>s.

    IA_Image<IA_Point<int>,u_char>
	sImage(sips, u_char(0) );


// Create the 8-boundary template image tImage

    IA_Set<IA_Point<int> >
	tips( IA_Point<int>(-1,-1),
	      IA_Point<int>( 1, 1) );

    IA_Image<IA_Point<int>,u_char>
	tImage(tips, u_char(0) );


// Now we can create the templates s & t

    IA_DDTemplate<IA_Image<IA_Point<int>,u_char> >
	s( 2,         // Dimension 2
	   sImage ),  // Template range image
	t( 2,
	   tImage );


// Now read in the image from standard input
    IA_Image<IA_Point<int>,u_char>
	inImage( read_uchar_PGM( cin ) );


// Force it to be binary.

    IA_Image<IA_Point<int>,u_char>
	aImage( chi_ne( inImage, (u_char) 0 ) );


// Now calculate the external boundaries and display each

    IA_Image<IA_Point<int>,u_char>
	bImage;   // the result image


// Exterior 8-boundary calculation and output
    bImage = (1 - aImage) * addmax_product(aImage, s);
    display( bImage );


// Exterior 4-boundary calculation and output
    bImage = (1 - aImage) * addmax_product(aImage, t );
    display( bImage );

    return 0;
}
@


1.2
log
@Modified to be iac++ v2.0 compliant.
@
text
@a2 1
#include <stdlib.h>
d83 1
a83 1
    exit( 0 );
@


1.1
log
@Initial revision
@
text
@a0 2
// -*- C++ -*-

d3 1
d5 1
a5 1
#include "UcharConvolutions.h"
d12 1
a12 1
main() {
d83 2
@
