Shinya Kitaoka 810553
// #pragma once // could not use by INCLUDE_HPP
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
/*!
Shinya Kitaoka 120a6e
  \brief This class implements an evaluator for tcg's sequential reduction
Shinya Kitaoka 120a6e
algorithm
Toshihiro Shimizu 890ddd
  that can be used to simplify the borders extracted from a raster image under
Shinya Kitaoka 120a6e
  a specified tolerance factor. This is typically used as a step in
Shinya Kitaoka 120a6e
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>
Shinya Kitaoka 120a6e
class RasterEdgeEvaluator
Shinya Kitaoka 120a6e
    : public tcg::polyline_ops::StandardDeviationEvaluator<ranit> {</ranit>
Shinya Kitaoka 120a6e
  double m_tolerance;  //!< Maximal distance of an edge from one of the
Shinya Kitaoka 120a6e
                       //!< points it approximates, in the Manhattan metric
Shinya Kitaoka 120a6e
  double m_maxLength;  //!< Maximal length of an acceptable edge length,
Shinya Kitaoka 120a6e
                       //!< in the standard metric
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  typedef typename tcg::polyline_ops::StandardDeviationEvaluator<
Shinya Kitaoka 120a6e
      RanIt>::iterator_type iterator_type;
Shinya Kitaoka 120a6e
  typedef
Shinya Kitaoka 120a6e
      typename tcg::polyline_ops::StandardDeviationEvaluator<ranit>::point_type</ranit>
Shinya Kitaoka 120a6e
          point_type;
Shinya Kitaoka 120a6e
  typedef typename tcg::polyline_ops::StandardDeviationEvaluator<
Shinya Kitaoka 120a6e
      RanIt>::penalty_type penalty_type;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  RasterEdgeEvaluator(const iterator_type &begin, const iterator_type &end,
Shinya Kitaoka 120a6e
                      double tolerance, double maxLength);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  iterator_type furthestFrom(const iterator_type &it);
Shinya Kitaoka 120a6e
  penalty_type penalty(const iterator_type &a, const iterator_type &b);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#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