如何在 OpenCV 中从分散点构建网格?
我需要的是在 OpenCV 中构建一个强度网格(图像),我可以从中提取一些轮廓。我已经用完整的数据网格解决了这个问题,但我的问题是地图上只有一些可用的分散点,我必须自己构建这个网格。 根据我从不同来源读到的内容,可行的方法是在散点上使用 Delaunay 三角测量。我已经在 OpenCV 中找到了一些构建这些三角形的函数,但我找不到如何使用这些数据来构建我所需的数据网格的方法。 如果 OpenCV 中还有其他更多帮助功能或使用我当前进度的方法,如果您能为我指出正确的方向,我将不胜感激。 谢谢。
What I need is to construct a intensity grid(image) in OpenCV from which I can extract some contours. I have already resolved this issue with a complete data grid, but my problem is that I will only have some scattered points available on the map and I will have to build this grid myself.
From what I've read from different sources the way to go is using Delaunay triangulation on the scattered points. I have already found some functions in OpenCV that build these triangles, but I can't find a way how to use this data to build my needed data grid.
If there are other more helping functions in OpenCV or a way to use my current progress, i would appreciate it if you can point me in the right direction.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,您可以使用 delaunay 三角剖分来提供插值点来填充之间的空图像点。这基本上就是使用 delaunay 渲染稀疏高度场时发生的情况。阅读重心坐标可能会有所帮助(因为这些坐标是您用来执行插值的坐标)。我刚刚查了一下,维基百科实际上有一个关于非结构化网格插值的部分,它基本上回答了如何将三角测量转换为插值网格。
不幸的是,我对 OpenCV 还不够熟悉,无法判断如果其中有任何捷径,但希望这能为您提供正确的搜索词以达到您想要的最终状态。粗略地猜测,由于 GPU 最初就是为了执行这一精确操作而设计的,因此应该可以在 GPU 上快速完成这一操作。
So, you could use the delaunay triangulation to give you the interpolating points to fill in the empty image points in between. This is basically what happens when you use delaunay to render a sparse height field. It may help to read up on barycentric coordinates (as those are the coordinates you would use to perform the interpolation). I just checked and Wikipedia actually has a section on interpolation on an unstructured grid that basically answers how to take the triangulation to the interpolated grid.
http://en.wikipedia.org/wiki/Barycentric_coordinate_system_(mathematics)#Interpolation_on_a_triangular_unstructured_grid
Unfortunately, I'm not familiar enough with OpenCV to tell you if there are any short cuts in there, but hopefully this gets you with the right search words to get to your desired end state. At a wild guess, since the GPU was originally made to do this exact operation, it should be possible to do this really stinking quickly on one.
比 Delaunay 更重要的是,我认为您需要一个 Voronoi 图:
您可以使用 OpenCV dilate 从每个开始生成它网格点,并为每个强度(或扩张步骤)使用不同的颜色。
More than Delaunay, I think you need a Voronoi diagram:
You can generate it using OpenCV dilate starting from each point of your grid, and using different colors for each intensity (or dilate step).