《halcon命令中文注解.doc》由会员分享,可在线阅读,更多相关《halcon命令中文注解.doc(17页珍藏版)》请在文库网上搜索。
1、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_upda
2、te_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 )Access the pointer of a channel.The operator get_image_poin
3、ter1 returns a pointer to the first channel of the image Image. Additionally, the image type (Type = byte, int2, uint2, etc.) and the image size (width and height) are returned. Consequently, a direct access to the image data in the HALCON database via the pointer is possible from the programming la
4、nguage in which HALCON is used. An image is stored in HALCON linearized in row major order, i.e., line by line.指令get_image_pointer1返回一个图像WaferDies的第一通道的指针。此外,图像类型(Type =byte,INT2,uint2等)和图像尺寸(宽度和高度)返回。因此,直接通过访问指针来获取HALCON的数据库中的图像数据,在使用了HALCON语言的程序中是可行的。图像在HALCON以线性行模式存储,也就是一行一行的。dev_display (WaferDi
5、es)在活动图形窗口显示一个图像对象(图像,地区或XLD)。这相当于对一个窗口内的变量变双击图标。write_message (WindowHandle, -1, -1, Image of a wafer, true)write_message (WindowHandle, WindowHeight - 30, -1, Press Run to continue, true)在窗口上写文字stop ()停止* * 1. Determine the size of the dies by using auto correlation 确定大小用自相关* rft_generic (WaferDie
6、s, ImageFFT, to_freq, none, complex, Width)rft_generic ( Image : ImageFFT输出量 : Direction, Norm, ResultType, Width : )rft_generic用于计算快速傅立叶变换输入图像的形象。相反,fft_generic,fft_image和fft_image_inv,一个事实,即在正向输入图像变换是实值图像(即不是一个复杂的图像)使用。在这种情况下,复杂的输出图像具有冗余。在图像的右半部分的值是在图像的左半部分的相应值的复共轭。因此,运行时和可节省内存仅计算和存储的复杂图像的左半边。与res
7、ultType参数可用于指定结果的图像类型逆变换(方向=from_freq)。在正变换(方向=to_freq),与resultType必须设置为complex。参数方向确定是否应进行变换到频域空间域或进入回来。为方向=to_freq输入图像必须有一个实数型,即一个复杂的图像可能无法用作输入。所有图片,可以变成一个真正的图像类型转换类型的支持。在这种情况下,输出是一个尺寸(W / 2 +1)* H,其中W和H是宽度和高度复杂的图像输入图像。在这种模式下,指数-1用于变换(见fft_generic)。为方向=from_freq,输入图像必须是复杂的。在这种情况下,输入图像的大小不足以决定输出图像的
8、大小。这必须通过设置宽度为一个有效的值,即2 *的W - 2或2 *的W - 1,其中W是复杂的图像的宽度。在这种模式下,指数1用于在变换。正火因子可设置规范,并且可以利用的量,none, sqrt和n。用户必须确保参数相一致。这意味着,用于规范因素向前和向后转换必须宽* h时产量成倍增加。correlation_fft (ImageFFT, ImageFFT, CorrelationFFT)correlation_fft ( ImageFFT1, ImageFFT2 : ImageCorrelation : : )correlation_fft计算了傅立叶变换在频域输入图像的相关性。其相关的
9、计算方法是乘以的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, Wi
10、dth)#在这里创建并输出了Correlation* Exclude local maxima at the image border. It is sufficient* to extract the maxima in the upper left quarter of the image because* the autocorrelation is an even function.排除局部极大值在图像边界。它足以在上提取图像的左边季度极大,因为自相关是偶函数。gen_rectangle1 (Rectangle, 1, 1, Height/2, Width/2)#在这里创建并输出了Re
11、ctanglegen_rectangle1 ( : Rectangle : Row1, Column1, Row2, Column2 : )Create a rectangle parallel to the coordinate axes.The operator gen_rectangle1 generates one or more rectangles parallel to the coordinate axes which are described by the upper left corner (Row1, Column1) and the lower right corne
12、r (Row2, Column2). More than one region can be created by passing a tuple of corner points. The coordinate system runs from (0,0) (upper left corner) to (Width-1,Height-1). See get_system and reset_obj_db in this context. 创建一个矩形平行于坐标轴。操作员 gen_rectangle1生成一个或多个矩形平行于坐标是由左上角(Row1, Column1)和右下角 (Row2, C
13、olumn2)中所述轴。一个以上的地区可以通过创建一个元组的角点。系统运行的坐标从(0,0)(左上角)至(宽度- 1,身高- 1)。看到这方面get_system和reset_obj_db。reduce_domain (Correlation, Rectangle, CorrelationReduced)reduce_domain ( Image, Region : ImageReduced : : )Reduce the domain of an image.The operator reduce_domain reduces the definition domain of the giv
14、en image to the indicated region. The new definition domain is calculated as the intersection of the old definition domain with the region. Thus, the new definition domain can be a subset of the region. The size of the matrix is not changed.降低图像的领域。操作员reduce_domain减少了给定图像的定义域到指定的区域。新的定义域是计算为与该地区的旧定义
15、域的交集。因此,新的定义域可以是该地区的一个子集。矩阵的大小是没有改变。* * Extract the local maxima of the auto correlation function提取的自相关函数的局部极大值local_max_sub_pix (CorrelationReduced, gauss, 2, 5000000, Row, Col)local_max_sub_pix ( Image : : Filter, Sigma, Threshold : Row, Col )Subpixel precise detection of local maxima in an image.
16、local_max_sub_pix extracts local maxima from the image Image with subpixel precision. To do so, in each point the input image is approximated by a quadratic polynomial in x and y and subsequently the polynomial is examined for local maxima. The partial derivatives, which are necessary for setting up
17、 the polynomial, are calculated either with various Gaussian derivatives or using the facet model, depending on Filter. In the first case, Sigma determines the size of the Gaussian kernels, while in the second case, before being processed the input image is smoothed by a Gaussian whose size is deter
18、mined by Sigma. Therefore, facet results in a faster extraction at the expense of slightly less accurate results. A point is accepted to be a local maximum if both eigenvalues of the Hessian matrix are smaller than -Threshold. The eigenvalues correspond to the curvature of the gray value surface.亚像素
19、精确的检测图像中的局部最大值。 local_max_sub_pix提取物与亚像素精度的图像Image 局部极大值。为此,在每个点的输入图像近似为二次多项式在x和y以及随后的多项式是局部最大值检查。偏导数,这是设立多项式必要的,是计算出来的各种衍生工具或使用高斯面模型筛选而定。在第一种情况下,适马决定了高斯核的大小,而在第二种情况下,在所处理的输入图像是由高斯,其大小是由西格玛确定平滑。因此,在一个不太准确的结果稍快费用提取面的结果。一个点是接受的,如果是本地最大的Hessian矩阵特征值均小于门限。特征值对应的灰度值表面曲率。* * Get the size of the dies* Find
20、 maximum that is closest to the origin. This maximum* corresponds to the opposite rectangle corner of the die.获取大小的模具。查找最大值最接近原点。对应于这个最大的模具矩形对面角落。distance_pp (gen_tuple_const(|Row|,0)创建一个数组,长度为Row的长度,每个元素的值为0, gen_tuple_const(|Col|,0), Row, Col, Distance)distance_pp ( : : Row1, Column1, Row2, Column
21、2 : Distance )Calculate the distance between two points.The operator distance_pp calculates the distance between pairs of points according to the following formula: Distance = sqrt(Row1-Row2)2+(Column1-Column2)2)The result is returned in Distance. 计算两点之间的距离。经营者之间的distance_pp计算按下列公式点对距离:距离=开方(第ROW1 -
22、 ROW2行) 2 +(column1的- COLUMN2列) 2)的结果是在距离返回。tuple_gen_const ( : : Length, Const : Newtuple )Generate a tuple of a specific length and initialize its elements.tuple_gen_const generates a new tuple in Newtuple. The input parameter Length determines the number of elements for the new tuple. Thus Length
23、 may only consist of a single number. If Length contains a floating point number, this may only represent an integer value (without fraction). The data type and value of each element of the new generated tuple is determined by the input parameter Const that may only consist of a single element. All
24、elements in Newtuple have got the same data type and value as the single element in Const.生成元组的一个特定的长度和初始化它的元素. tuple_gen_const生成一个Newtuple新的tuple。输入参数的长度决定的元素为新的元组数目。因此长度可能只包含一个数字。如果长度包含一个浮点数,这可能仅仅代表一个整数(无分数)。数据类型和新产生的每个元组元素的值是由输入参数常量,可能只包含一个元素。在Newtuple所有元素都得到了相同的数据类型作为常量单一元素和价值。SortedIndex := sor
25、t_index从大到小排序,其序号为,1,2,3,4,0(Distance)tuple_sort_index ( : : Tuple : Indices )Sorts the elements of a tuple and returns the indices of the sorted tuple.tuple_sort_index sorts all elements of Tuple in ascending order and returns the indices of the elements of the sorted tuple (in relation to the inpu
26、t tuple Tuple) with Indices. As a precondition the single elements of Tuple must be comparable. Thus Tuple must either exclusively consist of strings or it must only contain (integer or floating point) numbers. In the latter case integers and floating point numbers may be mixed.排序的元素,并返回一个元组的元组的排序指标
27、。 tuple_sort_index升序所有元组元素,并返回该元素的元组指数的排序与指数(有关输入元组元组)。作为一个先决条件的元组的单一元素必须具有可比性。因此,元组必须要么完全由字符串或它必须只包含(整数或浮点)号码。在后一种情况整数和浮点数可以混合使用。Row1 := RowSortedIndex0第0个元素,最小的一个Col1 := ColSortedIndex0DiagonalLength := sqrt(Row1*Row1 + Col1*Col1)tuple_sqrt ( : : T : Sqrt )Compute the square root of a tuple.tuple_
28、sqrt computes the square root of the input tuple T. The square root is always returned as a floating point number. The square root of a string is not allowed.计算一个元组的平方根。 tuple_sqrt计算输入元组T的平方根是始终作为一个浮点数返回平方根。字符串的平方根是不允许的。Phi := atan2猜测可能是取角度(Row1,Col1)tuple_atan2 ( : : Y, X : ATan )Compute the arctan
29、gent of a tuple for all four quadrants.tuple_atan2 computes the arctangent of the input tuples Y/X while treating all four quadrants correctly. The arctangent is always returned as a floating point number. The arctangent of a string is not allowed.计算一个元组所有四个象限反正切。 tuple_atan2计算输入的反正切值组是/ X,同时正确地对待所有
30、四个象限。总是返回的反正切为浮点数。字符串的反正切值是不允许的。DieWidth := DiagonalLength * cos(Phi)DieHeight := DiagonalLength * sin(Phi)* * The center, the first maximum, and the second maximum* together define the orientation and the size of the dies.该中心的第一个最大,第二个最大的共同定义的方向和大小的模具。dev_set_color (blue)dev_set_color ( : : ColorNa
31、me : )Set one or more output colors.dev_set_color defines the colors for region and line oriented output in the graphics windows. The available colors can be queried with the operator query_color. The “colors” black and white are available for all screens. If colors are used that are not displayable
32、 on the screen, HALCON can choose a similar, displayable color of the output. For this, set_check(:color:) must be called.The defined colors are used until dev_set_color or dev_set_colored is called.Colors are defined for all graphics windows in contrast to the operator set_color.AttentionIf dev_set
33、_color should be used for exported Code (C+), please note the description of set_color due to the different semantics in C+. 设置一个或多个输出的色彩。 dev_set_color定义区域和图形化输出Windows行的颜色。可用的颜色可以查询与运营商query_color。 “颜色”黑和白是可用于所有的屏幕上。如果颜色使用的是屏幕上没有显示的,HALCON的可以选择一个类似的,输出显示的颜色。为此,set_check (:颜色的:)必须被调用。定义的颜色使用,直至dev_
34、set_color或dev_set_colored被调用。颜色定义为与此相反的操作set_color所有的图形窗口。注意如果dev_set_color出口代码应使用(C + +中),请记下set_color说明由于不同的语义在C + +。gen_cross_contour_xld (Crosses, Row, Col, 8, 0.785398)gen_cross_contour_xld ( : Cross : Row, Col, Size, Angle : )Generate one XLD contour in the shape of a cross for each input poin
35、t.gen_cross_contour_xld generates an XLD contour in the shape of a cross for each input point (Row,Col). Conceptually, the contour consists of two lines of length Size, which intersect exactly in the input point. Their orientation is determined by Angle. The cross is returned in Cross. If there are
36、multiple points to be processed, their coordinates must be passed as tuples.生成一个XLD在为每一个输入点十字形的轮廓。gen_cross_contour_xld产生在为每一个输入点(行,列)十字XLD轮廓。从概念上讲,外形由两条线的长度大小,在相交点的准确输入。他们的方向是确定的视角。跨跨中返回。如果有多个点进行处理,他们的坐标必须为元组通过。gen_ellipse_contour_xld (Circle, Row1, Col1, 0, 8, 8, 0, 6.28318, positive, 1.5)gen_elli
37、pse_contour_xld(:ContEllipse:Row,Column,Phi,Radius1,Radius2,StartPhi,EndPhi,PointOrder,Resolution:)Creation of an XLD contour corresponding to an elliptic arc.gen_ellipse_contour_xld creates one or more elliptic arcs or closed ellipses. Ellipses are specified by their center (Row, Column), the orien
38、tation of the main axis Phi, the length of the larger half axis Radius1, and the length of the smaller half axis Radius2. In addition to that, elliptic arcs are characterized by the angle of the start point StartPhi, the angle of the end point EndPhi, and the point order PointOrder along the boundar
39、y. Both angles refer to the coordinate system of the ellipse, i.e. relative to the main axis and in a mathematical positive direction. Thus, the two main poles correspond to the angles 0 and PI, the two minor poles to the angles PI/2 and 3*pi/2. To create a closed ellipse the values 0 and 2*PI (with
40、 positive point order) have to be passed to the operator. All angles Phi, StartPhi, EndPhi take arbitrary values and are mapped internally to the interval 0,2*PI. The resolution of the resulting contours ContEllipse is controlled via Resolution containing the maximum Euclidean distance between neigh
41、boring contour points.一个XLD轮廓对应一个椭圆弧.gen_ellipse_contour_xld创作创建一个或多个圆弧或椭圆封闭椭圆。由他们指定的椭圆形中心(Row, Column),该椭圆的主轴线沿Phi方向,规模较大的半轴Radius1的长度和较小的半主轴轴Radius2长度。除此之外,椭圆弧的特点是对角StartPhi起点,在终点EndPhi角,沿边界点顺序PointOrder。这两个角涉及到椭圆的坐标系统,即相对于主轴线,并在数学积极的方向。因此,这两个主极对应于角度0和PI,这两个极点的角度轻微的PI / 2和3 */ 2。要创建一个封闭的椭圆值0和2 *PI
42、(在正面点顺序)要传递给经营者。各个角度Phi, StartPhi, EndPhi 采取任意值,并映射到内部区间0,2 *PI。由此产生的ContEllipse是通过Resolution包含的最大的欧几里德空间距离控制轮廓点轮廓。dev_display (Correlation)dev_display ( Object : : : )Displays image objects in the current graphics window.dev_display displays an image object (image, region, or XLD) in the active gra
43、phics window. This is equivalent to a double click on an icon variable inside the variable window.AttentionIf dev_display should be used for exported Code (C+), please note the description of disp_obj due to the different semantics in C+.Parameters当前图形窗口中显示图像对象。dev_display在窗口中显示一个图形图像主动对象(图像,地区或XLD)
44、。这相当于在一个窗口内的变量变双击图标。 注意如果dev_display应注意对出口代码使用(C + +中),请记下disp_obj由于不同的语义描述,在C + +。 dev_display (Crosses)显示十字叉dev_display (Circle)显示椭圆dev_set_color (green)dev_display (Rectangle)显示矩形框write_message (WindowHandle, -1, -1, Autocorrelation, region of interest, and local maxima, true)write_message (Windo
45、wHandle, WindowHeight - 30, -1, Press Run to continue, true)stop ()* * Visualize the extracted size of the dies可视化提取图片大小gen_rectangle2_contour_xld (Die, Height/2, Width/2, 0, DieWidth/2, DieHeight/2)gen_rectangle2_contour_xld(:Rectangle : Row, Column, Phi, Length1, Length2 : )Create an XLD contour i
46、n the shape of a rectangle.gen_rectangle2_contour_xld creates one or more XLD contours in the shape of a rectangle with arbitrary orientation. The rectangle has the center (Row, Column), the orientation Phi, and the half edge lengths Length1 and Length2. The angle Phi must be given in radians and sp
47、ecifies the angle between the horizontal axis and the edge with the half length Length1 in the mathematically positive direction (counterclockwise). More than one XLD contour can be created by passing a tuple of rectangle parameters.创建一个矩形的形状XLD轮廓。gen_rectangle2_contour_xld中创建一个矩形形状任意方向的一个或多个XLD轮廓。该矩形的中心(Row, Column),方向Phi,半长边Length1 和Length2。Phi 角度必须以弧度,并指定之间的水平轴,与半长长度1在数学正方向(逆时针方向)边缘角。不止一个XLD轮廓可以通过创建一个矩形参数元组。reopen_window_fit (WaferDies, 700, 0, 0, WindowHandle)init_font (WindowHandle, -1, 2)dev_display (WaferDies)dev_set_color (blue)dev_display (Die)write_message (Window