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

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

问题描述

想象一下,我有一个热狗的二维图像.我可以在热狗的两端之间画一条直线.称之为中线.它的特性之一是它是(2D)热狗的转动惯量最小的轴.

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:

  • 计算对象内部的距离变换(每个点到最近边界点的距离)
  • 找到一条穿过物体的平滑线,使距离变换图像的路径积分最大化:

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

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

  • 从中轴开始
  • 对每个点施加两个力:
    • 一个力将线推"向距离变换的梯度方向(即远离最近的边界)
    • 另一种力抵消了蛇的拉伸和弯曲,因此它在没有明显距离变换梯度的情况下保持平滑的形状.(Google for active contour - 这是相当标准的简历内容,你会发现很多关于它的好文章.)

    您需要为曲线的这些平滑度调整一些参数(与活动轮廓一样),但您获得定义明确且表现良好的近似值的机会比使用上述简单方法要好得多.

    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天全站免登陆