National Instruments Digital Camera NI IMAQ User Manual

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  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
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. National Instruments does not warrant that the operation of the software shall be  
uninterrupted or error free.  
A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside of the package before  
any equipment will be accepted for warranty work. National Instruments will pay the shipping costs of returning to the owner parts which are  
covered by warranty.  
National Instruments believes that the information in this document is accurate. The document has been carefully reviewed for technical  
accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to make changes to subsequent  
editions of this document without prior notice to holders of this edition. The reader should consult National Instruments if errors are suspected.  
In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it.  
EXCEPT AS SPECIFIED HEREIN, NATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF  
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. CUSTOMERS RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF  
NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER. NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR  
DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY  
THEREOF. This limitation of the liability of National Instruments will apply regardless of the form of action, whether in contract or tort, including  
negligence. Any action against National Instruments must be brought within one year after the cause of action accrues. National Instruments  
shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty provided herein does not cover  
damages, defects, malfunctions, or service failures caused by owners failure to follow the National Instruments installation, operation, or  
maintenance instructions; owners modification of the product; owners abuse, misuse, or negligent acts; and power failure or surges, fire,  
flood, accident, actions of third parties, or other events outside reasonable control.  
Copyright  
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying,  
recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National  
Instruments Corporation.  
Trademarks  
IMAQ, LabVIEW, National Instruments, ni.com, and NI-IMAQare trademarks of National Instruments Corporation.  
Product and company names mentioned herein are trademarks or trade names of their respective companies.  
WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS  
(1) NATIONAL INSTRUMENTS PRODUCTS ARE NOT DESIGNED WITH COMPONENTS AND TESTING FOR A LEVEL OF  
RELIABILITY SUITABLE FOR USE IN OR IN CONNECTION WITH SURGICAL IMPLANTS OR AS CRITICAL COMPONENTS IN  
ANY LIFE SUPPORT SYSTEMS WHOSE FAILURE TO PERFORM CAN REASONABLY BE EXPECTED TO CAUSE SIGNIFICANT  
INJURY TO A HUMAN.  
(2) IN ANY APPLICATION, INCLUDING THE ABOVE, RELIABILITY OF OPERATION OF THE SOFTWARE PRODUCTS CAN BE  
IMPAIRED BY ADVERSE FACTORS, INCLUDING BUT NOT LIMITED TO FLUCTUATIONS IN ELECTRICAL POWER SUPPLY,  
COMPUTER HARDWARE MALFUNCTIONS, COMPUTER OPERATING SYSTEM SOFTWARE FITNESS, FITNESS OF COMPILERS  
AND DEVELOPMENT SOFTWARE USED TO DEVELOP AN APPLICATION, INSTALLATION ERRORS, SOFTWARE AND  
HARDWARE COMPATIBILITY PROBLEMS, MALFUNCTIONS OR FAILURES OF ELECTRONIC MONITORING OR CONTROL  
DEVICES, TRANSIENT FAILURES OF ELECTRONIC SYSTEMS (HARDWARE AND/OR SOFTWARE), UNANTICIPATED USES OR  
MISUSES, OR ERRORS ON THE PART OF THE USER OR APPLICATIONS DESIGNER (ADVERSE FACTORS SUCH AS THESE ARE  
HEREAFTER COLLECTIVELY TERMED SYSTEM FAILURES). ANY APPLICATION WHERE A SYSTEM FAILURE WOULD  
CREATE A RISK OF HARM TO PROPERTY OR PERSONS (INCLUDING THE RISK OF BODILY INJURY AND DEATH) SHOULD  
NOT BE RELIANT SOLELY UPON ONE FORM OF ELECTRONIC SYSTEM DUE TO THE RISK OF SYSTEM FAILURE. TO AVOID  
DAMAGE, INJURY, OR DEATH, THE USER OR APPLICATION DESIGNER MUST TAKE REASONABLY PRUDENT STEPS TO  
PROTECT AGAINST SYSTEM FAILURES, INCLUDING BUT NOT LIMITED TO BACK-UP OR SHUT DOWN MECHANISMS.  
BECAUSE EACH END-USER SYSTEM IS CUSTOMIZED AND DIFFERS FROM NATIONAL INSTRUMENTS' TESTING  
PLATFORMS AND BECAUSE A USER OR APPLICATION DESIGNER MAY USE NATIONAL INSTRUMENTS PRODUCTS IN  
COMBINATION WITH OTHER PRODUCTS IN A MANNER NOT EVALUATED OR CONTEMPLATED BY NATIONAL  
INSTRUMENTS, THE USER OR APPLICATION DESIGNER IS ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING  
THE SUITABILITY OF NATIONAL INSTRUMENTS PRODUCTS WHENEVER NATIONAL INSTRUMENTS PRODUCTS ARE  
INCORPORATED IN A SYSTEM OR APPLICATION, INCLUDING, WITHOUT LIMITATION, THE APPROPRIATE DESIGN,  
PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION.  
Download from Www.Somanuals.com. All Manuals Search And Download.  
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. Bold text also denotes  
parameter names.  
italic  
Italic text denotes variables, emphasis, a cross reference, or an introduction  
to a key concept. This font also denotes text that is a placeholder for a word  
or value that you must supply.  
monospace  
Text in this font denotes text or characters that you should enter from the  
keyboard, sections of code, programming examples, and syntax examples.  
This font is also used for the proper names of disk drives, paths, directories,  
programs, subprograms, subroutines, device names, functions, operations,  
variables, filenames and extensions, and code excerpts.  
monospace italic  
Italic text in this font denotes text that is a placeholder for a word or value  
that you must supply.  
NI-IMAQ for 1394  
NI-IMAQ for 1394 represents the NI-IMAQ for IEEE-1394 Cameras  
software package.  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Chapter 1  
Configuring Your IEEE-1394 Camera............................................................1-2  
Fundamentals of Building Applications with NI-IMAQ for 1394 ................................1-3  
The NI-IMAQ Libraries ..................................................................................1-4  
Chapter 2  
Software Overview  
Trigger Functions ............................................................................................2-3  
Miscellaneous Functions .................................................................................2-3  
Acquisition Functions......................................................................................2-3  
Chapter 3  
High-Level Functions......................................................................................3-1  
Low-Level Functions.......................................................................................3-2  
Establishing Interface Connections ...............................................................................3-2  
Camera Functions............................................................................................3-2  
Camera Attributes..........................................................................................................3-3  
Scalable Image Size.......................................................................................................3-4  
© National Instruments Corporation  
v
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Contents  
Advanced Programming Examples............................................................................... 3-9  
Performing a Snap Using Low-Level Functions............................................. 3-9  
Performing a Sequence Acquisition Using Low-Level Functions.................. 3-9  
Chapter 4  
Low-Level....................................................................................................... 4-7  
Triggering...................................................................................................................... 4-8  
Camera Attributes.......................................................................................................... 4-11  
Error Handling............................................................................................................... 4-12  
Appendix A  
Technical Support Resources  
Glossary  
Index  
NI-IMAQ for IEEE-1394 Cameras User Manual  
vi  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
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 driver software and IMAQ Vision. You can use  
cameras with the following output formats:  
Monochrome (8 bits/pixel)  
Monochrome (16 bits/pixel)  
RGB (24 bits/pixel)  
YUV 4:1:1 (12 bits/pixel)  
YUV 4:2:2 (16 bits/pixel)  
YUV 4:4:4 (24 bits/pixel)  
The cameras may operate at various resolutions and frame rates, depending  
on camera capabilities.  
NI-IMAQ for 1394 uses a WDM driver to directly access the 1394  
interface, so that NI-IMAQ can control all of the available modes of the  
digital camera.  
© National Instruments Corporation  
1-1  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
     
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.  
Configuring Your IEEE-1394 Camera  
You can use National Instruments Measurement & Automation Explorer  
(MAX) to configure your IEEE-1394 camera.  
Set your cameras properties by right-clicking on your camera in the IMAQ  
IEEE-1394 Devices folder in the MAX configuration tree. Select  
Properties from the pop-up menu. Adjust your cameras attributes and  
click OK to save the camera file.  
The camera information is saved in a camera file, which the LabVIEW VIs  
use to select a camera and its supported attributes.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
1-2  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
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  
Visual C++/Borland  
LabVIEW  
IMAQ Vision  
IMAQ Vision  
IMAQ1394.DLL  
IMAQ1394.SYS  
1394BUS.SYS  
Application Level  
Kernel  
OCHI1394.SYS  
TILYNX.SYS  
Figure 1-1. NI-IMAQ for 1394 Architecture  
© National Instruments Corporation  
1-3  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
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 location of the DLL routines. Depending  
on the development tools you are using, you may give the DLL routines  
information through import libraries or through function declarations.  
Your NI-IMAQ for 1394 software kit contains function prototypes for all  
routines.  
Creating an Application  
This section outlines the process for developing NI-IMAQ for 1394  
applications using C for Windows 2000/Me/98. Detailed instructions on  
creating project and source files are not included. For information on  
creating and managing project files, consult the documentation included  
with your particular development environment.  
When programming, use the following guidelines:  
Include the niimaq1394.hheader file in all C source files that use  
NI-IMAQ functions. Add this file to the top of your source files.  
Add the niimaq1394.libimport library to your project. Some  
environments allow you to add import libraries simply by inserting  
them into your list of project files. Other environments allow you  
to specify import libraries under the linker settings portion of the  
project file.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
1-4  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
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 is C:\Program Files\National  
Instruments\NI-IMAQ for IEEE-1394. You can find the include  
files under the includesubdirectory. The import libraries are located  
under the lib\<environment>subdirectory for the following  
platforms.  
Table 1-1. Import Libraries  
Development Environment  
Microsoft Visual C++  
Borland C++  
Directory  
lib\msvc  
lib\borland  
Sample Programs  
Please refer to the readme.txtfile located in your target installation  
directory for the latest details on NI-IMAQ for 1394 sample programs.  
These programs are installed in the samplesubdirectory under the target  
installation folder, if you elected to install the sample files.  
© National Instruments Corporation  
1-5  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
   
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 you might need to use them. The low-level functions  
appear within each function class in alphabetical order.  
Generic Functions  
Use generic functions in both high-level and low-level applications.  
imaq1394CameraOpen  
Opens a session on a camera by  
name.  
imaq1394Close  
Closes a session and unlocks and  
releases all buffers.  
© National Instruments Corporation  
2-1  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
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 memory buffer,  
which is allocated without using  
IMAQ Vision memory  
management.  
Grab Functions  
Grab functions start a continuous image acquisition to a user buffer. Any  
frame or field can be copied from the grab buffer to another user buffer.  
imaq1394SetupGrab  
Configures and starts a continuous  
acquisition.  
imaq1394GrabImage  
Acquires the most current frame  
into the specified IMAQ Vision  
image buffer. Call this function  
only after calling  
imaq1394SetupGrab.  
imaq1394Grab  
Acquires the most current frame  
into a previously allocated buffer.  
Call this function only after calling  
imaq1394SetupGrab.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
2-2  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
           
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 acquisition to start  
based on an external trigger.  
Miscellaneous Functions  
Miscellaneous functions return information such as session status.  
imaq1394Status Gets the current session status.  
Low-Level Functions  
Use low-level functions when you require more direct control of the  
acquisition of the images.  
Acquisition Functions  
Use acquisition functions to configure, start, and abort an image  
acquisition, or examine a buffer during an acquisition.  
imaq1394ConfigureAcquisition Configures the acquisition  
session mode (continuous or  
one-shot).  
imaq1394StartAcquisition  
Starts acquisition synchronously  
or asynchronously.  
© National Instruments Corporation  
2-3  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
                   
