计算深度图像的局部三元模式
Calculating the Local Ternary Pattern of an depth image
我在 Calculating the Local Ternary Pattern of an image? 上找到了局部三元模式 (LTP) 的详细信息和实现。我想问更多细节,选择阈值 t
的最佳方法是什么,而且我在理解 reorder_vector = [8 7 4 1 2 3 6 9];
的作用时也很困惑
不幸的是,没有一个很好的方法来确定使用 LTP 的阈值是多少。这主要是反复试验或通过实验。但是,我可以建议使阈值自适应。您可以使用 Otsu's algorithm to dynamically determine the best threshold of your image. This is assuming that the distribution of your intensities in the image is bimodal. In other words, there is a clear separation between objects and background. MATLAB has an implementation of this by the graythresh
函数。但是,这会生成一个介于 0 和 1 之间的阈值,因此您需要将结果乘以 255,假设您的图像类型为 uint8
.
因此,做:
t = 255*graythresh(im);
im
是您要计算 LTP 的图像。现在,我当然可以深入了解 reorder_vector
正在做什么。 LTPs的计算方式请看下图:
(来源:hindawi.com)
我们在生成三元码矩阵(中间的矩阵)的时候,需要生成一个8元素的序列,不包括邻域的中间。我们从最东面的元素(第 2 行,第 3 列)开始,然后按逆时针顺序遍历这些元素。 reorder_vector
变量允许您 select 那些遵守该顺序的特定元素。如果您还记得,MATLAB 可以使用列优先线性索引访问矩阵。具体来说,给定一个 3 x 3 矩阵,我们可以使用 1 到 9 之间的数字访问一个元素,内存布局如下:
1 4 7
2 5 8
3 6 9
因此,reorder_vector
的第一个元素是索引8,也就是最东边的元素。接下来是索引 7,它是右上角的元素,然后是索引 4,它是朝北的元素,然后是 1、2、3、6,最后是 9。
如果你按照这些数字,你将确定我是如何得到 reorder_vector
:
reorder_vector = [8 7 4 1 2 3 6 9];
通过使用此变量访问每个 3 x 3 局部邻域,我们将生成符合三元代码顺序的正确 8 元素序列,以便我们可以继续算法的下一阶段。
我在 Calculating the Local Ternary Pattern of an image? 上找到了局部三元模式 (LTP) 的详细信息和实现。我想问更多细节,选择阈值 t
的最佳方法是什么,而且我在理解 reorder_vector = [8 7 4 1 2 3 6 9];
不幸的是,没有一个很好的方法来确定使用 LTP 的阈值是多少。这主要是反复试验或通过实验。但是,我可以建议使阈值自适应。您可以使用 Otsu's algorithm to dynamically determine the best threshold of your image. This is assuming that the distribution of your intensities in the image is bimodal. In other words, there is a clear separation between objects and background. MATLAB has an implementation of this by the graythresh
函数。但是,这会生成一个介于 0 和 1 之间的阈值,因此您需要将结果乘以 255,假设您的图像类型为 uint8
.
因此,做:
t = 255*graythresh(im);
im
是您要计算 LTP 的图像。现在,我当然可以深入了解 reorder_vector
正在做什么。 LTPs的计算方式请看下图:
(来源:hindawi.com)
我们在生成三元码矩阵(中间的矩阵)的时候,需要生成一个8元素的序列,不包括邻域的中间。我们从最东面的元素(第 2 行,第 3 列)开始,然后按逆时针顺序遍历这些元素。 reorder_vector
变量允许您 select 那些遵守该顺序的特定元素。如果您还记得,MATLAB 可以使用列优先线性索引访问矩阵。具体来说,给定一个 3 x 3 矩阵,我们可以使用 1 到 9 之间的数字访问一个元素,内存布局如下:
1 4 7
2 5 8
3 6 9
因此,reorder_vector
的第一个元素是索引8,也就是最东边的元素。接下来是索引 7,它是右上角的元素,然后是索引 4,它是朝北的元素,然后是 1、2、3、6,最后是 9。
如果你按照这些数字,你将确定我是如何得到 reorder_vector
:
reorder_vector = [8 7 4 1 2 3 6 9];
通过使用此变量访问每个 3 x 3 局部邻域,我们将生成符合三元代码顺序的正确 8 元素序列,以便我们可以继续算法的下一阶段。