distance.hh File Reference
`#include <vector>`
`#include <algorithm>`
`#include <limits>`
`#include <iterator>`
`#include <mia/core/defines.hh>`
Include dependency graph for core/distance.hh:

Go to the source code of this file.

## Functions

void EXPORT_CORE | distance_transform_inplace (std::vector< float > &r)
template<typename InputIterator, typename OutputIterator>
void | distance_transform_prepare (InputIterator in_begin, InputIterator in_end, OutputIterator out_begin, bool to_mask)

## Function Documentation

## distance_transform_inplace()

void EXPORT_CORE distance_transform_inplace | ( | std::vector< float > & | r | ) |

This function evaluates the 1D distance transform of an input function. If the input function is given as raw data that is not the result of another call to this distance transform function, then one should call distance_transform_prepare to properly prepare the data for the distance transform.

Parameters

  [in,out] | r | at input the squared values of the function to evaluate the distance to at output it contains the squared distances.

References EXPORT_CORE.

## distance_transform_prepare()

template<typename InputIterator, typename OutputIterator>

void distance_transform_prepare | ( | InputIterator | in_begin,
|  | InputIterator | in_end,
|  | OutputIterator | out_begin,
|  | bool | to_mask )

This function evaluates prepares data for the use in a distance transform. The input values are interpreted differently depending on the input data type: If the values are given as boolean values then it is assumed that they belong to a mask, and at each location x where f(x)==true, the function is assumed to be zero, and at each f(x)==false the function is assumed to be inf+ (given as numeric_limits<float>::max()). Otherwiese the values are interpreted directly, and the preparation for the dist-transform consists in evaluating the square of each value

Template Parameters

  InputIterator | input data iterator
  OutputIterator | output data iterator

Parameters

  in_begin | start of the input data range
  in_end | end of the input data range
  out_begin | begin of the output data container, note that the output container must at least hold as many values as the input data range provides. This is not tested.
  to_mask | set to true if the input data is a mask, to false if the input data is a height field

Definition at line 62 of file core/distance.hh.