Chapter 2  
Software Overview  
imaq1394StopAcquisition  
Stops an asynchronous acquisition  
or synchronous continuous  
acquisition immediately.  
imaq1394GetBuffer  
imaq1394GetImage  
Copies a frame buffer to a  
user-specified buffer.  
Copies a sessions 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 camera  
attributes.  
imaq1394GetAttribute  
imaq1394SetAttribute  
imaq1394AttributeInquiry  
Returns an attribute for a session.  
Sets an attribute for a session.  
Queries the camera to check that it  
supports the specified attribute.  
imaq1394GetVideoModes  
imaq1394GetFeatures  
Retrieves a list of video formats,  
modes, and frame rates supported  
by the camera.  
Retrieves a list of features  
supported by the camera.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
2-4  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
   
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  
imaq1394SaveBuffer  
Plots a buffer to a window given a  
handle to a device context.  
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 Corporation  
2-5  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
   
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 groupshigh-level functions and low-level functions.  
With the high-level functions, you can write programs quickly without  
having to learn the details of the low-level API and driver. The low-level  
functions give you finer granularity and control over your image  
acquisition process, but you must understand the API and driver in greater  
detail.  
Note The high-level functions call low-level functions and use certain attributes that are  
listed in the high-level function description in the NI-IMAQ for 1394 Function Reference  
online help. Changing the value of these attributes while using low-level functions will  
affect the operation of the high-level functions.  
High-Level Functions  
The high-level function set supports three basic types of image acquisition:  
Snap acquires a single frame to a buffer.  
Grab performs an acquisition that loops continually on one buffer; you  
obtain a copy of the acquisition buffer by grabbing a copy to a separate  
buffer that can be used for analysis.  
Sequence performs an acquisition that acquires a specified number of  
buffers, then stops.  
The high-level function set also allows triggered acquisitions.  
© National Instruments Corporation  
3-1  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
         
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 the high-level or low-level  
samples for information on acquiring images.  
Camera Functions  
Use camera functions to query the number of available cameras, establish  
a connection to, control access to, and initialize hardware. All parameters  
configured in MAX for an IMAQ 1394 device are associated with a camera  
name. You can have one device associated with more than one camera  
name, which allows you to have several different configurations for one  
device. Use the camera name to refer to the IMAQ 1394 device in your  
programming environment. Camera name information is stored in an  
interface (.icd) file.  
NI-IMAQ for 1394 specifies all interfaces by a name. By default, the  
system creates default names for the number of cameras in your system.  
These names observe the convention shown in Table 3-1.  
Table 3-1. Camera Naming Convention  
Camera Name  
IMAQ 1394 Device Installed  
Device 0  
cam0  
cam1  
...  
Device 1  
...  
camn  
Device n  
You can edit existing cameras or create new cameras in MAX. You also can  
use MAX to configure the default state of a particular camera.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
3-2  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
           
