Topological peak detection in twodimensional data
A simple Python implementation of the 0th dimensional persistent homology for 2D images. It is basically a twodimensional version of the method described in my blog article persistent topology for peak detection.
The implementation uses a unionfind data structure instead of the more efficient implemention used for onedimensional data. The unionfind data structure implementation was taken from PADS and sligthly modified.
The related literature is Computational Topology by Herbert Edelsbrunner.^{1}
Update: A related paper on this topic appeared at iDSC2020.
Download
The current version is available on git.sthu.org.
Demonstration
The code has been used for answers to the following two stackoverflow questions:
An ipython notebook is included in the git repository to demonstrate the code. Assume we are given the input of the first stackoverflow question:
Then the 0th dimensional persistence diagram looks like this:

H. Edelsbrunner and J. Harer, Computational Topology. An Introduction, 2010, ISBN 0821849255. ↩