确定弯曲的细长区域的中线 [英] Determine the midline of a bent, elongated region

查看:128
本文介绍了确定弯曲的细长区域的中线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个热狗的二维图像。我可以在两端之间的热狗上画一条直线。称这是中线。其中一个属性是(2D)热狗的惯性矩最低的轴。

现在,如果我弯曲热狗的弧度,这中线也会扭曲。

给出一张弯曲的热狗照片,我怎么能确定这个弯曲的中线?该算法应该能够容忍图像中适量的噪声。

解决方案

如果我明白你的问题,你需要一个穿过你的对象的线,每个点都在对象的中间,如果你从中线的任何一点开始沿垂直于中线的方向行走,你必须在两个方向上走相同的距离,直到你遇到物体的边界为止:



(这是只是一个例证 - 可能不是几何上正确的中线!)

我的快速和肮脏的解决方案将从一个中间轴开始(可以很容易地从第一个和第二个通过取这条线上的每个点并在该点上找到与当前方向垂直的线上最近的边界点,并将点移动到这两个点的几何中心:





如果你对每个点都做了这个,你应该对中线有一个更好的近似值。

我说这很快又很脏,因为我不确定是否简单地重复这个过程总是收敛到一个稳定的解决方案。这可能取决于你如何计算弯曲和扭结中线的垂直方向。

解决这个问题的方法之一是使用更灵活的模型:


  • 计算物体内部的距离变换(每个点到最近边界点的距离)

    $ b

    通过最大化距离转换图像的路径积分的对象查找平滑线: https://i.stack.imgur.com/szie0.pngalt =距离变换>



    要找到这条线,我会使用类似的算法到活动轮廓/蛇:


    • 从中间轴开始
    • 对每个点应用两个力:


      • 一个力按距离变换的梯度方向推该线(即远离最近的边界)
      • 另一种力量对抗蛇的伸展和弯曲,所以在没有明确的距离变换梯度的情况下,它保持光滑的形状。 (谷歌的主动轮廓 - 这是相当标准的简历的东西,你会发现很多关于它的好文章。)


    • 重复直到收敛或达到某个固定的迭代极限


      您需要为曲线的这些平滑度调整一些参数积极的轮廓),但是你得到一个定义良好,行为良好的近似的机会要远远好于上面的简单方法。


      Imagine I have the two dimensional image of a hotdog. I can draw a straight line on the hotdog between its two ends. Call this the midline. One of its properties is that it is the axis about which the (2D) hotdog has the lowest moment of inertia.

      Now if I bend the hotdog in an arc, this midline will also distort.

      Given a picture of the bent hotdog, how can I determine this bent midline? The algorithm should tolerate a modest amount of noise in the image.

      解决方案

      If I understand your question, you want a line through your object where every point is in the middle of the object, i.e. if you start from any point on the midline and walk in a direction perpendicular to the midline, you have to walk the same distance in both directions until you meet the border of the object:

      (this is just an illustration - probably not the geometrically correct midline!)

      My quick&dirty solution would be to start with a middle axis (that can easily be calculated from first and second-order moments) and refine it by taking each point on this line and find the nearest border points on a line perpendicular to the current direction at that point, and move the point to the geometric center of these two points:

      If you do this for every point, you should get a better approximation for the midline.

      I said this was quick&dirty, because I'm not sure if simply repeating this procedure always converges to a stable solution. It probably depends on how you calculate the perpendicular direction of the midline in the presence of bends and kinks.

      One way around this is to use a more physically-inspired model:

      • Calculate a distance transform for the inside of your object (the distance of each point to the closest border point)
      • Find a smooth line through the object that maximizes the path integral of the distance transform image:

      To find this line, I would use an algorithm similar to active contours/snakes:

      • Start with the middle axis
      • Apply two forces to each point:
        • One force "pushes" the line in the direction of the gradient of the distance transform (i.e. away from the closest border)
        • The other force counters the stretching and bending of the snake, so it keeps a smooth shape where there is no clear distance transform gradient. (Google for active contour - this is fairly standard CV stuff, you'll find lots of good articles about it.)
      • Repeat until convergence or some fixed iteration limit is reached

      You'll need to adjust a few parameters for these smoothness of the curve (as always with active contours), but your chances to get a well-defined and well-behaved approximation are far better than with the simple approach above.

      这篇关于确定弯曲的细长区域的中线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