halcon中tuple的一些操作

******====tuple取奇数/偶数索引值
*1.创建奇数/偶数索引tuple
tuple_gen_sequence (0, |Rows1|-1, 2, Sequence1)
tuple_gen_sequence (1, |Rows1|-1, 2, Sequence2)
*2.根据索引选出对应数据
tuple_select (Rows1, Sequence1, Selected1)
tuple_select (Rows1, Sequence2, Selected2)

****tuple数组比较值
*1.创建与需要对比tuple相同元素数量的tuple
tuple_gen_const (|Rows1|-1, gap_z, Newtuple)
*2.对比大小
greater:=D_grayval[>]Newtuple
*3.选出需要值的索引
tuple_find (greater, 0, Indices)

****剔除重复数据

tuple_uniq (Rows, Uniq)

*******string转int

tuple_strchr (str_bmp2, '0', Position1)   //查找某个字符的位置
tuple_strlen (str_bmp2, Length1)  //字符串长度
tuple_substr (str_bmp2, Position1+1, Length1-1, Substring) //字符串分割
tuple_number (Substring, Number1)  //string转int

*****2.选出相邻X,距离小于2的点
        Selected_ccc:=[1,2,3,4,7,10,11,12,13,18,19]
        ccc1:=Selected_ccc[0:|Selected_ccc|-2]
        ccc2:=Selected_ccc[1:|Selected_ccc|-1]
        ccc:=ccc2-ccc1
        tuple_less_equal_elem (ccc, 2, Lesseq)
        tuple_find (Lesseq, 1, Indices2)
        idx_all:=[Indices2,Indices2+1]
        tuple_sort (idx_all, Sorted1)    //*排序
        tuple_uniq (Sorted1, Uniq1)      //*去重
        tuple_select (Selected_ccc, Uniq1, Selected)   //*找出值

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值