Summary of the content on the page No. 1
™
IMAQ
™
NI-IMAQ for IEEE-1394
Cameras User Manual
Image Acquisition Software
NI-IMAQ for IEEE-1394 Cameras User Manual
March 2001 Edition
Part Number 370362A-01
Summary of the content on the page No. 2
Worldwide Technical Support and Product Information ni.com National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 794 0100 Worldwide Offices Australia 03 9879 5166, Austria 0662 45 79 90 0, Belgium 02 757 00 20, Brazil 011 284 5011, Canada (Calgary) 403 274 9391, Canada (Ottawa) 613 233 5949, Canada (Québec) 514 694 8521, Canada (Toronto) 905 785 0085, China (Shanghai) 021 6555 7838, China (ShenZhen) 0755 3904939, Denmark 45 76 26 00, Finla
Summary of the content on the page No. 3
Important Information Warranty The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period.
Summary of the content on the page No. 4
Conventions The following conventions are used in this manual: » The » symbol leads you through nested menu items and dialog box options to a final action. The sequence File»Page Setup»Options directs you to pull down the File menu, select the Page Setup item, and select Options from the last dialog box. This icon denotes a note, which alerts you to important information. bold Bold text denotes items that you must select or click on in the software, such as menu items and dialog box options. Bol
Summary of the content on the page No. 5
Contents Chapter 1 Introduction to NI-IMAQ for IEEE-1394 Cameras About the NI-IMAQ Software.......................................................................................1-1 Application Development Environments ........................................................1-2 Configuring Your IEEE-1394 Camera............................................................1-2 Fundamentals of Building Applications with NI-IMAQ for 1394 ................................1-3 Architecture ...............
Summary of the content on the page No. 6
Contents Introductory Programming Examples ........................................................................... 3-5 High-Level Snap Functions ............................................................................ 3-5 High-Level Grab Functions ............................................................................ 3-6 High-Level Sequence Functions ..................................................................... 3-8 Advanced Programming Examples .............................
Summary of the content on the page No. 7
1 Introduction to NI-IMAQ for IEEE-1394 Cameras This chapter describes the NI-IMAQ for IEEE-1394 software and lists the application development environments compatible with NI-IMAQ, describes the fundamentals of creating NI-IMAQ applications for Windows 2000 and Windows Me/98, describes the files used to build these applications, and tells you where to find sample programs. About the NI-IMAQ Software NI-IMAQ for 1394 gives you the ability to use industrial digital video cameras with the NI-IMAQ
Summary of the content on the page No. 8
Chapter 1 Introduction to NI-IMAQ for IEEE-1394 Cameras Application Development Environments This release of NI-IMAQ for 1394 supports the following Application Development Environments (ADEs) for Windows 2000 and Windows Me/98: LabVIEW version 5.1 and higher LabWindows/CVI version 5.0 and higher Borland C++ Builder 3.0 and higher Microsoft Visual C/C++ version 6.0 and higher Note Although NI-IMAQ for 1394 has been tested and found to work with these ADEs, other ADEs may also work. Confi
Summary of the content on the page No. 9
Chapter 1 Introduction to NI-IMAQ for IEEE-1394 Cameras Fundamentals of Building Applications with NI-IMAQ for 1394 Architecture A block diagram of the NI-IMAQ for 1394 architecture shown in Figure 1-1 illustrates the low- and mid-level architecture for IMAQ devices. LabWindows/CVI LabVIEW Visual C++/Borland IMAQ Vision IMAQ Vision IMAQ1394.DLL Application Level Kernel IMAQ1394.SYS 1394BUS.SYS OCHI1394.SYS TILYNX.SYS Figure 1-1. NI-IMAQ for 1394 Architecture © National Instruments Corporation 1-
Summary of the content on the page No. 10
Chapter 1 Introduction to NI-IMAQ for IEEE-1394 Cameras The NI-IMAQ Libraries The NI-IMAQ for 1394 for Windows 2000/Me/98 function libraries are dynamic link libraries (DLLs), which means that NI-IMAQ for 1394 routines are not linked into the executable files of applications. Only the information about the NI-IMAQ routines in the NI-IMAQ import libraries is stored in the executable files. Import libraries contain information about their DLL-exported functions. They indicate the presence and loca
Summary of the content on the page No. 11
Chapter 1 Introduction to NI-IMAQ for IEEE-1394 Cameras When compiling, indicate where the compiler can find the NI-IMAQ header files and shared libraries. You can find most of the files you need for development under the NI-IMAQ target installation directory. If you choose the default directory during installation, the target installation directory isC:\Program Files\National Instruments\NI-IMAQ for IEEE-1394. You can find the include files under theinclude subdirectory. The import libraries
Summary of the content on the page No. 12
2 Software Overview This chapter describes the classes of NI-IMAQ for 1394 functions and briefly describes each function. Introduction NI-IMAQ functions are grouped according to the following classes: Generic functions High-level functions – Snap functions – Grab functions – Sequence functions – Trigger functions Low-level functions – Acquisition functions – Attribute functions – Utility functions The generic and high-level functions appear within each function class in the logical order y
Summary of the content on the page No. 13
Chapter 2 Software Overview High-Level Functions Use high-level functions to quickly and easily capture images. If you need more advanced functionality, you can mix high-level functions with low-level functions. Snap Functions Snap functions capture all or a portion of a single frame or field to the user buffer. imaq1394SnapImage Performs a single frame acquisition in an image buffer, which is allocated using IMAQ Vision memory management. imaq1394Snap Performs a single frame acquisition in a me
Summary of the content on the page No. 14
Chapter 2 Software Overview Sequence Functions Sequence functions start and stop a continuous acquisition of multiple frames. imaq1394SetupSequenceImage Configures and starts a session for acquiring a full sequence into the list of buffers managed by IMAQ Vision. imaq1394SetupSequence Configures and starts a session for acquiring a full sequence in the buffer list. Trigger Functions Trigger functions control the trigger mode of the IEEE-1394 camera. imaq1394TriggerConfigure Configures an acquisi
Summary of the content on the page No. 15
Chapter 2 Software Overview imaq1394StopAcquisition Stops an asynchronous acquisition or synchronous continuous acquisition immediately. imaq1394GetBuffer Copies a frame buffer to a user-specified buffer. imaq1394GetImage Copies a session’s image data to an IMAQ Vision image. imaq1394InstallCallback Configures an asynchronous acquisition and installs a callback function that will be called when an image is acquired. Attribute Functions Use attribute functions to examine and change NI-IMAQ or cam
Summary of the content on the page No. 16
Chapter 2 Software Overview Utility Functions Use utility functions to display an image in a window, save an image to a file, or to get detailed error information. imaq1394Plot Plots a buffer to a window given a handle to a window. imaq1394PlotDC Plots a buffer to a window given a handle to a device context. imaq1394SaveBuffer Saves a buffer of a session to disk in bitmap, TIFF, or PNG format. imaq1394ShowError Returns a null-terminated string describing the error code. © National Instruments Co
Summary of the content on the page No. 17
3 Programming with NI-IMAQ for 1394 This chapter contains an overview of the NI-IMAQ for 1394 library, a description of the programming flow of NI-IMAQ for 1394, and programming examples. Flowcharts are included for the following operations: snap, grab, and sequence. Introduction The NI-IMAQ for 1394 application programming interface (API) is divided into two groups—high-level functions and low-level functions. With the high-level functions, you can write programs quickly without having to learn
Summary of the content on the page No. 18
Chapter 3 Programming with NI-IMAQ for 1394 Low-Level Functions The low-level function set supports all types of acquisition. You can use low-level functions to start a synchronous or asynchronous acquisition. Establishing Interface Connections To acquire images using the high-level or low-level functions, you must first learn how to establish a connection to a camera. See the Camera Functions and Camera Attributes sections in this chapter for information on how to manage cameras, then refer to
Summary of the content on the page No. 19
Chapter 3 Programming with NI-IMAQ for 1394 Before you can acquire image data successfully, you must open a camera with theimaq1394CameraOpen function.imaq1394CameraOpen requires a camera name and returns a handle to this interface. NI-IMAQ for 1394 then uses this handle to reference this camera when using other NI-IMAQ functions. To establish a connection to the first IMAQ 1394 device in your system, use the following program example: SESSION_ID session_ID; if (imaq1394CameraOpen(“cam0”, &sessi
Summary of the content on the page No. 20
Chapter 3 Programming with NI-IMAQ for 1394 Scalable Image Size IEEE-1394 digital cameras support a predefined set of image sizes which you can select through the Format and Mode attributes in MAX. See your camera documentation for a list of supported formats. If you are using IMAQ Vision, the NI-IMAQ for 1394 software recognizes the predefined formats and automatically allocates enough memory to accommodate the image in IMAQ Vision. When you use C or C++ with NI-IMAQ for 1394 functions, you mus