Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef RASTER_EDGE_EVALUATOR_H
Toshihiro Shimizu 890ddd
#define RASTER_EDGE_EVALUATOR_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcg/tcg_sequence_ops.h"
Toshihiro Shimizu 890ddd
#include "tcg/tcg_polylineops.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//*************************************************************************
Toshihiro Shimizu 890ddd
//    Standard Raster Edge Evaluator
Toshihiro Shimizu 890ddd
//*************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  \brief This class implements an evaluator for tcg's sequential reduction algorithm
Toshihiro Shimizu 890ddd
  that can be used to simplify the borders extracted from a raster image under
Toshihiro Shimizu 890ddd
  a specified tolerance factor. This is typically used as a step in polygonal-based
Toshihiro Shimizu 890ddd
  image vectorization processes.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
\sa The tcg::sequence_ops::minimalPath() function.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
template <typename ranit=""></typename>
Toshihiro Shimizu 890ddd
class RasterEdgeEvaluator : public tcg::polyline_ops::StandardDeviationEvaluator<ranit></ranit>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	double m_tolerance; //!< Maximal distance of an edge from one of the
Toshihiro Shimizu 890ddd
						//!< points it approximates, in the Manhattan metric
Toshihiro Shimizu 890ddd
	double m_maxLength; //!< Maximal length of an acceptable edge length,
Toshihiro Shimizu 890ddd
	//!< in the standard metric
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	typedef typename tcg::polyline_ops::StandardDeviationEvaluator<ranit>::iterator_type iterator_type;</ranit>
Toshihiro Shimizu 890ddd
	typedef typename tcg::polyline_ops::StandardDeviationEvaluator<ranit>::point_type point_type;</ranit>
Toshihiro Shimizu 890ddd
	typedef typename tcg::polyline_ops::StandardDeviationEvaluator<ranit>::penalty_type penalty_type;</ranit>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	RasterEdgeEvaluator(const iterator_type &begin, const iterator_type &end,
Toshihiro Shimizu 890ddd
						double tolerance, double maxLength);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	iterator_type furthestFrom(const iterator_type &it);
Toshihiro Shimizu 890ddd
	penalty_type penalty(const iterator_type &a, const iterator_type &b);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif //RASTER_EDGE_EVALUATOR_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef INCLUDE_HPP
Toshihiro Shimizu 890ddd
#include "raster_edge_evaluator.hpp"
Toshihiro Shimizu 890ddd
#endif