Halcon80_图像采集接口程序员手册_ImageAcquisisionInterface

本文档介绍了如何将第三方图像采集硬件(采集卡和数字相机)集成到HALCON系统中。主要内容包括HALCON图像采集接口的基本概念、数据结构、接口例程及如何生成动态对象封装采集接口等。
部署运行你感兴趣的模型镜像

About This Manual

该手册描述了集成第三方图像采集硬件(采集卡和数字相机)到HALCON系统中所需要的基本的技术。

用到的人:

The manual is written for the expert HALCON user who wants to集成新的采集设备.

读者要求:

需要熟悉:

the standard HALCON system.

C programming skills.

使用的图像采集设备的API的详细的知识。

如果你是对HALCON图像采集接口的基础第一次感兴趣 (从用户观点), 请参考the Solution Guide II-A.

手册分成以下部分:

 Introduction

This chapter explains the basics of image acquisition and introduces the HALCON image acquisi-

tion interface and the underlying concepts.

 Data Structures

In this chapter, the basic data structures of the image acquisition interface are described.

 Interface Routines

This chapter explains all the routines you have to implement inside your acquisition interface.

 Generating an Acquisition Interface Library

怎样生成a dynamic object 封装你的采集接口。

 Changes between versions 2 and 3 of the HALCON image acquistion interface

描述了不同between the versions 2 and 3 of the HALCON图像采集接口

 Changes between versions 1 and 2 of the HALCON image acquistion interface

This appendix describes the differences between the versions 1 and 2 of the HALCON image

acquisition interface (formerly known as HALCON frame grabber integration interface).

 HALCON Error Codes

附录描述了所有的错误代码which you may use for 采集接口的编程中。

 

介绍:

这章面向对以下不熟悉的客户:采集卡硬件, A/D转换, 同步异步的操作模式,buffering策略等. 尽管这手册不是给您提供图像采集设备内部的详细的知识,我们仍想给出一些基本的术语和方法的解释。读采集设备的手册是必须的,那里会有更详细的知识。

从用户的观点,要更熟悉HALCON里的图像采集,强烈建议先读相应的solution guide。The Solution Guide

II-A is part of HALCON’s Solution Guide II ,能在目录 %HALCONROOT%\doc\pdf\solution_guide.中找到。参考Windows conventions,如file paths and 环境变量会象:

%HALCONROOT%\examples\ia_integration\hAcqTemplate.c

如果在用Linux/UNIX system就须考虑相应的Linux/UNIX syntax.

 

1.1 HALCON一般的图像采集接口

HALCON提供一个一般的图像采集接口that allows 新采集卡或相机的自由集成, 甚至不需重新启动 a HALCON application.

两个用到的基本概念:

• 接口代码封装in dynamically loadable modules.

• 一套预定义的HALCON 图像采集operators,包括operators for 设置和检索指定的硬件参数. 后者允许将最奇异古怪的采集设备参数化。

如果您已经成功的开发出了一个新的HALCON图像采集接口 (基于手册中给的详细的信息), 然后所有用你的新采集设备仅需要做的是:

• 插上硬件然后安装设备商的驱动和库

• 拷贝新的HALCON接口 (如封装的 依赖硬件的代码的 可载入module) 到一个目录中(在你的搜索路径里)for DLLs or shared libraries。新的HALCON接口文件名正确的前缀见chapter 4 on page 63.

•在open_framegrabber operator中指定新的图像采集设备的名字 (如相应的接口名)

• 享受你集成在新的采集设备接口中所有特征的性能。

图像采集的操作符没变,所以现在的应用程序代码不修改仍可用in most cases. HALCON自动载入接口during 第一次调用open_framegrabber. Thus, you can exchange/add image acquisition interfaces even without restarting your application. 通过参数设置机制可访问不同采集设备的指定特征。注意8.0 术语有更改:因为USB 2.0, IEEE 1394 or GigE数字相机不用采集卡。 现在代替使用的是HALCON acquisition interface,要向后兼容,故HALCON operators 和data structures and error codes相应的名字就没变。操作符名字open_framegrabber, info_framegrabber, and close_framegrabber may sound a little bit old-fashioned.

Example files

As a guideline for the image acquisition integration, the HALCON distribution contains a template for an image acquisition interface (see hAcqTemplate.c in examples\ia_integration). It covers most

