【问题标题】:Halcon - Sort tuple based on list of indicesHalcon - 根据索引列表对元组进行排序
【发布时间】:2020-09-07 16:57:15
【问题描述】:

我有 2 个元组,代表一个点坐标列表。我需要它们按行排序。以下代码对行元组进行排序,并返回一个新元组,其中包含它对元组排序所做的更改。现在我需要使用此信息以相同的方式对列元组进行排序。

tuple_sort_index (intersection_points_row, Indices)

索引现在包含:[1, 0, 5, 2, 4, 3]

所以我需要用这些值[730.5, 1200.15, 515.429, 670.778, 1330.5, 1473.4] 对intersection_points_col 进行排序,其顺序与上面元组中显示的顺序相同..

如何做到这一点?

【问题讨论】:

    标签: sorting tuples halcon


    【解决方案1】:
    Tuple := [730.5, 1200.15, 515.429, 670.778, 1330.5, 1473.4]
    Indices := [1, 0, 5, 2, 4, 3]
    
    ** Sorted
    Sorted := Tuple[Indices]
    
    ** Inverted
    tuple_inverse (Sorted, Inverted)
    

    【讨论】:

    • 非常感谢!!没想到您可以通过这种方式将索引传递给数组。
    猜你喜欢
    • 1970-01-01
    • 2017-06-06
    • 2018-07-08
    • 2021-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-26
    • 1970-01-01
    相关资源
    最近更新 更多