Chapter 3  
Programming with NI-IMAQ for 1394  
Before you can acquire image data successfully, you must open a camera  
with the imaq1394CameraOpenfunction. 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”, &sessionID) == IMG1394_ERR_GOOD)  
{
// user code  
imaq1394Close(sessionID);  
}
This example opens a camera named cam0. When the program is finished  
with the camera, it closes the camera using the imaq1394Closefunction.  
For a complete list of the available camera functions, refer to the NI-IMAQ  
for IEEE-1394 Cameras online help.  
Camera Attributes  
Use camera attributes to control camera-specific features such as  
brightness and shutter speed directly from NI-IMAQ for 1394. You can  
also set camera attributes through the feature tab in MAX. All of the  
configured parameters for a camera are stored in a camera (.icd) file. This  
file is linked to a specific camera.  
The following attributes are defined in the IEEE-1394 Based Digital  
Camera SpecificationBrightness, Auto_Exposure, Sharpness,  
White_Balance, Hue, Saturation, Gamma, Shutter, Gain, Iris, Focus,  
Temperature, Zoom, Pan, Tilt, and Optical Filter.  
To modify these attributes in C or C++, use the imaqSetAttributeand  
imaqGetAttributefunctions. If your camera does not implement every  
attribute specified, the functions return an error.  
© National Instruments Corporation  
3-3  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
     
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 must know the size of the image for the  
selected format and mode to allocate enough memory to contain the image.  
You can obtain the size of the image using the Image Width and Image  
Height attributes.  
Some IEEE-1394 cameras support the Scalable Image Format (format 7),  
which allows you to define the size of the acquired image. If you use this  
format, you must input the image size using the ROI parameter in  
LabVIEW or the Rectangle parameter in C and C++, as shown in  
Figure 3-1. The size and position of the sub-image you are acquiring must  
be a multiple of the attributes Unit Width and Unit Height, or the driver  
acquires the smallest sub-image that contains the ROI you defined.  
Figure 3-1. Scalable Image Format (format 7)  
NI-IMAQ for IEEE-1394 Cameras User Manual  
3-4  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
     
Chapter 3  
Programming with NI-IMAQ for 1394  
Introductory Programming Examples  
This section introduces some examples for performing the different types  
of image acquisition.  
Note The error codes returned by NI-IMAQ are not included in the examples. Always  
check the return code for errors in your program.  
If you have IMAQ Vision installed on your computer, you can take  
advantage of the additional Image functions installed with NI-IMAQ for  
1394. These functions use the IMAQ Vision memory management feature,  
in which you must first create an image using imaqCreateand then pass  
that image to an acquisition function.  
If you do not have IMAQ Vision installed on your computer, you must  
manually allocate the memory for your image. Use the attributes  
ImageWidth, ImageHeight, and BytesPerPixel to determine how much  
memory you should allocate.  
Note You can find the code examples discussed in this section in the NI-IMAQ for  
IEEE-1394\samplesdirectory. The LabWindows/CVI examples emphasize the Image  
functions, and the C examples for Visual C++ and Borland C++ emphasize the standard  
functions.  
High-Level Snap Functions  
A snap acquires a single image into a memory buffer. Snap functions  
include imaq1394Snapand imaq1394SnapImage. Use these functions to  
acquire a single frame to a buffer. To use these functions, you must have a  
valid session handle.  
© National Instruments Corporation  
3-5  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
Chapter 3  
Programming with NI-IMAQ for 1394  
When you invoke a snap, it initializes the IMAQ 1394 device and acquires  
the next incoming video frame to a buffer. Use a snap for low-speed or  
single-capture applications where ease of programming is essential.  
Figure 3-2 illustrates a typical snap programming order.  
imaq1394CameraOpenopens  
and configures the camera  
according to the file set up by  
Measurement & Automation Explorer.  
imaq1394CameraOpen  
imaq1394Snap  
imaq1394Snapacquires an image into a buffer.  
User-specific image processing  
User-Specific Functions  
imaq1394Closecloses the camera and session.  
Figure 3-2. Snap Programming Flowchart  
imaq1394Close  
The Snap1394.cexample demonstrates how to perform a single snap  
using imaq1394SnapImage. The example opens a session on a camera  
and then performs a single snap. The buffer pointer that is passed to  
imaq1394Snapis allocated with malloc with the appropriate size. The size  
of the buffer is calculated based on the region of interest (ROI) and the  
number of bytes per pixel: ROI width multiplied by ROI height multiplied  
by bytes per pixel. When you open a session, the ROI is set to the size of  
the video mode you selected in MAX.  
The sample then calls a process function to analyze the image. When the  
program is finished, it calls imaq1394Closewith the camera handle. This  
instructs NI-IMAQ to free all of the resources associated with this camera,  
which releases the session.  
High-Level Grab Functions  
A grab is a continuous high-speed acquisition of data to a single buffer in  
host memory. Grab functions include imaq1394SetupGrab,  
imaq1394Grab, and imaq1394GrabImage. You can use these functions  
to perform an acquisition that loops continually on one buffer. You can  
obtain a copy of the acquisition buffer by grabbing a copy to a separate  
buffer. To use these functions, you must have a valid session handle.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
3-6  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
Chapter 3  
Programming with NI-IMAQ for 1394  
Calling imaq1394SetupGrabinitializes a session for a grab acquisition.  
After imaq1394SetupGrab, each successive grab copies the last acquired  
buffer into a user buffer where you can perform processing on the image.  
Use grab for high-speed applications where you need processing performed  
on only one image at a time. Figure 3-3 illustrates a typical grab  
programming order.  
imaq1394CameraOpenopens  
and configures the camera  
according to the file set up by  
imaq1394CameraOpen  
Measurement & Automation Explorer.  
imaq1394SetupGrabconfigures the camera for a  
continuous acquisition.  
imaq1394SetupGrab  
imaq1394Graband imaq1394GrabImage  
copy the contents of the driver buffer  
to a user buffer. You can call imaq1394Grab  
and imaq1394GrabImagemultiple times  
for high-speed acquisition.  
imaq1394Grab  
or imaq1394GrabImage  
User-Specific Functions  
User-specific image processing  
(Loop)  
imaq1394Close  
imaq1394Closecloses the camera and session.  
Figure 3-3. Grab Programming Flowchart  
The Grab1394.c example demonstrates how to perform a grab using  
imaq1394Grab. The example performs multiple grabs until an appropriate  
condition is met. The program configures the session to perform a grab  
operation by calling the imaq1394Grabfunction.  
The program then calculates the area to grab using the current ROI and  
bytes per pixel. In this example, the program allocates a user buffer for  
grabbing and passes this buffer to imaq1394Grab. When the acquisition is  
complete, it stops. The program then frees the user buffer and all of the  
resources associated with this camera by calling imaq1394Close.  
© National Instruments Corporation  
3-7  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
   
