加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Halcon基本数据结构

(2015-08-25 08:04:05)
标签:

艾特视觉

艾特自动化

机器视觉

图像处理

自动化设备

分类: Halcon概念

转载自:http://blog.sina.com.cn/s/blog_442bfe0e0100yn4y.html


一.基本参数

HALCON有两种基本的数据型态:图像数据(iconic,例如影像)以及控制数据(control,例如 变量,整数,字符串,handle等等),(图形参数Iconic(image, region, XLD)与控制参数Control (string, integer, real, handle))。所有运算子的参数都是以相同的方式排列:输入图像,输 出图像,输入控制,输出控制。当然,并非所有的运算子都具有上列四类参数,不过参数排 列的次序依旧相同。每个运算子都有一个自我叙述接口,除了标准文件,还有参数类型,或是可用的数值,都可在联机操作时获得。计算过程中运算子的输入参数内容不会改变,仅有 的三个例外是set_grayval, overpaint_gray 以及overpaint_region。 开放的架构可以取得内部数据,以便和外部数据整合。在处理2D影像时需要用到的各 种数据结构像是影像(例如多频道影像),region,contours,tuples (一种数组)等等,都提供了一种快速有效的存取功能。关于这些低阶数据结构的说明,请参考Extension Package Programmer’sManual 之第四章。 至于程序语言中可用的数据型态或类别,请参阅HALCONProgrammer’s Guide.

影像

影像属于图像数据。影像中的主要部分是个别的频道,他们是由代表不同像元型态的灰阶值数组构成。每张影像都有其定义域(domain),代表影像中要处理的数据范围。这就成为所谓的region of interest (ROI),定义域本身就是一个HALCON的region,具有无比的弹性,例如从一个简单的矩形到任意形状。

像元资料

像元数据几乎可为任何型态,从8-bit灰阶到浮点数皆可。整数,从1到4bite。浮点数,或是compleximages 也可处理。此外,还包含了表现边缘方向或 是hue的特别数据型态。影像频道频道即是影像中某一个数据数组。影像可含有任意数目的频道。同一影像中的所有频道都有 相同的尺寸。最常见的影像是单频道的灰阶影像,或是三频道的彩色影像(例如RGB),多光 谱影像,或是多种纹理分类使用的影像。

 

Image Channel +Domain 像素点存放在Channel矩阵中,根据ROI来描述Image。

Image相关操作:

输入:从文件、从设备

生成:外部图像数据、空内存区域;

显示:disp_image()图像首通道灰度图;disp_color() 彩色图;disp_channel()某特定通道;disp_obj() 自动判别类别;

缩放:set_part() 设置显示区域;set_part_style() 设置显示参数;

说明:

(1)Multiple channels    //多通道图像,可以是灰度图像或RGB图像

(2)Arbitrary region of interest //ROI区域图像

(3)Multiple pixel types(byte, (u)int1/2/4,real, complex, direction,cyclic, vector_field)

byte, uint2        //灰度图像的标准编码

int1, int2         //Difference of two images or derivates with integer precision    int4      //两幅灰度图的频谱

direction           //图片边缘的梯度方向

real                //边缘提取及特定灰度值的轮廓

complex            //图片频率

cyclic             //Assigning one "gray"value to each color

vector_field      //连续图形的光学流分布

坐标系统

影像是以左上角为坐标原点(0,0)。每个像元是以row和column表示其坐标。坐标值的范围从(0,0)到(height-1,width-1)。每个像元的尺寸为1,第一个像元的中心坐标为(0,0),因此第一 个像元的范围是从(-0.5,-0,5) 到(0.5,0.5)。

Regions

以行列坐标形式储存,有广泛的应用,特点是高效,可利用同态算子。比如用阈值对图像分割的结果,其他系统中称为BOLB,AREA等。

Region属于图像数据。所谓region即是一堆像元的集合。但是他们的坐标范围不受影像大小的限制。region中的像元不一定要相连,也就是说任意形状的像元集合都可成为一个region,如果要让相连接的像元成为一个region,只要呼叫运算子connection 即可。由于region内的像元坐标范围并非受限于某张影像,region可大于影像范围,例如进行region扩张运算时就有可能会超过。至于要不要将尺寸限制在影像大小范围内,可透过运算子set_system ,配合参数'clip region'来设定。region是由一种runlength encoding数据组成的,内存使用量极低,却有很好的速度和效率。由于region不是以一般软件的label images  来控制,因此可以互相重迭,例如扩张运算的结果,一般的软件无法做到这一点。至于程序中允许的region数目,并无特别限制。

 XLDs

