Douglas-Peucker line simplification
Project description
DoPe
Douglas-Peucker line simplification (data reduction).
Reduces the number of points in a dataset, while preserving its most striking features.
The resulting dataset is a subset of the original dataset.
Similar algorithms are used e.g. when zooming on a geographical map. However, this type of algoithm is also useful for general data reduction, as an alternative to conventional filtering.
Currently we only offer a recursive implementation (depth-first), which may not be the most efficient. An iterative implementation may follow (breadth-first).
Installation
Normal installation:
pip install dope
With plot support (adds matplotlib
):
pip install dope[plot]
With development tools:
pip install dope[dev]
Example
from dope import DoPeR
import numpy
data_original = [
[0, 0], [1, -1], [2, 2], [3, 0], [4, 0], [5, -1], [6, 1], [7, 0]
]
dp = DoPeR(data=data_original)
# either use epsilon threshold (i.e. max. error w.r.t. normalized data)
data_simplified_eps = dp.simplify(epsilon=0.2)
# or use maximum recursion depth
data_simplified_depth = dp.simplify(max_depth=4)
# compare original data and simplified data in a plot
dp.plot()
Also see examples in tests.
References:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dopelines-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aed73b55692c7c0a3398e52c4b6fae2c71e6b34c3a9b7944b19488fa5eca56ad |
|
MD5 | 98904d14f3826b860a329a317909b248 |
|
BLAKE2b-256 | a57eac4cedc5e05f6a228015bafce750d80961bc534939ef3e91d499c31bd3d3 |