如何检测一维测量阵列上的模式
How to detect patterns on a 1D array of measurements
我正在为需要跟随一条线的机器人开发 IA 算法。地板是黑色的,有一条白线,并且会有不同的标记来确定不同类型的"obstacles"。我使用的传感器可以提供 8 个地板测量值的数组,如图 1 所示,它可以提供从 0 到 1000 的 8 个测量值数组,其中 0 没有白色,1000 是全白。在下面的例子中是对传感器阵列中间的白线和其他情况的测量。
int array[] = {50, 24, 9, 960, 1000, 150, 50, 45} // white line in the middle
int array2[] = {50, 24, 9, 960, 1000, 150, 50, 960} // white line in the middle and a square box on the right
int array3[] = {1000, 24, 9, 960, 1000, 150, 50, 40} // white line in the middle and a square box on the left
int array4[] = {1000, 980, 950, 0, 10, 980, 1000, 960} // black square box in the middle
算法我可以用来检测下面图像中给定的测量数组的模式吗?我不想使用多个 "hardcoded" 条件作为模板,因为我认为它不会很好地扩展。我正在考虑实施 "peak counter" 算法,但我不知道它是否足够稳健。
在图上我们可以看到不同的情况,我要检测的是红圈的情况。
谢谢!
如何做一些简单的事情,比如将每个测量值视为一个 N 维向量。在你的情况下 N=8。然后,所有测量值都包含在边长为 1000 的 hypercube 中。对于 N=8 将有 256 个角.对于您感兴趣的每个案例,将最匹配的超立方体角关联起来。请注意,某些角可能不会关联。然后,对于每个测量,找到其最近的关联超立方角。这告诉你它是哪种情况。您可以通过实施一些检查来减少错误。例如,如果测量值接近多个角(在某个不确定性阈值内),则您将测量值标记为不明确并跳过它。
对于 3 次测量的情况更容易看出这一点。立方体的8个角可以代表
[0,0,0] = no white
[0,0,1] = white on right
[0,1,0] = white in middle
[0,1,1] = white in middle and right
[1,0,0] = white on left
[1,0,1] = white on left and right
[1,1,0] = white on left and middle
[1,1,1] = all white
下图是中间的模糊测量
(来源:ctralie.com)
我正在为需要跟随一条线的机器人开发 IA 算法。地板是黑色的,有一条白线,并且会有不同的标记来确定不同类型的"obstacles"。我使用的传感器可以提供 8 个地板测量值的数组,如图 1 所示,它可以提供从 0 到 1000 的 8 个测量值数组,其中 0 没有白色,1000 是全白。在下面的例子中是对传感器阵列中间的白线和其他情况的测量。
int array[] = {50, 24, 9, 960, 1000, 150, 50, 45} // white line in the middle
int array2[] = {50, 24, 9, 960, 1000, 150, 50, 960} // white line in the middle and a square box on the right
int array3[] = {1000, 24, 9, 960, 1000, 150, 50, 40} // white line in the middle and a square box on the left
int array4[] = {1000, 980, 950, 0, 10, 980, 1000, 960} // black square box in the middle
算法我可以用来检测下面图像中给定的测量数组的模式吗?我不想使用多个 "hardcoded" 条件作为模板,因为我认为它不会很好地扩展。我正在考虑实施 "peak counter" 算法,但我不知道它是否足够稳健。
在图上我们可以看到不同的情况,我要检测的是红圈的情况。
谢谢!
如何做一些简单的事情,比如将每个测量值视为一个 N 维向量。在你的情况下 N=8。然后,所有测量值都包含在边长为 1000 的 hypercube 中。对于 N=8 将有 256 个角.对于您感兴趣的每个案例,将最匹配的超立方体角关联起来。请注意,某些角可能不会关联。然后,对于每个测量,找到其最近的关联超立方角。这告诉你它是哪种情况。您可以通过实施一些检查来减少错误。例如,如果测量值接近多个角(在某个不确定性阈值内),则您将测量值标记为不明确并跳过它。
对于 3 次测量的情况更容易看出这一点。立方体的8个角可以代表
[0,0,0] = no white
[0,0,1] = white on right
[0,1,0] = white in middle
[0,1,1] = white in middle and right
[1,0,0] = white on left
[1,0,1] = white on left and right
[1,1,0] = white on left and middle
[1,1,1] = all white
下图是中间的模糊测量
(来源:ctralie.com)