Chapter 3  
Programming with NI-IMAQ for 1394  
High-Level Sequence Functions  
Sequence functions include imaq1394SetupSequence. A sequence  
initiates a variable-length and variable-delay transfer to multiple buffers.  
You can configure the delay between acquisitions with  
imaq1394SetupSequenceand specify both the buffer list used for  
transfers and the number of buffers. imaq1394SetupSequenceis  
synchronous and returns when all images have been acquired.  
Use a sequence in applications where you need to perform processing on  
multiple images. Figure 3-4 illustrates a typical sequence programming  
order.  
imaq1394CameraOpenopens  
and configures the camera  
according to the file set up by  
Measurement & Automation Explorer.  
imaq1394CameraOpen  
Buffer list setup  
Set up your buffer list and the  
number of the frames that need to  
be skipped between each acquisition.  
imaq1394SetupSequenceinitiates a  
sequence to a programmable number of buffers.  
imaq1394SetupSequence  
User-Specific Functions  
User-specific image processing.  
(Loop)  
imaq1394Closecloses the camera and session.  
imaq1394Close  
Figure 3-4. Sequence Programming Flowchart  
The Sequence1394.cexample demonstrates how to perform a sequence  
acquisition using imaq1394SetupSequence. The example sets up a  
sequence that uses 10 user-allocated buffers. Each buffer in the sequence  
has its own skip count associated with it. The skip count is the number of  
frames to skip prior to acquiring the next image. The acquisition is started  
at setup time and the setup call is synchronous.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
3-8  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
         
Chapter 3  
Programming with NI-IMAQ for 1394  
Advanced Programming Examples  
Use low-level functions or combine high-and low-level functions for more  
advanced programming techniques, including snap, grab, and sequence.  
Performing a Snap Using Low-Level Functions  
The LowLevelSnap1394.cexample demonstrates how to perform a snap  
acquisition using low-level calls. The example sets up a single-frame  
acquisition to a user-allocated buffer. The program retrieves the acquisition  
window size of the selected camera. After the program sets the ROI, it locks  
the memory and acquires the image.  
Performing a Grab Using Low-Level Functions  
The LowLevelGrab1394.cexample demonstrates how to perform a grab  
acquisition using low-level calls. The example sets up a continuous  
acquisition to a single user-allocated buffer.  
The program retrieves the acquisition window size of the selected camera  
and performs a calculation to determine the correct memory requirements  
of the user buffer. The program then creates the buffer. The main processing  
loop of the code shows how to copy the buffer to an analysis buffer.  
Performing a Sequence Acquisition Using Low-Level Functions  
The LowLevelSequence1394.cexample demonstrates how to perform a  
sequence acquisition using low-level calls. The example sets up a sequence  
acquisition to multiple buffers allocated by NI-IMAQ. As described in the  
low-level snap example, the program retrieves the acquisition window size  
of the selected camera. It creates a buffer list to describe the acquisition  
buffers. The program calculates the correct memory requirements of the  
frame buffer. The program starts the image acquisition asynchronously.  
The main processing loop of the code shows how to process each buffer  
acquired in sequential order.  
© National Instruments Corporation  
3-9  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
               
Chapter 3  
Programming with NI-IMAQ for 1394  
Performing an Asynchronous Snap Using Low-Level Functions  
The Low-Level Snap1394 Async example demonstrates how to perform an  
asynchronous acquisition using low-level calls. The example sets up a  
single-frame acquisition to a buffer.  
In an asynchronous snap, the program installs a callback function using the  
imaq1394InstallCallbackfunction and starts the acquisition with the  
imaq1394StartAcquisitionfunction. When the buffer is ready, the  
driver calls the callback function, allowing you to retrieve the image using  
the imaq1394GetBufferfunction.  
One advantage of an asynchronous snap is that you can start the acquisition  
and then perform other tasks while waiting for the signal that the image is  
ready.  
Note Since the callback function is called in a different thread than the main program, you  
should make sure that all of your processing is thread-safe.  
Performing an Asynchronous Grab using Low-Level Functions  
The Low-LevelGrab1394 Asyncexample demonstrates how to perform  
an asynchronous grab acquisition using low-level calls. The example sets  
up a continuous acquisition to a buffer.  
The program installs a callback function which is called each time an image  
is acquired until the acquisition is stopped or until the callback function  
returns FALSE.  
Note Because the callback function is called in a different thread than the main program,  
you should make sure that all of your processing is thread-safe.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
3-10  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
           
