相关疑难解决方法(0)

估计由一组点(Alpha形状??)生成的图像区域

我在一个显示2D图像的示例ASCII文件中有一组点. 在此输入图像描述 我想估计这些点填充的总面积.在这个平面内有一些地方没有被任何点填满,因为这些区域已经被掩盖了.我认为估计该区域可能是实用的将是应用凹形船体alpha形状.我尝试了这种方法来找到合适的alpha值,并因此估计面积.

from shapely.ops import cascaded_union, polygonize
import shapely.geometry as geometry
from scipy.spatial import Delaunay
import numpy as np
import pylab as pl
from descartes import PolygonPatch
from matplotlib.collections import LineCollection
def plot_polygon(polygon):
    fig = pl.figure(figsize=(10,10))
    ax = fig.add_subplot(111)
    margin = .3
    x_min, y_min, x_max, y_max = polygon.bounds
    ax.set_xlim([x_min-margin, x_max+margin])
    ax.set_ylim([y_min-margin, y_max+margin])
    patch = PolygonPatch(polygon, fc='#999999',
                         ec='#000000', fill=True,
                         zorder=-1)
    ax.add_patch(patch)
    return fig
def alpha_shape(points, alpha):
    if len(points) < 4:
        # …
Run Code Online (Sandbox Code Playgroud)

python scipy computer-vision shapely concave-hull

8
推荐指数
2
解决办法
2335
查看次数

标签 统计

computer-vision ×1

concave-hull ×1

python ×1

scipy ×1

shapely ×1