read_image (Image33, 'E:/Halcon数据/资源图片/33.png')
dev_get_window (WindowHandle)
dev_set_draw ('margin')
get_image_size (Image33, Width, Height)
query_font (WindowHandle, Font)
FontWithSize := Font[0]+'-30'
set_font (WindowHandle, FontWithSize)
增加
NewT=T1+T2
1,T=[T1+T2]
2,tuple_concat(T1,T2,T)
T:=[2.7,4.1,9.5]
T1:=[2,4,9]
T2:=[T,T1]
tuple_concat (T, T1, Concat)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (T1, 'window', 100, 220, 'black', [], [])
dev_disp_text ('T1', 'window', 20, 220, 'black', [], [])
dev_disp_text (T2, 'window', 100, 420, 'black', [], [])
dev_disp_text ('T2', 'window', 20, 420, 'black', [], [])
dev_disp_text ( Concat, 'window', 100, 620, 'black', [], [])
dev_disp_text (' Concat', 'window', 20, 620, 'black', [], [])
3,tuple_union(T1,T2,T)
tuple_union (T, T1, Union)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (T1, 'window', 100, 220, 'black', [], [])
dev_disp_text ('T1', 'window', 20, 220, 'black', [], [])
dev_disp_text (Union, 'window', 100, 420, 'black', [], [])
dev_disp_text ('Union', 'window', 20, 420, 'black', [], [])
删除
1,按索引删除
tuple_remove (OldT, Index, NewT)
T:=[2.7,4.1,9.5]
Index:=1
tuple_remove (T, Index, NewT)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (Index, 'window', 100, 220, 'black', [], [])
dev_disp_text ('Index', 'window', 20, 220, 'black', [], [])
dev_disp_text (NewT, 'window', 100, 420, 'black', [], [])
dev_disp_text ('NewT', 'window', 20, 420, 'black', [], [])
2,tuple_uniq移除数组中相同的元素,需要搭配排序使用
T:=[2.7,4.1,9.5,2.7]
tuple_sort (T, NewT)
tuple_uniq (NewT, Uniq)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (NewT, 'window', 100, 220, 'black', [], [])
dev_disp_text ('NewT', 'window', 20, 220, 'black', [], [])
dev_disp_text (Uniq, 'window', 100, 420, 'black', [], [])
dev_disp_text ('Uniq', 'window', 20, 420, 'black', [], [])
查找
1.tuple_find( : : 元组, ToFind : 索引)
T:=[5.55,2,3,11,12,32]
T1:=[3]
tuple_find (T, T1, Indices)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (T1, 'window', 100, 220, 'black', [], [])
dev_disp_text ('T1', 'window', 20, 220, 'black', [], [])
dev_disp_text ( Indices, 'window', 100, 420, 'black', [], [])
dev_disp_text (' Indices', 'window', 20, 420, 'black', [], [])
2,tuple_find_first( : : 元组, ToFind : 索引)
T:=[5.55,2,3,11,3,32,5.55,2,3,11,12]
T1:=[3]
tuple_find_first (T, T1, Index)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (T1, 'window', 100, 220, 'black', [], [])
dev_disp_text ('T1', 'window', 20, 220, 'black', [], [])
dev_disp_text (Index, 'window', 100, 420, 'black', [], [])
dev_disp_text (' Index', 'window', 20, 420, 'black', [], [])
3,tuple_find_last( : : 元组, ToFind : 索引)
T:=[5.55,2,3,11,3,32,5.55,2,3,11,12]
T1:=[3]
tuple_find_last (T, T1, Index1)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (T1, 'window', 100, 220, 'black', [], [])
dev_disp_text ('T1', 'window', 20, 220, 'black', [], [])
dev_disp_text (Index1, 'window', 100, 420, 'black', [], [])
dev_disp_text (' Index1', 'window', 20, 420, 'black', [], [])
4,tuple_first_n( : : 元组,索引 : 选定)
T:=[5.55,2,3,11,3,32,5.55,2,3,11,12]
Index2:=3
tuple_first_n (T, Index2, Selected)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (Index2, 'window', 100, 220, 'black', [], [])
dev_disp_text ('Index2', 'window', 20, 220, 'black', [], [])
dev_disp_text (Selected, 'window', 100, 420, 'black', [], [])
dev_disp_text (' Selected', 'window', 20, 420, 'black', [], [])
修改
tuple_replace (元组,索引, 替换, Replaced)
T:=[5.55,2,3,11,3,32,5.55,2,3,11,12]
Index2:=0
ReplaceTuple:=[22]
tuple_replace (T, Index2, ReplaceTuple, Replaced)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (Index2, 'window', 100, 220, 'black', [], [])
dev_disp_text ('Index2', 'window', 20, 220, 'black', [], [])
dev_disp_text (ReplaceTuple, 'window', 100, 420, 'black', [], [])
dev_disp_text ('ReplaceTuple', 'window', 20, 420, 'black', [], [])
dev_disp_text ( Replaced, 'window', 100, 620, 'black', [], [])
dev_disp_text (' Replaced', 'window', 20, 620, 'black', [], [])
排序
tuple_sort 由小到大
T:=[5.55,2,3,11,3,32,5.55,2,3,11,12]
tuple_sort (T, Sorted)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (Sorted, 'window', 100, 220, 'black', [], [])
dev_disp_text ('Sorted', 'window', 20, 220, 'black', [], [])
反序
tuple_inverse[正序,倒序]
T:=[5.55,2,3,11,3,32,5.55,2,3,11,12]
tuple_inverse (T, Inverted)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (Inverted, 'window', 100, 220, 'black', [], [])
dev_disp_text ('Inverted', 'window', 20, 220, 'black', [], [])
数组大小
tuple_length (T, Number)
T:=[5.55,2,3,11,3,32]
tuple_length (T, Length)
dev_display (Image33)
dev_disp_text (T, 'window', 100, 20, 'black', [], [])
dev_disp_text ('T', 'window', 20, 20, 'black', [], [])
dev_disp_text (Length, 'window', 100, 220, 'black', [], [])
dev_disp_text ('Length', 'window', 20, 220, 'black', [], [])
生成指定数组
tuple_gen_const(长度,元,数组)
tuple_gen_const (Length, C, Newtuple)
dev_display (Image33)
dev_disp_text (Length, 'window', 100, 20, 'black', [], [])
dev_disp_text ('Length', 'window', 20, 20, 'black', [], [])
dev_disp_text (C, 'window', 100, 220, 'black', [], [])
dev_disp_text ('C', 'window', 20, 220, 'black', [], [])
dev_disp_text ( Newtuple, 'window', 100, 420, 'black', [], [])
dev_disp_text (' Newtuple', 'window', 20, 420, 'black', [], [])
tuple_rand(长度,数组)
生成一个0-1的数组
Length:=4
tuple_rand (Length, Rand)
dev_display (Image33)
dev_disp_text (Length, 'window', 100, 20, 'black', [], [])
dev_disp_text ('Length', 'window', 20, 20, 'black', [], [])
dev_disp_text (Rand, 'window', 100, 220, 'black', [], [])
dev_disp_text ('Rand', 'window', 20, 220, 'black', [], [])
标签:disp,20,Tuple,text,dev,Halcon,window,查改,black
From: https://blog.csdn.net/2202_75557553/article/details/142843733