4
Programming with  
NI-IMAQ for 1394 VIs  
This chapter describes how to use the NI-IMAQ 1394 VIs in LabVIEW.  
Introduction  
The NI-IMAQ for IEEE-1394 Cameras VI Library, a series of virtual  
instruments (VIs) for using LabVIEW with your IMAQ 1394 device, is  
included with your NI-IMAQ for 1394 software.  
IMAQ Vision for LabVIEW is an image processing and analysis library  
that consists of more than 250 VIs. If you have not purchased the  
IMAQ Vision image processing and analysis libraries, you can use the four  
IMAQ Vision VIs included with your NI-IMAQ for 1394 software. If you  
use these basic functions, you can later upgrade your programs to use  
IMAQ Vision processing capabilities without any changes to your image  
acquisition VIs.  
Before you start building your IMAQ application, you should know the  
following basic IMAQ for LabVIEW concepts:  
Location of the NI-IMAQ for 1394 examples  
Location of the NI-IMAQ for 1394 VIs in LabVIEW  
Common NI-IMAQ for 1394 VI parameters  
Buffer management  
NI-IMAQ for 1394 acquisition types  
Acquisition VIs  
Triggering  
Image display  
Camera attributes  
Error handling  
Error code format  
© National Instruments Corporation  
4-1  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
Location of NI-IMAQ for 1394 Examples  
The NI-IMAQ VI for IEEE-1394 Cameras examples illustrate some  
common applications. You can find these examples in the  
labview\examples\imaqdirectory for LabVIEW. For a brief  
description of any example, open the example VI and choose  
Windows»Show VI Info for a text description of the example.  
Location of the NI-IMAQ for 1394 VIs  
You can find the NI-IMAQ VIs in the Functions palette from your  
LabVIEW block diagram. Select the Motion and Vision palette and then  
select the Image Acquisition palette, as shown in Figure 4-1.  
Figure 4-1. NI-IMAQ for IEEE-1394 Cameras Functions Palette  
NI-IMAQ for IEEE-1394 Cameras User Manual  
4-2  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
The most commonly used VIs are on the IMAQ for IEEE-1394 palette.  
You can find VIs for basic acquisition and changing attributes.  
The Motion and Vision»IMAQ for IEEE-1394»IMAQ Low Level  
palette contains VIs for more advanced applications.  
See the NI-IMAQ for IEEE-1394 VI Reference help for more information.  
Common NI-IMAQ for 1394 VI Parameters  
IMAQ1394 Session is a unique identifier that specifies the Interface file  
used for the acquisition. It is produced by the IMAQ1394 Init VI and used  
as an input to all other NI-IMAQ VIs. The NI-IMAQ for 1394 VIs use  
IMAQ1394 Session Out, which is identical to IMAQ Session, to simplify  
dataflow programming. IMAQ1394 Session Out is similar to the duplicate  
file sessions provided by the file I/O VIs. The high-level acquisition  
VIsIMAQ1394 Snap, IMAQ1394 Grab Setup, and IMAQ1394  
Sequencerequire you to wire IMAQ1394 Session In only if you are  
using an interface other than the default cam0, if you are using multiple  
cameras, or if you need to set IMAQ 1394 properties before the acquisition.  
Many acquisition VIs require that you supply an image buffer to receive the  
captured image. You can create this image buffer with the IMAQ Create VI.  
Consult the Buffer Management section of this chapter for more  
information. The input that receives the image buffer is Image in. The  
Image out output returns the captured image.  
The acquisition VIs use the Region of Interest input to specify a  
rectangular portion of an image frame to be captured. You can use Region  
of Interest to reduce the size of the image you want to capture. Region of  
Interest is an array of four elements with the elements defined as Left, Top,  
Right, Bottom. If Region of Interest is not wired, the entire image  
acquisition window is captured. You configure the default acquisition  
window using MAX.  
Note The Region of Interest input is only used when your camera is configured to use  
Scalable Image Format (format 7).  
© National Instruments Corporation  
4-3  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
   
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
Buffer Management  
IMAQ Create and IMAQ Dispose manage image buffers in LabVIEW.  
IMAQ Create, shown in Figure 4-2, allocates an image buffer. Image  
Name is a label for the buffer created. Each buffer must have a unique  
name. Image Type specifies the type of image being created. Use 8 bits for  
8-bit monochrome images and 16 bits for 16-bit monochrome images,  
RGB for RGB color images.  
Note If Image Type is set to a value incompatible with the current video mode, it will  
automatically change to a compatible value.  
New Image contains pointer information to the buffer, which is initially  
empty. When you wire New Image to the Image in input of an image  
acquisition VI, the image acquisition VI allocates the correct amount of  
memory for the acquisition. If you are going to process the image, you  
might need to wire to Border Size. Border Size is the width in pixels  
created around an image. Some image processing functions, such as  
labeling or morphology, require a border.  
Figure 4-2. IMAQ Create  
IMAQ Dispose, shown in Figure 4-3, frees the memory allocated for the  
image buffer. Call this VI only after the image is no longer required for  
processing.  
Figure 4-3. IMAQ Dispose  
NI-IMAQ for IEEE-1394 Cameras User Manual  
4-4  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
         
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
NI-IMAQ for 1394 Acquisition Types  
Three NI-IMAQ image acquisition types are available in LabVIEWsnap,  
grab, and sequence. The following sections describe each acquisition type  
and give examples.  
Snap  
A snap acquires a single image into a memory buffer. Use this acquisition  
mode to acquire a single frame or field to a buffer. When you invoke a snap,  
it initializes the device and acquires the next incoming video frame to a  
buffer. Use a snap for low-speed or single-capture applications.  
Use the IMAQ1394 Snap VI for snap applications. Figure 4-4 shows a  
simplified block diagram for using IMAQ1394 Snap.  
Figure 4-4. Acquiring an Image Using Snap  
Grab  
A grab is a continuous, high-speed acquisition of data to a single buffer in  
host memory. This function performs an acquisition that loops continually  
on one buffer. You can get a copy of the acquisition buffer by grabbing a  
copy to a LabVIEW image buffer.  
You must use two VIsIMAQ1394 Grab Setup and IMAQ1394 Grab  
Acquirefor a grab acquisition in LabVIEW. IMAQ1394 Grab Setup,  
which you call only once, initializes the acquisition and starts capturing the  
image to an internal software buffer. IMAQ1394 Grab Acquire, which  
you can call multiple times, copies the image currently stored in the internal  
buffer to a LabVIEW image buffer. After the program finishes copying  
images, call IMAQ1394 Close once to shut down the acquisition.  
© National Instruments Corporation  
4-5  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
             
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
Figure 4-5 shows a simplified block diagram for using IMAQ1394 Grab  
Setup and IMAQ1394 Grab Acquire.  
Figure 4-5. Acquiring Images Using Grab  
Sequence  
A sequence initiates a variable-length and variable-delay transfer to  
multiple buffers. Use a sequence for applications that process multiple  
images. You can configure a sequence to acquire every frame or skip a  
variable number of frames between each image.  
Use IMAQ1394 Sequence for sequence applications. IMAQ1394  
Sequence starts, acquires, and releases a sequence acquisition. The input  
Skip Table is an array containing the number of frames to skip between  
images. IMAQ1394 Sequence does not return until the entire sequence is  
acquired.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
4-6  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
   
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
Figure 4-6 shows a simplified block diagram for using IMAQ1394  
Sequence. Place IMAQ Create inside a For Loop to create an array of  
images for the Images in input to IMAQ1394 Sequence. To Decimal and  
Concatenate create a unique name for each image in the array.  
Figure 4-6. Acquiring Images Using Sequence  
Acquisition VIs  
Two acquisition VI types are available in LabVIEWhigh-level and  
low-level.  
High-Level  
You can use the high-level acquisition VIs for basic image acquisition  
applications. VIs are included for snap, grab, and sequence as described in  
the NI-IMAQ for 1394 Acquisition Types section of this chapter. You can  
find examples of using the high-level acquisition VIs in the  
examples\imaq\IMAQ1394examples.llbfile.  
Low-Level  
Use the low-level acquisition VIs for more advanced image acquisition  
applications. The low-level VIs configure an acquisition, start an  
acquisition, retrieve the acquired images, and stop an acquisition. You can  
use these VIs in conjunction with the event VIs to construct advanced  
IMAQ applications.  
Follow these general steps to perform a low-level acquisition:  
1. Call IMAQ1394 Init to initialize the board and create an IMAQ1394  
Session.  
2. Call IMAQ1394 Configure Occurrence if you want to implement an  
asynchronous acquisition.  
3. Call IMAQ1394 Start Acquisition.  
© National Instruments Corporation  
4-7  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
             
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
4. Call IMAQ1394 Get Image.  
5. After an acquisition, release the resources associated with the  
acquisition using IMAQ1394 Close. IMAQ1394 Close also stops the  
acquisition if one is in progress. If you want to stop the acquisition  
without releasing the resources (such as the image buffers), use  
IMAQ1394 Stop Acquisition.  
Examples of the low-level acquisition VIs are included in  
examples/imaq/IMAQ1394examples.llb.  
Triggering  
Often you may need to link or coordinate a vision action or function with  
events external to the computer, such as receiving a strobe pulse for  
lighting or a pulse from an infrared detector that indicates the position of  
an item on an assembly line.  
Timeout specifies the amount of time (in milliseconds) to wait for the  
trigger. Figure 4-7 shows how to use IMAQ1394 Configure Trigger to  
perform a snap acquisition based on a trigger.  
Figure 4-7. IMAQ Triggering  
Image Display  
Many image acquisition applications require that one or more images  
be displayed. You have three options for displaying images in LabVIEW.  
If you have IMAQ Vision for LabVIEW, the image processing and analysis  
software for LabVIEW, you can use IMAQ WindDraw. IMAQ WindDraw  
Motion and Vision»Vision Utilities»Display displays an image in an  
image window. Figure 4-8 illustrates using IMAQ WindDraw to display  
NI-IMAQ for IEEE-1394 Cameras User Manual  
4-8  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
         
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
an image acquired using IMAQ1394 Snap. You can display images in the  
same way using any acquisition type. For more information on the display  
capabilities of IMAQ Vision, consult the IMAQ Vision for LabVIEW  
User Manual.  
Figure 4-8. Displaying an Image Using IMAQ WindDraw  
If you do not have IMAQ Vision, you can display an image on a  
LabVIEW Intensity Graph for 8-bit and 16-bit monochrome images or on  
a picture control for RGB images.  
Before you can properly display an image on an Intensity Graph, you need  
to make some minor changes to the default properties of the Intensity  
Graph. Perform the following steps to modify the properties:  
1. Place the Intensity Graph on the front panel, pop up on the graph, and  
choose Transpose Array.  
2. Create the correct grayscale color palette by popping up on the marker  
labeled 50on the color ramp and choosing Delete Marker. Also,  
change the maximum value on the color palette from 100 to the  
maximum pixel value in your image255 for 8-bit images, 1,023 for  
10-bit images, and 4,095 for 12-bit images.  
3. Invert the y-axis. You might also need to change the ranges of the  
x- and y-axes to match the width and height of the image.  
© National Instruments Corporation  
4-9  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
Your intensity graph now should appear similar to the image shown in  
Figure 4-9. For more information on the Intensity Graph, consult your  
LabVIEW documentation  
Figure 4-9. Intensity Graph for Image Display  
Use the IMAQ ImageToArray VI to copy an image from an image buffer  
into a LabVIEW array. Then you can wire this array directly to an Intensity  
Graph for display. Figure 4-10 illustrates using an Intensity Graph to  
display an image acquired using IMAQ1394 Snap.  
Figure 4-10. Displaying an Image Using an Intensity Graph  
To display an RGB image on a picture control, place the picture control on  
the front panel of your VI. Use the IMAQ ColorImageToArray VI to copy  
an image from an image buffer into a LabVIEW array. Then you can wire  
this array to the Draw True-Color Pixmap VI. Wire the new image output  
from Draw True-Color Pixmap to the picture control indicator. For more  
information on the picture control, consult the LabVIEW online reference.  
Figure 4-11 illustrates using a picture control to display an RGB image  
acquired with the IMAQ1394 Snap VI.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
4-10  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
   
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
.
Figure 4-11. Using a Picture Control to Display an RGB Image  
Camera Attributes  
Camera attributes allow you to control camera-specific features such as  
brightness and shutter speed directly from NI-IMAQ for 1394. You can  
also set camera attributes through the feature tab in MAX. All of the  
configured parameters for a camera are stored in a camera (.icd) file. This  
file is linked to a specific camera.  
The following attributes are defined in the IEEE-1394 Based Digital  
Camera SpecificationsBrightness, Auto_Exposure, Sharpness,  
White_Balance, Hue, Saturation, Gamma, Shutter, Gain, Iris, Focus,  
Temperature, Zoom, Pan, Tilt, and Optical Filter.  
To modify these attributes in LabVIEW, use the IMAQ1394 Attribute VI.  
Set the Get/Set parameter to FALSE to read the current value of the  
attribute, and TRUE to write the new value of the attribute.  
© National Instruments Corporation  
4-11  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
Error Handling  
Every NI-IMAQ for 1394 VI contains an error in input cluster and an  
error out output cluster, as shown in Figure 4-12. The clusters contain a  
Boolean value that indicates whether an error occurred, the code for the  
error, and the source or the name of the VI that returned the error. If error  
in indicates an error, the VI passes the error information to error out and  
does not execute any NI-IMAQ for 1394 function.  
Figure 4-12. Error Clusters  
You can use the Simple Error Handler VI (Functions»Time&Dialog  
palette) to check for errors that occur while executing a VI. If you wire an  
error cluster to the Simple Error Handler VI, the VI deciphers the error  
information and displays a dialog box that describes the error. If no error  
occurred, the Simple Error Handler VI does nothing. Figure 4-13 shows  
how to wire an NI-IMAQ for 1394 Cameras VI to the Simple Error  
Handler VI.  
Figure 4-13. Error Checking using the Simple Error Handler VI  
NI-IMAQ for IEEE-1394 Cameras User Manual  
4-12  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
       
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
Error Code Format  
Error format for all NI-IMAQ for 1394 VIs is the same, as follows:  
error in (no error) is a cluster that describes the error status before this VI  
executes. If error in indicates that an error occurred before this VI was  
called, this VI may choose not to execute its function, but just pass the error  
through to its error out cluster. If no error has occurred, then this VI  
executes normally and sets its own error status in error out. Use the error  
handler VIs to look up the error code and to display the corresponding error  
message. Using error in and error out clusters is a convenient way to  
check errors and to specify execution order by wiring the error output from  
one subVI to the error input of the next.  
status is TRUE if an error occurred before this VI was called, or  
FALSE if not. If status is TRUE, code is a non-zero error code. If  
status is FALSE, code can be zero or a warning code.  
code is the number identifying an error or warning. If status is  
TRUE, code is a non-zero error code. If status is FALSE, code can  
be zero or a warning code. Use the error handler VIs to look up the  
meaning of this code and to display the corresponding error  
message.  
source is a string that indicates the origin of the error, if any.  
Usually source is the name of the VI in which the error occurred.  
error out is a cluster that describes the error status after this VI executes.  
If an error occurred before this VI was called, error out is the same as  
error in. Otherwise, error out shows the error, if any, that occurred in this  
VI. Use the error handler VIs to look up the error code and to display the  
corresponding error message. Using error in and error out clusters is a  
convenient way to check errors and to specify execution order by wiring the  
error output from one subVI to the error input of the next.  
status is TRUE if an error occurred, or FALSE if not. If status is  
TRUE, code is a non-zero error code. If status is FALSE, code can  
be zero or a warning code.  
© National Instruments Corporation  
4-13  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
   
