Openimaj将多边形从Voronoi中移出

时间:2019-06-05 14:51:19

标签: openimaj

看这个例子:

https://github.com/jonhare/COMP6208/blob/master/app/src/main/java/uk/ac/soton/ecs/comp6208/l2/KMeansDemo.java#L252

上面的行是:

    final List<Line2d> lines = Voronoi.computeVoronoiEdges(java.util.Arrays.asList(centroids), image.getWidth(),
            image.getHeight());

我添加了另一行:

    final Graph<Point2d, DefaultEdge> graph = Voronoi.computeVoronoiGraph(java.util.Arrays.asList(centroids), image.getWidth(),
            image.getHeight());

但这与:

Exception in thread "Thread-0" java.lang.IllegalArgumentException: no such vertex in graph
    at org.jgrapht.graph.AbstractGraph.assertVertexExist(Unknown Source)
    at org.jgrapht.graph.AbstractBaseGraph.addEdge(Unknown Source)
    at org.openimaj.math.geometry.triangulation.Voronoi.computeVoronoiGraph(Voronoi.java:88)
    at uk.ac.soton.ecs.comp3204.l2.KMeansDemo.drawVoronoi(KMeansDemo.java:260)

有什么想法为什么会打破?

我的高级目标是从上述任何一种方法(或者如果使用上述方法是错误的方法,则从任何其他方法)的输出中获取多边形(而不是线)。正确的方法是什么?

0 个答案:

没有答案