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


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

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


desc
@Initial version of the Max-Min Sharpening algorithm.
@


1.2
log
@Added algorithm name to header, spelling changes.
@
text
@// max-min.c            Section: 2.6  Max-min Sharpening Transform
//      Copyright 1994, Center for Computer Vision and Visualization,
//      University of Florida.  All rights reserved.
// Max-Min Sharpening Transform
//

#include "max-min.h"


///////////////////////////////////////////////////////////////////////
// max_min_sharpening()
// Implements the max-min-sharpening algorithm, with some minor
//      modifications. This version is implemented with neighborhoods,
//      and also includes interation count to allow the basic
//      algorithm to be applied many times within each call.

template <class P, class T>
IA_Image<P,T>
max_min_sharpening( const IA_Image<P,T> &image,
		    const IA_Neighborhood<P,P> &neighborhood,
		    const unsigned int iteration_count        ) {

    IA_Image<P,T>
	a(image),      // The original image, need a copy if iteration_count>0
	a_min, a_max, b,
	s(image);      // Initialize s in case iteration_count == 0;
    
    for (unsigned i=0; i<iteration_count; i++) {
	a_max = max(a, neighborhood);
	a_min = min(a, neighborhood);

        b = a_max + a_min - 2*a;

	s = IA_Image<P,T>(chi_le(b, 0))*a_max +
	    IA_Image<P,T>(chi_gt(b, 0))*a_min;
	
	a = s;  // Prepare for the next loop iteration.
    }
    
    return s;
}
@


1.1
log
@Initial revision
@
text
@d1 1
a1 1
// max-min.c            Section: 2.6
@