Chapter 4  
Programming with NI-IMAQ for 1394 VIs  
code is the number identifying an error or warning. If status is  
TRUE, code is a non-zero error code. If status is FALSE, code can  
be zero or a warning code. Use the error handler VIs to look up the  
meaning of this code and to display the corresponding error  
message.  
source is a string that indicates the origin of the error, if any.  
Usually source is the name of the VI in which the error occurred.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
4-14  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
A
Technical Support Resources  
Web Support  
National Instruments Web support is your first stop for help in solving  
installation, configuration, and application problems and questions. Online  
problem-solving and diagnostic resources include frequently asked  
questions, knowledge bases, product-specific troubleshooting wizards,  
manuals, drivers, software updates, and more. Web support is available  
through the Technical Support section of ni.com  
NI Developer Zone  
The NI Developer Zone at ni.com/zoneis the essential resource for  
building measurement and automation systems. At the NI Developer Zone,  
you can easily access the latest example programs, system configurators,  
tutorials, technical news, as well as a community of developers ready to  
share their own techniques.  
Customer Education  
National Instruments provides a number of alternatives to satisfy your  
training needs, from self-paced tutorials, videos, and interactive CDs to  
instructor-led hands-on courses at locations around the world. Visit the  
Customer Education section of ni.comfor online course schedules,  
syllabi, training centers, and class registration.  
System Integration  
If you have time constraints, limited in-house technical resources, or other  
dilemmas, you may prefer to employ consulting or system integration  
services. You can rely on the expertise available through our worldwide  
network of Alliance Program members. To find out more about our  
Alliance system integration solutions, visit the System Integration section  
of ni.com  
© National Instruments Corporation  
A-1  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
             
