/********************************************************************
 * Project: CS664 Project 2                  Justin Miller 
 * File: hausd_corr.h        HAUSD_CORR.H
 *
 * Purpose: Implements in the callable procedure manhattan_hausd()
 *   the hausdorff distance correlation stereo matching, using the
 *   manhattan distance.  Also a 2D global correlation method.
 *
 * This File: 
 *   -prototypes for procedures.
 *
 * Last Sanity Check: 950220.15
 *
 * See Also: correlation.c
 *
 * Copyright (c) 1995 Cornell University.  All Rights Reserved.
 ********************************************************************/


#ifndef HAUSD_COOR
#define HAUSD_COOR
#include "image.h"

/* PROTOTYPES*/
#define hausd_2d_wstor(a,b,c,d,e,f,g,h,i) _hausd_2d_wstor((a),(b),(c),(d),(e),(f),(g),(h),(double)2.0,(unsigned char)0,(i))

BinaryImage manhattan_dialate(BinaryImage inim, int border);
void manhattan_dilate_wstor(BinaryImage inim, BinaryImage *outim, 
			    BinaryImage *tempim, int delta);
GrayImage manhattan_haus(BinaryImage left, BinaryImage right, 
			 int width, int height, int range, 
			 int delta, int densify, int min_npoints);
float hausd_2d(BinaryImage left, BinaryImage right, 
	       int rangeX, int rangeY, int delta,
	       int *rX, int *rY, float *bestF, float *bestT);

void 
_hausd_2d_wstor(BinaryImage model, BinaryImage image, 
		BinaryImage modelD,BinaryImage imageD,
		int rangeX, int rangeY,
		double *forwardPtr, double *reversePtr,
		double earlyThr, unsigned char quitEarly,
		int *modelNpts);

float 
hausd_2d_decide(double *forward, double *reverse,
		int rangeX, int rangeY,
		int *rX, int *rY, float *bestF, float *bestT);
BinaryImage
edgeDiff(BinaryImage model, BinaryImage image,
	 BinaryImage modelD, BinaryImage imageD,
	 int rangeX, int rangeY, 
	 int dispX, int dispY);
void resolveEdges(BinaryImage model, BinaryImage image,
		  BinaryImage modelD, BinaryImage imageD,
		  FloatImage modelMag, FloatImage imageMag,
		  int rangeX, int rangeY, int dispX, int dispY,
		  int dilX, int dilY, float *avg, BinaryImage *bimout,
		  FloatImage *fimout);
#endif
