FrankTheTank
FrankTheTank

Reputation: 1689

ConvexHull not accurate enough - alternatives?

I have a cluster consistent of about 25k points and I want to find the borders. It works with ConvexHull, but the result is that I only get about 19 coordinates as output. This is definitely too few.

Here is the sample code from the SciPy documentation. If you run it you can see that the number of points is very limited.

from scipy.spatial import ConvexHull
import numpy as np
import matplotlib.pyplot as plt

points = np.random.rand(50, 2)   # 30 random points in 2-D
hull = ConvexHull(points, incremental=False)

plt.plot(points[:,0], points[:,1], 'o')
for simplex in hull.simplices:
    plt.plot(points[simplex,0], points[simplex,1], 'r-')

plt.show()

enter image description here

Is it possible to get more points to increase the accuracy of the boarder? Or do I need a different code?

Upvotes: 3

Views: 2299

Answers (1)

nimish
nimish

Reputation: 4992

Well then your hull wouldn't be convex!

Try http://www.geosensor.net/papers/duckham08.PR.pdf for an algorithm that will attempt to get what you probably want, which is something that morally follows the "border" of the set of points.

You could also try alpha-shapes.

Upvotes: 4

Related Questions