Appendix A  
Technical Support Resources  
Worldwide Support  
National Instruments has offices located around the world to help address  
your support needs. You can access our branch office Web sites from the  
Worldwide Offices section of ni.com. Branch office Web sites provide  
up-to-date contact information, support phone numbers, e-mail addresses,  
and current events.  
If you have searched the technical support resources on our Web site and  
still cannot find the answers you need, contact your local office or National  
Instruments corporate. Phone numbers for our worldwide offices are listed  
at the front of this manual.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
A-2  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Glossary  
A
acquisition window  
The image size specific to a video standard or camera resolution.  
active pixel region  
The region of pixels actively being stored. Defined by a pixel start [relative  
to the horizontal synchronization signal(HSYNC)] and a pixel count.  
address  
Value that identifies a specific location (or series of locations) in memory.  
Application programming interface.  
API  
AQ_DONE  
AQ_IN_PROGRESS  
area  
Signals that the acquisition of a frame or field is completed.  
Signals that the acquisition of video data is in progress.  
A rectangular portion of an acquisition window or frame that is controlled  
and defined by software.  
array  
Ordered, indexed set of data elements of the same type.  
aspect ratio  
The ratio of a picture or images width to its height.  
B
b
Bit. One binary digit, either 0 or 1.  
B
Byte. Eight related bits of data, an eight-bit binary number. Also denotes  
the amount of memory required to store one byte of data.  
buffer  
Temporary storage for acquired data.  
C
cache  
High-speed processor memory that buffers commonly used instructions or  
data to increase processing throughput.  
chroma  
The color information in a video signal.  
© National Instruments Corporation  
G-1  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
     
