No description or website provided.
Clone or download
mholusa Merge pull request #1 from geordi/bibtex
Added BibTeX reference
Latest commit 4e71270 Nov 22, 2018

k-max Distance

The k-max distance for images and graphs. The repository contains the source code of the k-max distance and also three samples how to use it.


  • c++ std11
  • opencv


    cmake .
The distance computed in images using Image structure
The distance computed in images using C arrays
The distance computed in graphs using Graph structure

In all the examples, the function compute is used for the k-max distance computing.
This function requires the Image structure (main.cpp), Graph structure (main3.cpp), or arrays with the edge costs in x and y directions (main2.cpp). In addition, the array of source nodes, the number of source nodes, and the destination point (if a negative value is used, the distance is computed to all the image nodes and the distance to the destination node is returned) are required. The function returns the distance to the destination point. Optionally, the distance transform (the negative value of destination point is required), the shortest path, and the maximum vector that gives the distance can be returned from the function.


Michael Holuša, Eduard Sojka, The k-max distance in graphs and images, In Pattern Recognition Letters, Volume 98, 2017, Pages 103-109, ISSN 0167-8655, (


title = {The k-max distance in graphs and images},
author = {Michael Holuša and Eduard Sojka},
journal = {Pattern Recognition Letters},
volume = {98},
pages = {103 - 109},
year = {2017},
issn = {0167-8655},
doi = {},
url = {},
keywords = "Distance measuring, Shortest path, -max distance, Geodesic distance, Image processing, Image segmentation",