halcon命令中文注解.docx
《halcon命令中文注解.docx》由会员分享,可在线阅读,更多相关《halcon命令中文注解.docx(17页珍藏版)》请在冰豆网上搜索。
![halcon命令中文注解.docx](https://file1.bdocx.com/fileroot1/2023-1/4/751e92d6-e95d-4355-acf2-7202fb9b8d7c/751e92d6-e95d-4355-acf2-7202fb9b8d7c1.gif)
halcon命令中文注解
read_image(WaferDies,'wafer_dies')
read_image(图片在程序中的名称,'图片在计算机中的名称')
reopen_window_fit(WaferDies,700,0,0,WindowHandle)
reopen_window_fit(图片在程序中的名称,700,0,0,WindowHandle)
init_font(WindowHandle,-1,2)
和字体有关的一个命令
get_window_extents(WindowHandle,_,_,WindowWidth,WindowHeight)
设置窗口大小和位置
dev_update_all('off')
把所有的dev_update从'on'设到'off',这似乎是设定文本显示的滚动与否
dev_set_draw('margin')
定义区域填充模式。
如果DrawMode设置为'fill',输出地区被填满,如果设置为'margin',只有轮廓显示出来。
get_image_pointer1(WaferDies,_,_,Width,Height)
get_image_pointer1(Image:
:
:
Pointer,Type,Width,Height)
Accessthepointerofachannel.
Theoperatorget_image_pointer1returnsapointertothefirstchanneloftheimageImage.Additionally,theimagetype(Type='byte','int2','uint2',etc.)andtheimagesize(widthandheight)arereturned.Consequently,adirectaccesstotheimagedataintheHALCONdatabaseviathepointerispossiblefromtheprogramminglanguageinwhichHALCONisused.AnimageisstoredinHALCONlinearizedinrowmajororder,i.e.,linebyline.
指令get_image_pointer1返回一个图像WaferDies的第一通道的指针。
此外,图像类型(Type='byte','INT2','uint2'等)和图像尺寸(宽度和高度)返回。
因此,直接通过访问指针来获取HALCON的数据库中的图像数据,在使用了HALCON语言的程序中是可行的。
图像在HALCON以线性行模式存储,也就是一行一行的。
dev_display(WaferDies)
在活动图形窗口显示一个图像对象(图像,地区或XLD)。
这相当于对一个窗口内的变量变双击图标。
write_message(WindowHandle,-1,-1,'Imageofawafer',true)
write_message(WindowHandle,WindowHeight-30,-1,'Press\'Run\'tocontinue',true)
在窗口上写文字
stop()
停止
*
*1.Determinethesizeofthediesbyusingautocorrelation确定大小用自相关
*
rft_generic(WaferDies,ImageFFT,'to_freq','none','complex',Width)
rft_generic(Image:
ImageFFT:
Direction,Norm,ResultType,Width:
)
rft_generic用于计算快速傅立叶变换输入图像的形象。
相反,fft_generic,fft_image和fft_image_inv,一个事实,即在正向输入图像变换是实值图像(即不是一个复杂的图像)使用。
在这种情况下,复杂的输出图像具有冗余。
在图像的右半部分的值是在图像的左半部分的相应值的复共轭。
因此,运行时和可节省内存仅计算和存储的复杂图像的左半边。
与resultType参数可用于指定结果的图像类型逆变换(方向='from_freq')。
在正变换(方向='to_freq'),与resultType必须设置为'complex'。
参数方向确定是否应进行变换到频域空间域或进入回来。
为方向='to_freq'输入图像必须有一个实数型,即一个复杂的图像可能无法用作输入。
所有图片,可以变成一个真正的图像类型转换类型的支持。
在这种情况下,输出是一个尺寸(W/2+1)*H,其中W和H是宽度和高度复杂的图像输入图像。
在这种模式下,指数-1用于变换(见fft_generic)。
为方向='from_freq',输入图像必须是复杂的。
在这种情况下,输入图像的大小不足以决定输出图像的大小。
这必须通过设置宽度为一个有效的值,即2*的W-2或2*的W-1,其中W是复杂的图像的宽度。
在这种模式下,指数1用于在变换。
正火因子可设置规范,并且可以利用的量,'none','sqrt'和'n'。
用户必须确保参数相一致。
这意味着,用于规范因素向前和向后转换必须宽*h时产量成倍增加。
correlation_fft(ImageFFT,ImageFFT,CorrelationFFT)
correlation_fft(ImageFFT1,ImageFFT2:
ImageCorrelation:
:
)
correlation_fft计算了傅立叶变换在频域输入图像的相关性。
其相关的计算方法是乘以的ImageFFT2复共轭ImageFFT1。
应当指出,为了实现在空间域的相关性的正确比例,经营者fft_generic或Norm='none'必须用于正变换和fft_generic或rft_generic与Norm='n'为rft_generic逆变换。
如果ImageFFT1和ImageFFT2含有相同数量的图像,相应的图像相关成对。
否则,ImageFFT2只能包含一个单一的形象。
在这种情况下,为每一个相关性的ImageFFT1与ImageFFT2形象。
rft_generic(CorrelationFFT,Correlation,'from_freq','n','real',Width)
*Excludelocalmaximaattheimageborder.Itissufficient
*toextractthemaximaintheupperleftquarteroftheimagebecause
*theautocorrelationisanevenfunction.
排除局部极大值在图像边界。
它足以在上提取图像的左边季度极大,因为自相关是偶函数。
gen_rectangle1(Rectangle,1,1,Height/2,Width/2)
gen_rectangle1(:
Rectangle:
Row1,Column1,Row2,Column2:
)
Createarectangleparalleltothecoordinateaxes.
Theoperatorgen_rectangle1generatesoneormorerectanglesparalleltothecoordinateaxeswhicharedescribedbytheupperleftcorner(Row1,Column1)andthelowerrightcorner(Row2,Column2).Morethanoneregioncanbecreatedbypassingatupleofcornerpoints.Thecoordinatesystemrunsfrom(0,0)(upperleftcorner)to(Width-1,Height-1).Seeget_systemandreset_obj_dbinthiscontext.
创建一个矩形平行于坐标轴。
操作员gen_rectangle1生成一个或多个矩形平行于坐标是由左上角(Row1,Column1)和右下角(Row2,Column2)中所述轴。
一个以上的地区可以通过创建一个元组的角点。
系统运行的坐标从(0,0)(左上角)至(宽度-1,身高-1)。
看到这方面get_system和reset_obj_db。
reduce_domain(Correlation,Rectangle,CorrelationReduced)
reduce_domain(Image,Region:
ImageReduced:
:
)
Reducethedomainofanimage.
Theoperatorreduce_domainreducesthedefinitiondomainofthegivenimagetotheindicatedregion.Thenewdefinitiondomainiscalculatedastheintersectionoftheolddefinitiondomainwiththeregion.Thus,thenewdefinitiondomaincanbeasubsetoftheregion.Thesizeofthematrixisnotchanged.
降低图像的领域。
操作员reduce_domain减少了给定图像的定义域到指定的区域。
新的定义域是计算为与该地区的旧定义域的交集。
因此,新的定义域可以是该地区的一个子集。
矩阵的大小是没有改变。
*
*Extractthelocalmaximaoftheautocorrelationfunction
提取的自相关函数的局部极大值
local_max_sub_pix(CorrelationReduced,'gauss',2,5000000,Row,Col)
local_max_sub_pix(Image:
:
Filter,Sigma,Threshold:
Row,Col)
Subpixelprecisedetectionoflocalmaximainanimage.
local_max_sub_pixextractslocalmaximafromtheimageImagewithsubpixelprecision.Todoso,ineachpointtheinputimageisapproximatedbyaquadraticpolynomialinxandyandsubsequentlythepolynomialisexaminedforlocalmaxima.Thepartialderivatives,whicharenecessaryforsettingupthepolynomial,arecalculatedeitherwithvariousGaussianderivativesorusingthefacetmodel,dependingonFilter.Inthefirstcase,SigmadeterminesthesizeoftheGaussiankernels,whileinthesecondcase,beforebeingprocessedtheinputimageissmoothedbyaGaussianwhosesizeisdeterminedbySigma.Therefore,'facet'resultsinafasterextractionattheexpenseofslightlylessaccurateresults.ApointisacceptedtobealocalmaximumifbotheigenvaluesoftheHessianmatrixaresmallerthan-Threshold.Theeigenvaluescorrespondtothecurvatureofthegrayvaluesurface.
亚像素精确的检测图像中的局部最大值。
local_max_sub_pix提取物与亚像素精度的图像Image局部极大值。
为此,在每个点的输入图像近似为二次多项式在x和y以及随后的多项式是局部最大值检查。
偏导数,这是设立多项式必要的,是计算出来的各种衍生工具或使用高斯面模型筛选而定。
在第一种情况下,适马决定了高斯核的大小,而在第二种情况下,在所处理的输入图像是由高斯,其大小是由西格玛确定平滑。
因此,在一个不太准确的结果稍快费用提取'面'的结果。
一个点是接受的,如果是本地最大的Hessian矩阵特征值均小于门限。
特征值对应的灰度值表面曲率。
*
*Getthesizeofthedies
*Findmaximumthatisclosesttotheorigin.Thismaximum
*correspondstotheoppositerectanglecornerofthedie.
获取大小的模具。
查找最大值最接近原点。
对应于这个最大的模具矩形对面角落。
distance_pp(gen_tuple_const(|Row|,0),gen_tuple_const(|Col|,0),Row,Col,Distance)
distance_pp(:
:
Row1,Column1,Row2,Column2:
Distance)
Calculatethedistancebetweentwopoints.
Theoperatordistance_ppcalculatesthedistancebetweenpairsofpointsaccordingtothefollowingformula:
Distance=sqrt((Row1-Row2)^2+(Column1-Column2)^2)
TheresultisreturnedinDistance.
计算两点之间的距离。
经营者之间的distance_pp计算按下列公式点对距离:
距离=开方((第ROW1-ROW2行)^2+(column1的-COLUMN2列)^2)的结果是在距离返回。
tuple_gen_const(:
:
Length,Const:
Newtuple)
Generateatupleofaspecificlengthandinitializeitselements.
tuple_gen_constgeneratesanewtupleinNewtuple.TheinputparameterLengthdeterminesthenumberofelementsforthenewtuple.ThusLengthmayonlyconsistofasinglenumber.IfLengthcontainsafloatingpointnumber,thismayonlyrepresentanintegervalue(withoutfraction).ThedatatypeandvalueofeachelementofthenewgeneratedtupleisdeterminedbytheinputparameterConstthatmayonlyconsistofasingleelement.AllelementsinNewtuplehavegotthesamedatatypeandvalueasthesingleelementinConst.
生成元组的一个特定的长度和初始化它的元素.
tuple_gen_const生成一个Newtuple新的tuple。
输入参数的长度决定的元素为新的元组数目。
因此长度可能只包含一个数字。
如果长度包含一个浮点数,这可能仅仅代表一个整数(无分数)。
数据类型和新产生的每个元组元素的值是由输入参数常量,可能只包含一个元素。
在Newtuple所有元素都得到了相同的数据类型作为常量单一元素和价值。
SortedIndex:
=sort_index(Distance)
tuple_sort_index(:
:
Tuple:
Indices)
Sortstheelementsofatupleandreturnstheindicesofthesortedtuple.
tuple_sort_indexsortsallelementsofTupleinascendingorderandreturnstheindicesoftheelementsofthesortedtuple(inrelationtotheinputtupleTuple)withIndices.AsapreconditionthesingleelementsofTuplemustbecomparable.ThusTuplemusteitherexclusivelyconsistofstringsoritmustonlycontain(integerorfloatingpoint)numbers.Inthelattercaseintegersandfloatingpointnumbersmaybemixed.
排序的元素,并返回一个元组的元组的排序指标。
tuple_sort_index升序所有元组元素,并返回该元素的元组指数的排序与指数(有关输入元组元组)。
作为一个先决条件的元组的单一元素必须具有可比性。
因此,元组必须要么完全由字符串或它必须只包含(整数或浮点)号码。
在后一种情况整数和浮点数可以混合使用。
Row1:
=Row[SortedIndex[0]]
Col1:
=Col[SortedIndex[0]]
DiagonalLength:
=sqrt(Row1*Row1+Col1*Col1)
tuple_sqrt(:
:
T:
Sqrt)
Computethesquarerootofatuple.
tuple_sqrtcomputesthesquarerootoftheinputtupleT.Thesquarerootisalwaysreturnedasafloatingpointnumber.Thesquarerootofastringisnotallowed.
计算一个元组的平方根。
tuple_sqrt计算输入元组T的平方根是始终作为一个浮点数返回平方根。
字符串的平方根是不允许的。
Phi:
=atan2(Row1,Col1)
tuple_atan2(:
:
Y,X:
ATan)
Computethearctangentofatupleforallfourquadrants.
tuple_atan2computesthearctangentoftheinputtuplesY/Xwhiletreatingallfourquadrantscorrectly.Thearctangentisalwaysreturnedasafloatingpointnumber.Thearctangentofastringisnotallowed.
计算一个元组所有四个象限反正切。
tuple_atan2计算输入的反正切值组是/X,同时正确地对待所有四个象限。
总是返回的反正切为浮点数。
字符串的反正切值是不允许的。
DieWidth:
=DiagonalLength*cos(Phi)
DieHeight:
=DiagonalLength*sin(Phi)
*
*Thecenter,thefirstmaximum,andthesecondmaximum
*togetherdefinetheorientationandthesizeofthedies.
该中心的第一个最大,第二个最大的共同定义的方向和大小的模具。
dev_set_color('blue')
dev_set_color(:
:
ColorName:
)
Setoneormoreoutputcolors.
dev_set_colordefinesthecolorsforregionandlineorientedoutputinthegraphicswindows.Theavailablecolorscanbequeriedwiththeoperatorquery_color.The“colors”'black'and'white'areavailableforallscreens.Ifcolorsareusedthatarenotdisplayableonthescreen,HALCONcanchooseasimilar,displayablecoloroftheoutput.Forthis,set_check(:
:
'~color':
)mustbecalled.
Thedefinedcolorsareuseduntildev_set_colorordev_set_colorediscalled.
Colorsaredefinedforallgraphicswindowsincontrasttotheoperatorset_color.
Attention
Ifdev_set_colorshouldbeusedforexportedCode(C++),pleasenotethedescriptionofset_colorduetothedifferentsemanticsinC++.
设置一个或多个输出的色