Glossary  
chrominance  
compiler  
See chroma.  
A software utility that converts a source program in a high-level  
programming language, such as Basic, C, or Pascal, into an object or  
compiled program in machine language. Compiled programs run 10 to  
1,000 times faster than interpreted programs. See also interpreter.  
conversion device  
CPU  
Device that transforms a signal from one form to another. For example,  
analog-to-digital converters (ADCs) for analog input and digital-to-analog  
converters (DACs) for analog output.  
Central processing unit.  
D
D/A  
Digital-to-analog.  
DAC  
Digital-to-analog converter. An electronic device, often an integrated  
circuit, that converts a digital number into a corresponding analog voltage  
or current.  
DAQ  
Data acquisition. (1) Collecting and measuring electrical signals from  
sensors, transducers, and test probes or fixtures and inputting them to a  
computer for processing. (2) Collecting and measuring the same kinds of  
electrical signals with A/D or DIO boards plugged into a computer, and  
possibly generating control signals with D/A and/or DIO boards in the  
same computer.  
default setting  
DLL  
A default parameter value recorded in the driver. In many cases, the default  
input of a control is a certain value (often 0).  
Dynamic link library. A software module in Microsoft Windows containing  
executable code and data that can be called or used by Windows  
applications or other DLLs; functions and data in a DLL are loaded and  
linked at run time when they are referenced by a Windows application or  
other DLLs.  
DMA  
Direct memory access. A method by which data can be transferred between  
computer memory and a device or memory on the bus while the processor  
does something else. DMA is the fastest method of transferring data  
NI-IMAQ for IEEE-1394 Cameras User Manual  
G-2  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Glossary  
driver  
Software that controls a specific hardware device, such as an IMAQ or  
DAQ device.  
E
external trigger  
A voltage pulse from an external source that triggers an event such as  
A/D conversion.  
F
field  
For an interlaced video signal, a field is half the number of horizontal lines  
needed to represent a frame of video. The first field of a frame contains all  
the odd-numbered lines, the second field contains all of the even-numbered  
lines.  
frame  
A complete image. In interlaced formats, a frame is composed of two fields.  
function  
A set of software instructions executed by a single line of code that may  
have input and/or output parameters and returns a value when executed.  
G
gamma  
The nonlinear change in the difference between the video signals  
brightness level and the voltage level needed to produce that brightness.  
GUI  
Graphical user interface. An intuitive, easy-to-use means of  
communicating information to and from a computer program by means  
of graphical screen displays. GUIs can resemble the front panels of  
instruments or other objects associated with a computer program.  
H
hardware  
The physical components of a computer system, such as the circuit boards,  
plug-in boards, chassis, enclosures, peripherals, and cables.  
hue  
Hz  
Represents the dominant color of a pixel. The hue function is a continuous  
function that covers all the possible colors generated using the R, G, and B  
color spectrum. See also RGB.  
Hertz. Frequency in units of 1/second.  
© National Instruments Corporation  
G-3  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Glossary  
I
I/O  
Input/output. The transfer of data to/from a computer system involving  
communications channels, operator interface devices, and/or data  
acquisition and control interfaces.  
IEEE  
Institute of Electrical and Electronics Engineers.  
instrument driver  
A set of high-level software functions, such as NI-IMAQ, that control  
specific plug-in computer boards. Instrument drivers are available in  
several forms, ranging from a function callable from a programming  
language to a virtual instrument (VI) in LabVIEW.  
interlaced  
interpreter  
A video frame composed of two interleaved fields. The number of lines in  
a field are half the number of lines in an interlaced frame.  
A software utility that executes source code from a high-level language  
such as Basic, C or Pascal, by reading one line at a time and executing the  
specified operation. See also compiler.  
K
k
Kilo. The standard metric prefix for 1,000, or 103, used with units of  
measure such as volts, hertz, and meters.  
K
Kilo. The prefix for 1,024, or 210, used with B in quantifying data or  
computer memory.  
kbytes/s  
Kword  
A unit for data transfer that means 1,000 or 103 bytes/s.  
1,024 words of memory.  
L
library  
A file containing compiled object modules, each comprised of one of more  
functions, that can be linked to other object modules that make use of these  
functions.  
line count  
LSB  
The total number of horizontal lines in the picture.  
Least significant bit.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
G-4  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Glossary  
luma  
The brightness information in the video picture. The luma signal amplitude  
varies in proportion to the brightness of the video signal and corresponds  
exactly to the monochrome picture.  
luminance  
LUT  
See luma.  
Lookup table. Table containing values used to transform the gray-level  
values of an image. For each gray-level value in the image, the  
corresponding new value is obtained from the lookup table.  
M
M
(1) Mega, the standard metric prefix for 1 million or 106, when used with  
units of measure such as volts and hertz (2) Mega, the prefix for 1,048,576,  
or 220, when used with B to quantify data or computer memory.  
MB  
Megabyte of memory.  
Mbytes/s  
A unit for data transfer that means 1 million or 106 bytes/s.  
memory buffer  
memory window  
See buffer.  
Continuous blocks of memory that can be accessed quickly by changing  
addresses on the local processor.  
MSB  
MTBF  
mux  
Most significant bit.  
Mean time between failure.  
Multiplexer. A switching device with multiple inputs that selectively  
connects one of its inputs to its output.  
N
NI-IMAQ  
Driver software for National Instruments IMAQ hardware.  
noninterlaced  
A video frame where all the lines are scanned sequentially, instead of  
divided into two frames as in an interlaced video frame.  
© National Instruments Corporation  
G-5  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Glossary  
O
operating system  
Base-level software that controls a computer, runs programs, interacts with  
users, and communicates with installed hardware or peripheral devices.  
P
PCI  
Peripheral Component Interconnect. A high-performance expansion bus  
architecture originally developed by Intel to replace ISA and EISA. PCI  
offers a theoretical maximum transfer rate of 132 Mbytes/s.  
picture aspect ratio  
pixel  
The ratio of the active pixel region to the active line region. For standard  
video signals like RS-170 or CCIR, the full-size picture aspect ratio  
normally is 4/3 (1.33).  
Picture element. The smallest division that makes up the video scan line.  
For display on a computer monitor, a pixels optimum dimension is square  
(aspect ratio of 1:1, or the width equal to the height).  
pixel aspect ratio  
The ratio between the physical horizontal size and the vertical size of the  
region covered by the pixel. An acquired pixel should optimally be square,  
thus the optimal value is 1.0, but typically it falls between 0.95 and 1.05,  
depending on camera quality.  
protocol  
pts  
The exact sequence of bits, characters, and control codes used to transfer  
data between computers and peripherals through a communications  
channel.  
Points.  
R
RAM  
Random-access memory.  
real time  
A property of an event or system in which data is processed as it is acquired  
instead of being accumulated and processed at a later time.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
G-6  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Glossary  
resolution  
(1) The number of rows and columns of pixels. An image composed of m  
rows and n columns has a resolution of m × n. This image has n pixels  
along its horizontal axis and m pixels along its vertical axis. (2) The  
smallest signal increment that can be detected by a measurement system.  
Resolution can be expressed in bits, proportions, or a percentage of  
full scale. For example, a system has 12-bit resolution, one part in  
4,096 resolution, and 0.0244 percent of full scale.  
RGB  
ROI  
Color encoding scheme using red, green, and blue (RGB) color information  
where each pixel in the color image is encoded using 32 bits: 8 bits for red,  
8 bits for green, 8 bits for blue, and 8 bits for the alpha value (unused).  
Region of interest. (1) An area of the image that is graphically selected  
from a window displaying the image. This area can be used focus further  
processing. (2) A hardware-programmable rectangular portion of the  
acquisition window.  
ROM  
Read-only memory.  
S
s
Seconds.  
syntax  
Set of rules to which statements must conform in a particular programming  
language.  
T
transfer rate  
The rate, measured in bytes/s, at which data is moved from source to  
destination after software initialization and set up operations. The  
maximum rate at which the hardware can operate.  
trigger  
Any event that causes or starts some form of data capture.  
U
UV plane  
See YUV.  
© National Instruments Corporation  
G-7  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Glossary  
V
V
Volts.  
VI  
Virtual Instrument. (1) A combination of hardware and/or software  
elements, typically used with a PC, that has the functionality of a classic  
stand-alone instrument (2) A LabVIEW software module (VI), which  
consists of a front panel user interface and a block diagram program.  
Y
YUV  
A representation of a color image used for the coding of NTSC or PAL  
video signals. The luma information is called Y, while the chroma  
information is represented by two components, U and V representing the  
coordinates in a color plane.  
NI-IMAQ for IEEE-1394 Cameras User Manual  
G-8  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Index  
examples  
advanced programming examples,  
A
acquisition functions, 2-3  
3-9 to 3-10  
introductory programming examples,  
3-5 to 3-8  
advanced programming examples, 3-9 to 3-10  
functions, 3-9  
features and overview, 1-1  
snap using low-level functions, 3-9  
application development, 1-3  
creating an application, 1-4  
NI-IMAQ libraries, 1-4  
G
generic functions, 2-1  
grab functions, 2-2  
attribute functions, 2-4  
H
B
high-level functions, 2-2  
grab functions, 2-2  
buffer management, 4-4  
miscellaneous functions, 2-3  
sequence functions, 2-3  
snap functions, 2-2  
C
trigger functions, 2-3  
camera attributes, 3-3  
using camera attributes in C and C++, 3-3  
using camera attributes in LabVIEW, 4-11  
camera configuration, 1-2  
camera functions, 3-2  
I
image display, 4-8 to 4-11  
introductory examples  
conventions, iv  
high-level grab functions, 3-6, 3-7  
high-level sequence functions, 3-8  
high-level snap functions, 3-5, 3-6  
introductory programming examples, 3-5 to 3-8  
customer education, B-1  
E
error code format, 4-13 to 4-14  
error handling, 4-12  
example programs  
location of files, 1-5  
© National Instruments Corporation  
I-1  
NI-IMAQ for IEEE-1394 Cameras User Manual  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Index  
L
S
low-level functions  
scalable image size, 3-4  
sequence functions, 2-3  
snap functions, 2-2  
system integration, by National  
Instruments, B-1  
acquisition functions, 2-3  
attribute functions, 2-4  
utility functions, 2-5  
M
miscellaneous functions, 2-3  
technical support resources, B-1  
trigger functions, 2-3  
triggering, 4-8  
N
National Instruments Web support, B-1  
NI Developer Zone, B-1  
NI-IMAQ for 1394  
acquisition types, 4-5  
grab, 4-5  
utility functions, 2-5  
sequence, 4-6  
snap, 4-5  
V
acquisition VIs, 4-7  
high level VIs, 4-7  
low-level VIs, 4-7  
VI parameters, 4-3  
Web support from National Instruments, B-1  
worldwide technical support, B-2  
P
programming  
VIs, 4-4  
buffer management, 4-4  
examples, 4-2  
location, 4-2  
parameters, 4-3  
NI-IMAQ for IEEE-1394 Cameras User Manual  
I-2  
ni.com  
Download from Www.Somanuals.com. All Manuals Search And Download.  

Miele Dishwasher 05 585 951 User Manual
Mountfield Lawn Mower HP470 User Manual
NEC Computer Monitor MD304MC User Manual
Nikon Digital Camera 2166 User Manual
NuTone Air Conditioner 9376N User Manual
NuTone Vacuum Cleaner CT650 User Manual
Oregon Scientific Clock Radio BA200 User Manual
Panasonic Cordless Drill EY6535 U1 User Manual
Panasonic CRT Television CT 31SF14 User Manual
ParaBody Home Gym 435104 User Manual