fbx 骨架_骨架修剪

fbx 骨架

Skeletons can be viewed as a compact representation of a binary image. Skeletons obtained using medial axis transform or thinning algorithm can produce spurious branches and may lead to an inaccurate representation of the image. For example, the research that I am conducting (“Autonomous segmentation and quantification of pavement cracks”) requires an accurate skeleton representation of a crack to quantify the length and width of a crack.

骨骼可以看作是二进制图像的紧凑表示。 使用中间轴变换或细化算法获得的骨骼可能产生虚假分支,并可能导致图像的不正确表示。 例如,我正在进行的研究(“路面裂缝的自动分割和量化”)要求准确地表示裂缝的骨架,以量化裂缝的长度和宽度。

After searching through the web, I was surprised that there is no module readily available to import for such a widely needed tool. Hence, this article is meant to provide an explanation of the skeleton pruning algorithm adapted from the paper “Skeleton pruning as trade-off between skeleton simplicity and reconstruction error” [1].

在网上搜索后,令我感到惊讶的是,对于如此广泛需要的工具,没有模块可立即导入。 因此,本文旨在提供对骨架修剪算法的解释,该算法适用于论文“骨架修剪作为骨架简单性与重构误差之间的折衷” [1]。

Ideally, skeleton S should contain no spurious branches and provide the best reconstruction using the distance transform matrix. However, removing spurious branches lead to a skeleton that is unable to reconstruct to the original binary image. Hence, this algorithm searches for a skeleton that balances between reconstruction error and skeleton simplicity. The results of the algorithm are shown below in Figure 1.

理想情况下,骨架S应该不包含任何虚假分支,并使用距离变换矩阵提供最佳重构。 但是,删除虚假分支会导致无法重建为原始二进制图像的骨架。 因此,该算法搜索在重构误差和骨架简单性之间取得平衡的骨架。 该算法的结果如图1所示。

Image for post
Figure 1: Crack detected by using a segmentation algorithm. Binary image (left), skeleton image produced by Medial Axis Transform (middle), pruned skeleton (right).
图1:使用分段算法检测到的裂纹。 二进制图像(左),由中间轴变换产生的骨架图像(中),修剪的骨架(右)。

权衡量化 (Trade-off Quantification)

For any given shape denoted by “D”, we would like to obtain a skeleton “S” where it should: (1) The skeleton S should contain no spurious branches.(2) The skeleton S provides the best reconstruction of the given shape.

对于用“ D”表示的任何给定形状,我们希望在以下位置获得骨架“ S”:(1)骨架S不应包含任何虚假分支。(2)骨架S提供给定形状的最佳重构。

In reality, there seems to be a tug of war between the two requirements, where removing spurious branches leads to an increased reconstruction error. Hence, the algorithm seeks a solution where the skeleton is as simple as possible while trying to minimize the reconstruction error. Feldman and Singh proposed that the most likely skeleton for any shape is given by maximizing P(S|D) [2]. By Baye’s rule, p(S|D) can be described by Equation (1).

实际上,这两个要求之间似乎有些拉锯战,删除虚假分支会导致重建错误增加。 因此,该算法寻求一种解决方案,其中,在尝试使重建误差最小的同时,骨骼要尽可能简单。 Feldman和Singh提出通过最大化P(S | D)来给出任何形状的最可能骨架[2]。 根据贝叶规则,p(S | D)可以用公式(1)描述。

Image for post
Equation (1): The most likely skeleton can be found by maximizing p(S|D).
等式(1):可以通过最大化p(S | D)来找到最可能的骨架。

The probability P(S) over the shape D is intended to measure the complexity of the skeleton. Intuitively, the shorter the skeleton, the simpler it is. Hence, Equation (2) and Equation (3) to calculate P(S) and P(D|S).

形状D上的概率P(S)用于测量骨骼的复杂性。 凭直觉,骨架越短,它越简单。 因此,用等式(2)和等式(3)来计算P(S)和P(D | S)。

Image for post
Equation (2): Proposed equation to calculate P(S).
等式(2):提议的等式用于计算P(S)。
Image for post
Equation (3): Proposed equation to calculate P(D|S).
公式(3):提出的公式用于计算P(D | S)。

Where 𝐴(·), 𝑅(·), and 𝐿(·) represent area measured by pixels, reconstructed binary image, and average curve length of the skeleton. Substituting Equation (2) and Equation (3) to Equation (1) results in the following equation:

𝐴(·),𝑅(·)和𝐿(·)表示以像素,重构二值图像和骨架的平均曲线长度测得的面积。 将公式(2)和公式(3)替换为公式(1)得出以下公式:

