/*********************************************************************
 * This file is part of the PRAPI library.
 *
 * Copyright (C) 2001 Topi Mäenpää and Jaakko Viertola
 * All rights reserved.
 *
 * This program is free software. You can redistribute and/or modify
 * it under the terms of the free software licence found in the
 * accompanying file "COPYING". The licence terms must always be
 * redistributed with this source file. The above copyright notice
 * must be reproduced in all modified and unmodified copies of this
 * source file.
 *
 * $Revision: 1.1 $
 *********************************************************************/

#include "../ProximityMeasure.h"

namespace prapi { namespace extras {

	/**
	 * A proximity measure represented in "Jain A and Healey G (1998) A
	 * Multiscale Representation Including Opponent Color Features for
	 * Texture Recognition. IEEE Trans. on Image Proc. 7(1):124-128. In
	 * short, this measure is a squared Euclidean distance scaled with
	 * feature variances.
	 **/
	class JHDistance : public ProximityMeasure<double>
	{
	public:
		/**
		 * Create a new "Jain and Healey" type distance measure. This
		 * measure needs a set of samples at initialization because it
		 * needs to calculate the variance of each feature.
		 *
		 * @param allSamples the samples between which distances are calculated
		 **/
		JHDistance(const util::List<Sample<double> >& allSamples);

		double getProximity(const util::List<double>& sample, const util::List<double>& model,
												double stopAfter = MAXDOUBLE) const	throw (ProximityException&);

	private:
		util::List<double> _lstVarVector;
	};

	/**
	 * A proximity measure represented in "Manjunath B.S. and Ma W.Y
	 * (1996) Texture Features for Browsing and Retrieval of Image data.
	 * IEEE PAMI 18(8):837-842." In short, this measure is a city block
	 * distance scaled with the standard deviation of each feature.
	 **/
	class MMDistance : public ProximityMeasure<double>
	{
	public:
		/**
		 * Create a new "Manjunath and Ma" type distance measure. This
		 * measure needs a set of samples at initialization because it
		 * needs to calculate the standard deviation of each feature.
		 *
		 * @param allSamples the samples between which distances are calculated
		 **/
		MMDistance(const util::List<Sample<double> >& allSamples);

		double getProximity(const util::List<double>& sample, const util::List<double>& model,
												double stopAfter = MAXDOUBLE) const	throw (ProximityException&);

	private:
		util::List<double> _lstStdVector;
	};
	
}}
