多边形化像素化二维曲线
我有一堆像素化的二进制曲线(也就是说,如果曲线经过它,则像素为 1,否则为 0),并且我正在寻找一种可以返回能够很好地近似曲线的多边形链的算法。像素化曲线通常只有一个像素薄,并且它们是完全连接的。我为此查阅了一些文献,但我的主要问题似乎是我什至不知道曲线的端点在哪里。
有谁知道有什么算法可以在合理的时间内做到这一点?如果它有作用,我将在 MATLAB 中实现它。
I have a bunch of pixelated binary curves (that is, the pixel is 1 if the curve runs over it and 0 otherwise), and I'm looking for an algorithm that can return a polygonal chain that approximates the curve well. The pixelated curves are usually only a pixel thin, and they are completely connected. I've looked over some literature for this, but my main problem seems to be that I don't even know where the endpoints of my curves are.
Does anyone know of any algorithms that can do this in a reasonable amount of time? If it makes a difference, I'll be implementing this in MATLAB.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试查看活动轮廓算法(或蛇,如果您愿意)。
http://en.wikipedia.org/wiki/Active_contour_model
它将尝试找到局部最优的多边形,基于分数图像。当曲线转动时,它会自动处理线段长度。由于您已经有了带有曲线的二值图像,因此该部分应该可以正常工作。它并不完全适合您的问题,因为它通常设计用于处理闭合轮廓。但是,我认为它无论如何都可能有效(只需关闭曲线末端之间的多边形)或者可以进行调整。如果你的曲线非常接近,它可能不会工作,因为它会寻找局部最小值并且很容易被卡住。
它不是那么快,并且需要适当的初始化。如果它们始终完全连接,您可能最好自己逐步完成它们,但这可能意味着从头开始。
您可以从可用的工具箱开始(还有很多其他工具箱):
http://www.mathworks.com/matlabcentral/fileexchange/11643-active -轮廓工具箱
You might try looking at the Active Contours algorithm (or Snakes, if you prefer).
http://en.wikipedia.org/wiki/Active_contour_model
It will try to find a locally optimal polygon, based on a score image. It will automatically deal with line segment length as the curve turns. Since you already have a binary image with your curves, that part should work well. It is not exactly suited to your problem, as it is usually designed to work with closed contours. However, I think it might work anyway (simply closing the polygon between the ends of the curves) or could be adapted. If your curves are very close together, it will probably not work as it seeks out local minimums and will easily get stuck.
It is not that fast, and requires decent initialization. If they are always completely connected, you might be better off stepping through them yourself, but that would probably mean starting from scratch.
You could start with an available toolbox (there are plenty of others):
http://www.mathworks.com/matlabcentral/fileexchange/11643-active-contour-toolbox