Image for post
Equation (4): Result of substituting Equation (2) and Equation (3) into Equation (1)
公式(4):将公式(2)和公式(3)代入公式(1)的结果

Applying negative natural log on both sides, simplify the above equation to:

在两端应用负自然对数,将以上等式简化为:

Image for post
Equation (5): Applying natural log on Equation (4)
公式(5):在公式(4)上应用自然对数

Hence, minimizing Equation (5) is the same as maximizing Equation (1).

因此,使式(5)最小化与使式(1)最大化相同。

Before pruning the branches off from the skeleton, each branch emanating from the main branch denoted by E is assigned a weight. The weights of each branch is calculated with Equation (6). The superscript “i” represents the number of iterations the algorithm has iterated, and the subscript “j” represents the number of branches emanating from the “i-th” skeleton.

在从骨骼修剪掉分支之前,将从E表示的主要分支中发出的每个分支都分配有权重。 每个分支的权重由公式(6)计算。 上标“ i”表示算法已迭代的迭代次数,下标“ j”表示从“第i”个骨架发出的分支数。

Image for post
Equation (6): The weights calculated for each branch emanating from the main branch.
等式(6):为从主分支发出的每个分支计算的权重。

The constant alpha is calculated using the equation below:

常数alpha使用以下公式计算:

Image for post
Equation (7): The constant β is assigned to a value of 9.
等式(7):常数β分配为值9。

The constant 𝛽 is set to 9, W(M) denotes the average length of branches, and M denotes the original skeleton before the pruning process begins. After assigning a weight to every branch found in the i-th skeleton, the branch with the minimum weight is removed from the skeleton. This process is repeated until all the branches have been removed from the skeleton. The best skeleton is selected with the lowest score calculated with Equation (5).

常数𝛽设置为9,W(M)表示分支的平均长度,M表示修剪过程开始之前的原始骨架。 在为第i个骨架中找到的每个分支分配权重后,将从骨架中删除权重最小的分支。 重复此过程,直到所有分支都已从骨架中移除。 选择最佳骨架,并用等式(5)计算出最低分数。

Image for post
Equation (8): Selecting the best skeleton S to represent shape D.
公式(8):选择最佳骨架S来表示形状D。

框架修剪算法的伪代码 (Pseudocode of skeleton pruning algorithm)

(1) Initialize S = M, S = {S}.(2) While The number of end branches is larger than 2.(3) Let P be the set of endpoints of S and {E} be the set of end branches of S.(4) For l ∈ L(5) Compute the weights of end branches(6) End(7) Remove the end branch with the minimum weight(8) Append the skeleton with the removed branch into the array S.(9) End(10) Pick the skeleton S with the lowest score calculated with Equation (5).

(1)初始化S = M,S = {S}。(2)虽然端的分支数是大于2(3)设P为集合S的端点和{E}是集合端分支的(4)对于l∈L(5)计算末端分支的权重(6)末端(7)移除权重最小的末端分支(8)将具有移除的分支的骨架附加到数组S中。 9)结束(10)选择具有等式(5)计算的最低分数的骨架S。

优点缺点 (Pros & Cons)

Pros:(1) Pruning algorithm does not require a fixed threshold value.

优点:(1)修剪算法不需要固定的阈值。

Cons:(1) Memory intensive as all the skeletons have to be stored before deciding which is the best.

缺点:(1)占用大量内存,因为在确定最佳骨架之前必须存储所有骨架。

例子 (Examples)

Below I have included some examples of pruned skeleton produced by the algorithm:

下面,我提供了该算法生成的一些修剪后的骨架示例:

Image for post
Figure 1
图1
Image for post
Figure 2
图2
Image for post
Figure 3
图3
Image for post
Figure 4
图4
Image for post
Figure 5
图5

结论 (Conclusion)

This algorithm finds a balance between the reconstruction of an image using its skeleton and skeleton simplicity. The algorithm doesn’t prune all the branches but it does remove them significantly. I hope this pruning method may be beneficial to anyone who’s reading this.

该算法在使用其骨架的图像重建与骨架简单性之间找到平衡。 该算法不会修剪所有分支,但会显着删除它们。 我希望这种修剪方法对阅读本文的任何人都可能有益。

The implementation is not the best as the algorithm takes quite some time to process the branches. Feedback will be greatly appreciated.

实现不是最好的,因为算法需要花费一些时间来处理分支。 反馈将不胜感激。

The implementation can be found here:

可以在这里找到实现:

翻译自: https://medium.com/@jeremyunderscore/skeleton-pruning-448b57cb3d0

fbx 骨架

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值