首页 > 其他分享 >Halcon Tuple数组的增删查改

Halcon Tuple数组的增删查改

时间:2024-10-11 14:48:40浏览次数:13  
标签:disp 20 Tuple text dev Halcon window 查改 black

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

相关文章

  • Halcom与C#窗口应用联合问题一:DLL“halcon”:找不到指定的模块。
     问题如下:原因是:        如果你在解决方案资源管理器中的引用下添加了halcondotnet.dll文件,有可能在工具箱下没有自动添加。在工具箱项里面没有HWindowControl工具。解决方法如下:                1.在工具箱中右击任何一个工具,然后点击......
  • C# Tuple 元组详解
         Tuple即元组,是C#中的一种数据结构,用于将多个值组合成一个对象。自C#7.0起,元组在语言中得到了更好的支持,并且提供了比以前更丰富的功能。今天花点时间整理下Tuple元组的用法:元组的概念:    元组是一种轻量级的数据结构,它允许将多个值组合成一个......
  • 【MX-J3-T3+】Tuple+ 题解
    一个比较自然的思路就是对于每个三元组\((u_i,v_i,w_i)\),把\((v_i,w_i)\)这个二元组放在属于\(u_i\)的vector里面。然后对于每一个\(i\in[1,n-3]\),把\(i\)的vector里面的所有二元组\((x,y)\)当作一条连接\(x,y\)的无向边,则我们的目的是在图中找出所有的三元环\(......
  • 【C#】Halcon显示图像(读文件路径、缓存、创建空白图像)
    publicHTuplehv_ExpDefaultWinHandle;//输入图像宽高Int64Input_Image_Width=0,Input_Image_Height=0;///<summary>///加载图像///</summary>///<paramname="type">类型,0:内存地址;1:文件路径;2:图像;3:空白图像</param>///......
  • 题解:P10998 Tuple+
    \(\text{Link}\)有意思,记录一下。题意给出\(m\)个互不相同的无序三元组\((u,v,w)\),求有多少无序四元组\((a,b,c,d)\)使得三元组\((a,b,c),(a,b,d),(a,c,d),(b,c,d)\)均存在。\(m\le3\times10^5\)。Bonus:\(m\le2\times10^6\)。题解回忆无向图三元环计数的做法,使......
  • 兼收并蓄 TypeScript - 基础: tuple
    源码https://github.com/webabcd/TypeScriptDemo作者webabcd兼收并蓄TypeScript-基础:tuple示例如下:basic\tuple.ts{//tuple-元组leta:[string,number]=['webabcd',22];a[0]='wanglei';a[1]=44;console.log(a,a[0......
  • Halcon特征检测Region部分笔记
     Region'area':     面积'row':      中心的行坐标'column':   中心的列坐标'width':    区域的宽度(平行于坐标轴)'height':   区域的高度(平行于坐标轴)'row1':     左上角的行坐标'column1':  左上角的列坐标'row2':     ......
  • halcon的频域图像处理
    频率特征是图像的灰度变化特征,低频特征是灰度变化不明显,例如图像整体轮廓,高频特征是图像灰度变化剧烈,如图像边缘和噪声。一个重要的经验结论:低频代表图像整体轮廓,高频代表了图像噪声,中频代表图像边缘、纹理等细节。什么时候使用傅里叶变换进行频域分析?1、具有一定纹理特征的图像,......
  • 第5讲:Halcon 测量点线距离
    一、概述    点线距离测量在3D测量项目中处于基础地位,必须要掌握。以下为可直接运行的代码。二、效果        三、Halcon代码*初始化窗口dev_update_off()dev_close_window()dev_open_window(0,0,768,512,'black',WindowHandle)*给点的大小......
  • 题解:洛谷 P10996 【MX-J3-T3】Tuple
    原题链接介绍一种(也许是正解的)卡常做法先说总体思路:对于每个三元组\((x,y,z)\),若有一个\(w\)满足\((x,y,w),(x,z,w),(y,z,w)\)均存在,则找到了一个合法的四元组\((x,y,z,w)\)。\(20\\rm{Pts}\)做法如果暴力搜索,在遍历每一个三元组时,每一次都扫描所有的\(w\in[1,N]\)......