XLDs (属于iconicdata). XLD 是Extended Line Description 的缩写,包含了所有等值线以及多边型的数据。图像均用像素点保存,而像素点是整型的,不连续的,Halcon做了拓展,定义了亚像素(subpixel)的描述几何轮廓的对象:xld,主要用在亚像素测量的背景下,可用于如提取边缘、构建轮廓等等,xld在模板匹配、图形校准等多方面有重要的用途。像edges_sub_pix 之类的次像元精度运算子产生的数据即属于XLD。一条所谓的2D等值线是一连串坐标点的串行,相邻两点间以直线相连。一般来说,数据点之间的距离大约是1Pixel。XLD对象中除了点坐标数据,还包含了全域或区域属性,例如edge方向,或是分割时的regression参数等等。除了取出XLD数据,还能做进一步的应用,例如选择具有特定特征的曲线,或是把曲线分割成直线段,圆弧,多边型,或是并行线等等。

 

Subpixel accurate line and edge detection(亚像素精度的线和边缘检测)

Generic point list based data structure(依据数据结构产生点的表)

Handling of contours, polygons, lines, parallels, etc.(对轮廓,多边形,线等进行操作)

ControlTuples

Tuples就像一个数组,其中的数据型态可为整数,浮点数或是字符串。一个tuple型态的变量可 为上述三种数据型态之一,甚至于混合。当我们计算一个region的某些特征时,会传回一个 结果,如果计算的是一群region,会传回一个tuple,其中含有每个region的特征计算结果。Control tuple的指标由0开始。请注意,iconic tuple的指标由1开始。

Handles

Handles是用于管理一组复合的数据,例如shape-basedmatching 中的models。为了程序设计的 方便性以及数据安全与效率,这类数据只透过一个handle让使用者操控。每个Handle都有一  个唯一的整数数值,由系统底层自行产生。例如图形窗口,档案,sockets,取像设备,OCR,OCV,measuring,matching等等,都会以handle来代表要操作的对象,句柄不能是常量。

 

二.区域运算:

并:union1()、union2();

交:intersection();

差:difference();

补:complement();

图形显示参数设置:

显示模式:set_draw(); 参数:margin、filled

线宽线形:set_line_width(); set_line_style();

颜色:set_color(); set_colored(); set_rgb(); set_gray();

显示图形:set_shape(); 参数:original、outer circle、inner circle、rectangle1、rectangle2、ellipse、icon、set_icon


三.附加重要名词解释 

Domain: Part of the image which is used forprocessing. In other systems called ROI (region of interest).(待处理的区域)

Channel: One image matrix of amulti-spectral image. One example is the red channel of an RGB image.

Iconic data: Overall term for images,regions, and XLD data. In object oriented languages (C++ and COM) and inHDevelop iconic data is represented by polymorphic data type. In objectoriented languages iconic data is also called iconic object.

Control data: All non iconic data. Examplesare single values (integer, real, and string), coordinates, arrays of values.

Tuple: an array of values where each element can be of different type. One can have both iconic and controltuples.

HALCON object: Synonym for Iconic object /data

Image acquisition interface: Interfacebetween the frame grabber /camera driver (SDK) and the HALCON library. TheImage acquisition interface is DLL which is dynamically loaded when callingopen_framegrabber.

Language interface: Software that enablesthe programmer to use the HALCON library in given language (e.g., C++).

Extension Package: mechanism that enablesthe user to fully integrate user-defined procedures into the HALCONenvironment. The extension package concept gives full access to the internaldata structures of HALCON.

License file: File “license.dat“ in thedirectory “license“.  This file is usedtogether with hardware components (dongle or Ethernet card) to check if acorrect license is available.

Help files: Files in the directory “help“which are used to get online information about all HALCON operators. This isextensively used by HDevelop.

Shape-Based Matching: Finding of an objectin an image based on predefined model. The shape based matching uses featuresto quickly locate objects very precisely.

Variation Model: method to do printchecking by presenting multiple good patterns to the system. The variationmodel learns the normal variation good pattern and based on this informationcan detect real defects.

Measure Tool: set of operators to findthe exact location of edges along lines or circular arcs. Other systems callthe similar tool, e.g., caliper.

Accuracy: The deviation from the true value(准确性,和真值之间的差)

Precision: The standard deviation of themeasurement(精度,测量标准差)

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有