situations you might encounter while programming such an interface (如支持多卡或单卡多相机). Although the template is extensively commented, it might be quite tough to understand the code prior to reading this manual. 另一方面他能提供一个强大的框架for a wide range of integrations.

1 DLLs for Windows, shared libraries for Linux/UNIX systems.

2 Except for the new name of the image acquisition device and its specific parameters used by the operator set_framegrabber_param.

 

所有支持的列表要看www.halcon.com 或联系供应商 to get the latest releases of the HALCON

image acquisition interfaces. www.halcon.com/image-acquisition/.

 

1.2 Image Acquisition Basics

Note that the following sections in this chapter mainly describe the case that an analog camera is connected to a frame grabber board. However, most of the principles are also important in case of digital capture devices like IEEE 1394, USB 2.0, or GigE cameras.

Basically, what a frame grabber does is to take a video signal, which can be understood as a continuous stream of video frames, and grab one or more video frames out of the sequence, whenever triggered to do so. In many cases, the video signal will be an analog one, although more professional equipment often uses digital signals nowadays. The most common analog video formats are

 NTSC: 640 × 480 pixel, 30 frames per second and

 PAL: 768 × 576 pixel, 25 frames per second.

这两种都是彩色制式,尽管许多采集设备仅用灰阶图像,即使相机发出的是彩色信号,以下解释假设你是用模拟采集卡。数字卡会有所不同。

让我们看一下模拟输入信号:Actually, it is composed of many different signals: There are vertical and horizontal sync signals and, of course, the raw data signals as well. Sometimes, the color and brightness signals are overlaid (composite signal), sometimes they are delivered on separated input lines (Y/C, RGB). Since the frame grabber is usually synchronized by the video source, it has to wait for the next vertical sync signal to start grabbing a new image, see figure 1.1.

3 At least if you do not use a setup that supports asynchronous frame resets.

This will cause a delay of half a frame on average when grabbing an image of random frames4

. It

also implies that you have to start grabbing the next frame immediately5

after receiving the previous

frame if you want to achieve full frame rate. Consequently, there would be no time at all left to process

images. In this synchronous mode, the host computer is exclusively busy triggering one grab after

another. Therefore, HALCON also supports asynchronous grabbing as explained in the next section.

1.3 Synchronous vs. Asynchronous Grabbing

To understand what asynchronous grabbing means, we first should take a look at what the image acqui-

sition device does with a grabbed frame. It is easily understood, that a digitized frame must be stored in

some kind of memory. Basically, there are three possibilities:

• Device memory on the image acquisition device

• Device memory on the host machine

• Host memory

Device memory on the board means dedicated memory, physically mounted to the board. This way, the

image acquisition device can store the acquired image(s) directly in its own memory, with each process

on the host being able to get the data at any time. On the other hand, memory size is fixed. If it is too

small, it may not be possible to keep several images in memory. If it is very big, the whole board can

get rather expensive. Device memory on the host machine is non-paged system memory dynamically

allocated by the frame grabber’s device driver. Thus, the memory size can be easily adjusted. On the

other hand, heavy bus traffic is likely to occur, if the image acquisition device is delivering data to the

host computer’s memory permanently.

6

Therefore, we usually do not use continuous grabbing modes

provided by some image acquisition devices, but grab images only on demand. Host memory is allocated

by the user somewhere in the address space of the application. Since this memory might be pagable, the

images delivered from the image acquisition device in general must be explicitly copied to this memory

(since DMA7

will fail).

The host computer’s job, as mentioned above, is to trigger the image acquisition device when a new

image is needed, but it does not necessarily need to wait while the device digitizes the frame. With

device memory being on the board, this is self-evident, but also if the target memory is host-based,

externally initiated data transfer is usually possible with techniques like DMA. So the “only thing” the

host process has to do is to trigger the image acquisition device an average time of 11

2 frames before an

image is actually needed, and then it can do some other processing while the new frame is captured by

the board in the background. This technique is called asynchronous grabbing. It is easily understood

that this eases real-time grabbing, since the time needed for frame completion is rather long (40 msec

with PAL, 33 msec with NTSC video) compared to the small time gap between two adjacent frames in

the video stream.

4Naturally, this is not true if the camera supports an asynchronous reset mode, i.e. the camera starts the new grab almost

immediately.

5There is a very short sync period before the next frame starts.

6When grabbing a PAL signal with a RGB image acquisition device using a 32 bit per pixel representation, more than 42

Megabytes per second have to be transferred to the host.

7Direct Memory Access.

 

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值