Home

National Instruments NI-IMAQ User's Manual

image

Contents

1. IMA4Q1394 Init vi IMAQ Create 1M401394 Snap vi IMAQ1394 close vi General Error Handler vi Grab Figure 4 4 Acquiring an Image Using Snap 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 VIs IMAQ1394 Grab Setup and IMAQ1394 Grab Acquire for 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 O National Instruments Corporation 4 5 NI IMAQ for IEEE 1394 Cameras User Manual 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 Camera Name 1M4Q01394 Grab Setup vi IM4Q1394 Grab Acquire vi General Error Handler vi 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 seque
2. 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 cmo 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 occurr
3. e LabVIEW version 5 1 and higher e LabWindows CVI version 5 0 and higher e Borland C Builder 3 0 and higher e Microsoft Visual C C version 6 0 and higher B 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 amp Automation Explorer MAX to configure your IEEE 1394 camera Set your camera s properties by right clicking on your camera in the IMAQ TEEE 1394 Devices folder in the MAX configuration tree Select Properties from the pop up menu Adjust your camera s 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 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 LabVIEW LabWindows CVI Visual C Borland Application Level Kernel IMAQ Vision IMAQ Vision IMAQ1394 DLL IMAQ1394 SYS 1394BUS SYS OCHI1394 SYS TILYNX SYS National Instruments Corporation Figure 1 1 NI IMAQ for 1394 Architecture 1 3 N
4. 5 et ft Modes Pe he A w5 Figure 4 1 NI IMAQ for IEEE 1394 Cameras Functions Palette NI IMAQ for IEEE 1394 Cameras User Manual 4 2 ni com 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 IMA Q1394 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 IMA Q1394 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 VIs IMAQ1394 Snap IMAQ1394 Grab Setup and IMAQ1394 Sequence require you to wire IMAQ1394 Session In only if you are using an interface other than the default camo 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 secti
5. 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 Full Image Size Acquired Sub image User defined Region d Unit Width Figure 3 1 Scalable Image Format format 7 NI IMAQ for IEEE 1394 Cameras User Manual 3 4 ni com Chapter 3 Programming with NI IMAQ for 1394 Introductory Programming Examples This section introduces some examples for performing the different types of image acquisition Ss 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
6. a A EARN 1 5 Chapter 2 Software Overview TatroducU i eae n en dt da 2 1 Generi Functions A E E EER 2 1 HighzLevel Functions ismine e a O T ES 2 2 Spap PUNCHOMNS A A 2 2 Grab sPUNCUONS ss ara e daub sos Sed ee aA EEA SPREE 2 2 Sequence PUNCHIONS sisien ai IEAA decret 2 3 Trigger FOCOS cia aaa 2 3 Miscellaneous Functions ine arpei i ae a E E EE s 2 3 Low Level FUNcUONS ai a aa a A aa Taa OE TE a E E EA OSTES 2 3 Acquisition FUNCHONS saisie eree iaia E EEE A EERE R AE 2 3 Attibute FUNCION Saa E TE ERS i 2 4 Utility Functions chen ee ia eh 2 5 Chapter 3 Programming with NI IMAQ for 1394 Introducir idiota Andoain 3 1 High Level Functions A igs nies iveede panied had neds eed as steaes seeds 3 1 Low Level Functions issists caiss sisucoads ausceg na ei EE a E E 3 2 Establishing Interface Connections sseesssssresessesesresrertsreetssestsestrsrsentesrstesrsresteseseeses 3 2 Camera FONCHONS airs Assess jas a e E A a a Na a a a E 3 2 Camera Attributes castes nist ei E E A R A EA EE ERE 3 3 Scalable Image Size ctricos ati 3 4 National Instruments Corporation v NI IMAQ for IEEE 1394 Cameras User Manual Contents Introductory Programming Examples ooconicnnccnocncononnconanancnnonnncnn ono nonn conc cnn conc cn nonncrnnonos 3 5 High Level Snap Functions ooocnccconoccnnnnnnnnnnnonocancnncnnonarononnnna noc nncnncnnann canon canos 3 5 High Level Grab Functions resnie e A E 3 6 High Level Sequence FunctionS coconcnocnon
7. acquires an image into a buffer imaql1394Snap Y User specific image processing User Specific Functions y imaq1394Close closes the camera and session imaq1394Close Figure 3 2 Snap Programming Flowchart The Snap1394 c example 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 imag1394Snap is 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 imaq1394Close with 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 imag1394Grab 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 f
8. 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 Read only memory Seconds Set of rules to which statements must conform in a particular programming language 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 Any event that causes or starts some form of data capture See YUV NI IMAQ for IEEE 1394 Cameras User Manual 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 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 Index A acq
9. on a trigger Polarity Ta Timeout ms 1000 Trigger Mode IMAQ Create 14401394 Init vi 14407394 Configure Trigger vi 1401394 Snap vi 1M401394 close vi General Error Handler vi 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 Lab VIEW 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 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 IM4Q1394 Initvi IMAG Create 1M401394 Snap vi IMAG WindDraw 1M401394 close vi General Error Handler vi 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 defa
10. 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 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 imaq1394SetupSequence and specify both the buffer list used for transfers and the number of buffers imaq1394SetupSequence is 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 imaq1394CameraOpen and configures the camera according to the file set up by imaql1394CameraOpen opens Measurement amp Automation Explorer Set up your buffer list and the Buffer list setup number of the frames that need to be skipped between each acquisition y imaq1394SetupSequence initiates a imaq1394SetupSequence sequence to a programmable number of buffers imaq1394Close imaq1394Close closes the camera and session User Specific Functions User specific image proces
11. I IMAQ for IEEE 1394 Cameras User Manual 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 e Include the niimaq1394 h header file in all C source files that use NI IMAQ functions Add this file to the top of your source files e Add the niimaq1394 1ib import library to your project Some environments allow you to add import libraries simply by inser
12. IMAQ NI IMAQ for IEEE 1394 Cameras User Manual Image Acquisition Software Wy NATIONAL March 2001 Edition gt INSTRUMENTS Part Number 370362A 01 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 Finland 09 725 725 11 France 01 48 14 24 24 Germany 089 741 31 30 Greece 30 1 42 96 427 Hong Kong 2645 3186 India 91805275406 Israel 03 6120092 Italy 02 413091 Japan 03 5472 2970 Korea 02 596 7456 Mexico 5 280 7625 Netherlands 0348 433466 New Zealand 09 914 0488 Norway 32 27 73 00 Poland 0 22 528 94 06 Portugal 351 1 726 9011 Singapore 2265886 Spain 91 640 0085 Sweden 08 587 895 00 Switzerland 056 200 51 51 Taiwan 02 2528 7227 United Kingdom 01635 523545 For further support information see the Technical Support Resources appendix To comment on the documentation send e mail to techpubs ni com Copyright 2001 National Instruments Corporation All rights reserved Important Information Warranty The media on which you receive National Instruments software are warra
13. Introduction NI IMAQ functions are grouped according to the following classes e Generic functions e High level functions Snap functions Grab functions Sequence functions Trigger functions e 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 imaq1394CameraO0pen 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 Chapter 2 Software Overview High Level Functions Snap Functions Grab Functions NI IMAQ for IEEE 1394 Cameras User Manual 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 capture all or a portion of a single frame or field to the user buffer imaq1394SnapImage imaq1394Snap Performs a single frame acquisition in an image buffer which is allocated using IMAQ Vision memory management Performs a single frame acquisition in a memory buffer which is allocated without using IMAQ Vision
14. Is 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 Chapter 4 Programming with NI IMAQ for 1394 VIs 4 Call IMAQ1394 Get Image 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 11b 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
15. RM 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 Conventions E bold italic monospace monospace italic NI IMAQ for 1394 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 text denotes items
16. SCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE CUSTOMER S 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 owner s failure to follow the National Instruments installation operation or maintenance instructions owner s modification of the product owner s 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 t
17. Vision memory management feature in which you must first create an image using imaqCreate and 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 3 Note You can find the code examples discussed in this section in the NI IMAQ for IEEE 1394 samples directory 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 imaq1394Snap and 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 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 imaq1394CameraOpen and configures the camera according to the file set up by Y imaql1394CameraOpen opens Measurement amp Automation Explorer imaq1394Snap
18. ay 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 Chapter 4 Programming with NI IMAQ for 1394 VIs IMAG Create General Error Handler vi IM4Q1394 close vi 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 Specifications Brightness Auto_Exposure Sharpness White_Balance Hue Saturation Gamma Shutter Gain Iris Focus Temperature Zoom Pan Tilt and Optical Filter To modify these attributes in Lab VIEW use the IMAQ1394 Attribute VI Set the Get Set para
19. de tddi 4 13 Appendix A Technical Support Resources Glossary Index NI IMAQ for IEEE 1394 Cameras User Manual vi ni com 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 e Monochrome 8 bits pixel e Monochrome 16 bits pixel e RGB 24 bits pixel e YUV 4 1 1 12 bits pixel e YUV 4 2 2 16 bits pixel e 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 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
20. ed 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 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 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 t
21. h 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 Glossary A acquisition window active pixel region address API AQ_ DONE AQ_IN_ PROGRESS area array aspect ratio b B buffer C cache chroma National Instruments Corporation G 1 The image size specific to a video standard or camera resolution The region of pixels actively being stored Defined by a pixel start relative to the horizontal synchronization signal HS YNC and a pixel count Value that identifies a specific location or series of locations in memory Application programming interface 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 Ordered indexed set of data elements of the same type The ratio of a picture or image s width to its height Bit One binary digit either 0 or 1 Byte Eight related bits of data an eight bit binary number Also denotes the amount of memory req
22. he Technical Support section of ni com NI Developer Zone The NI Developer Zone at ni com zone is 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 com for 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 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 Branc
23. he prior written consent of National Instruments Corporation Trademarks IMAQ LabVIEW National Instruments ni com and NI IMAQ are 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 HA
24. ields 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 Kilo The standard metric prefix for 1 000 or 103 used with units of measure such as volts hertz and meters Kilo The prefix for 1 024 or 2 used with B in quantifying data or computer memory A unit for data transfer that means 1 000 or 10 bytes s 1 024 words of memory 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 The total number of horizontal lines in the picture Least significant bit NI IMAQ for IEEE 1394 Cameras User Manual G 4 ni com luma luminance LUT MB Mbytes s memory buffer memory window MSB MTBF mux N NI IMAQ noninterlaced National Instruments Corporation G 5 Glossary 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 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 1 Mega the standard met
25. ieve the image using the imaq1394GetBuf fer function 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 3 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 Async example 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 3 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 Programming with NI IMAQ for 1394 VIs Introduction This chapter describes how to use the NI IMAQ 1394 VIs in LabVIEW 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 process
26. igh level functions High Level Functions The high level function set supports three basic types of image acquisition e Snap acquires a single frame to a buffer e 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 e 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 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 Camera Functions 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 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
27. ing 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 e Location of the NI IMAQ for 1394 examples e Location of the NI IMAQ for 1394 VIs in LabVIEW e Common NI IMAQ for 1394 VI parameters e Buffer management e NI IMAQ for 1394 acquisition types e Acquisition VIs e Triggering e Image display e Camera attributes e Error handling Error code format National Instruments Corporation 4 1 NI IMAQ for IEEE 1394 Cameras User Manual 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 imaq directory 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 oF unctions Motion amp ision o HIMAO IEEE 1394
28. ision that makes up the video scan line For display on a computer monitor a pixel s optimum dimension is square aspect ratio of 1 1 or the width equal to the height 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 The exact sequence of bits characters and control codes used to transfer data between computers and peripherals through a communications channel Points Random access memory 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 resolution RGB ROI ROM syntax T transfer rate trigger U UV plane National Instruments Corporation G 7 Glossary 1 The number of rows and columns of pixels An image composed of m rows and n columns has a resolution of m xn 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 Color encoding scheme using red green
29. le 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 imaql1394ShowError Returns a null terminated string describing the error code National Instruments Corporation 2 5 NI IMAQ for IEEE 1394 Cameras User Manual Programming with NI IMAQ for 1394 Introduction 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 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 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 3 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 h
30. memory management 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 imaq1394GrabImage imaq1394Grab 2 2 Configures and starts a continuous acquisition Acquires the most current frame into the specified IMAQ Vision image buffer Call this function only after calling imag1394SetupGrab Acquires the most current frame into a previously allocated buffer Call this function only after calling imag1394SetupGrab ni com 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 abor
31. meter 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 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 error in no error Figure 4 12 Error Clusters You can use the Simple Error Handler VI Functions Time amp 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 14401394 close vi Figure 4 13 Error Checking using the Simple Error Handler VI NI IMAQ for IEEE 1394 Cameras User Manual 4 12 ni com 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
32. nce 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 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 Number of Images To Decimal IMAQ Create PATATA IMAQ1394 Sequence vi IM4Q1394 Init vi IM4Q1394 close vi Figure 4 6 Acquiring Images Using Sequence Acquisition Vis High Level Low Level Two acquisition VI types are available in LabVIEW high level and low 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 IMAO for 1394 Acquisition Types section of this chapter You can find examples of using the high level acquisition VIs in the examples imaq IMAQ1394examples 11b file Use the low level acquisition VIs for more advanced image acquisition applications The low level V
33. nnnnnnnnnnnnnnnnncnncnnonannonnnncrncranonanncnncnnos 3 8 Advanced Programming Examples 00 0 cceceeeeseessceseeseeeeceseseeeeseeseeeaeeseeeaecneseaeeeeeaes 3 9 Performing a Snap Using Low Level FunctiONS oooncninnnocnonnnoncnnnonncononanonnos 3 9 Performing a Grab Using Low Level Functi0NS conconconcnnnnonnnnnnnnininnnncnncinos 3 9 Performing a Sequence Acquisition Using Low Level Functions 3 9 Performing an Asynchronous Snap Using Low Level Functions 3 10 Performing an Asynchronous Grab using Low Level Functions 3 10 Chapter 4 Programming with NI IMAQ for 1394 Vis TPO AUCH OM ci il ica 4 1 Location of NI IMAQ for 1394 Examples ooooonconncnoconocconnnoncononancnnnonnonnconccnncnnnonncrnncnnos 4 2 Location of the NI IMAQ for 1394 VIs ooooonncccnnocccononcnononcnononcncnoncnnonnnnnnonnncnnncncnnnnnnos 4 2 Common NI IMAQ for 1394 VI Parameters coooococconoccnooonnnonnnncnnnnnnnoncncnononcnanonnnonnnnnnns 4 3 Butter Minatitlan sees oh 4 4 NI IMAQ for 1394 Acquisition TypES oooconccnocnnoncoononncnnonnncnnonnncono non no nonnonnncnn non ncnnconccnnos 4 5 A Genes He cones Sees Senet OO cave tenes EA S 4 5 rabia iia 4 5 SOU irradia 4 6 ACQUISITION Vis asa 4 7 O reai EN DR NN 4 7 A AE ESE aio 4 7 TUS POPU tt EEEE E E E E OEE EE 4 8 Image Dis placas 4 8 Camera Attribute S e ii 4 11 Error Hamlin ges of en n Gass Sede iad A A EER 4 12 Error Code Format aen e EE EEE AE de
34. nted 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 DI
35. on 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 3 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 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 3 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 Ne
36. or IEEE 1394 Cameras User Manual 3 6 ni com Chapter 3 Programming with NI IMAQ for 1394 Calling imaq1394SetupGrab initializes a session for a grab acquisition After imaq13 94SetupGrab 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 imagql394CameraOpen opens i and configures the camera imaq1394CameraOpen according to the file set up by Measurement amp Automation Explorer imagl394SetupGrab configures the camera for a continuous acquisition imaq1394Grab and imaq1394GrabImage copy the contents of the driver buffer to a user buffer You can call imaq1394Grab and imaq1394GrabImage multiple times for high speed acquisition imaq1394Grab or imaq1394GrabImage User Specific Functions User specific image processing l imaq1394Close imaq1394Close closes 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 imaq1394Grab function The program then calculates the area to grab using the current ROI and bytes per pixel In this example
37. 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 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 to from computer memory NI IMAQ for IEEE 1394 Cameras User Manual G 2 ni com driver E external trigger field frame function gamma GUI H hardware hue National Instruments Corporation G 3 Glossary Software that controls a specific hardware device such as an IMAQ or DAQ device A voltage pulse from an external source that triggers an event such as A D conversion 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 A complete image In interlaced formats a frame is composed of two fields 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 execu
38. ric prefix for 1 million or 10 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 Megabyte of memory A unit for data transfer that means 1 million or 10 bytes s See buffer Continuous blocks of memory that can be accessed quickly by changing addresses on the local processor Most significant bit Mean time between failure Multiplexer A switching device with multiple inputs that selectively connects one of its inputs to its output Driver software for National Instruments IMAQ hardware A video frame where all the lines are scanned sequentially instead of divided into two frames as in an interlaced video frame NI IMAQ for IEEE 1394 Cameras User Manual Glossary 0 operating system PCI picture aspect ratio pixel pixel aspect ratio protocol RAM real time Base level software that controls a computer runs programs interacts with users and communicates with installed hardware or peripheral devices 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 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 div
39. s 2 5 miscellaneous functions 2 3 National Instruments Web support B 1 NI Developer Zone B 1 NI IMAQ for 1394 acquisition types 4 5 grab 4 5 sequence 4 6 snap 4 5 acquisition VIs 4 7 high level VIs 4 7 low level VIs 4 7 P programming high level functions 3 1 introduction to programming with NI IMAQ for 1394 3 1 low level functions 3 2 programming environments supported by NI IMAQ for 1394 software 1 2 programming with NI IMAQ for 1394 VIs 4 4 buffer management 4 4 examples 4 2 introduction 4 1 location 4 2 parameters 4 3 NI IMAQ for IEEE 1394 Cameras User Manual 1 2 S scalable image size 3 4 sequence functions 2 3 snap functions 2 2 system integration by National Instruments B 1 T technical support resources B 1 trigger functions 2 3 triggering 4 8 U utility functions 2 5 V VI parameters 4 3 W Web support from National Instruments B 1 worldwide technical support B 2 ni com
40. ses the camera using the imaq1394Close function 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 EEE 1394 Based Digital Camera Specification Brightness 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 imagSetAttribute and imaqGetAttribute functions 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 Chapter 3 Programming with NI IMAQ for 1394 Scalable Image Size TEEE 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
41. sing Figure 3 4 Sequence Programming Flowchart The Sequence1394 c example 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 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 LowLevelSnap13 94 c example 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 c example 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 correc
42. t 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 O National Instruments Corporation 2 3 NI IMAQ for IEEE 1394 Cameras User Manual Chapter 2 Software Overview imaq1394StopAcquisition imaq1394GetBuffer imaq1394GetImage imaq1394InstallCallback Attribute Functions Stops an asynchronous acquisition or synchronous continuous acquisition immediately Copies a frame buffer to a user specified buffer Copies a session s image data to an IMAQ Vision image Configures an asynchronous acquisition and installs a callback function that will be called when an image is acquired Use attribute functions to examine and change NI IMAQ or camera attributes imaq1394GetAttribute imaq1394SetAttribute imaq1394AttributeInquiry imaq1394GetVideoModes imaq1394Get Features NI IMAQ for IEEE 1394 Cameras User Manual 2 4 Returns an attribute for a session Sets an attribute for a session Queries the camera to check that it supports the specified attribute Retrieves a list of video formats modes and frame rates supported by the camera Retrieves a list of features supported by the camera ni com Chapter 2 Software Overview Utility Functions Use utility functions to display an image in a window save an image to a fi
43. t 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 c example 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 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 imaq1394InstallCallback function and starts the acquisition with the imaq1394StartAcquisition function When the buffer is ready the driver calls the callback function allowing you to retr
44. ted The nonlinear change in the difference between the video signal s brightness level and the voltage level needed to produce that brightness 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 The physical components of a computer system such as the circuit boards plug in boards chassis enclosures peripherals and cables 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 NI IMAQ for IEEE 1394 Cameras User Manual Glossary VO TEEE instrument driver interlaced interpreter kbytes s Kword library line count LSB Input output The transfer of data to from a computer system involving communications channels operator interface devices and or data acquisition and control interfaces Institute of Electrical and Electronics Engineers 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 A video frame composed of two interleaved f
45. 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 camo Device 0 caml 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 Chapter 3 Programming with NI IMAQ for 1394 Before you can acquire image data successfully you must open a camera with the imaq1394CameraOpen 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 imaql394CameraOpen cam0 amp sessionID IMG1394 ERR GOOD user code imaq1394C1lose sessionID This example opens a camera named camo When the program is finished with the camera it clo
46. 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 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 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 Italic text in this font denotes text that is a placeholder for a word or value that you must supply NI IMAQ for 1394 represents the NI IMAQ for IEEE 1394 Cameras software package Contents Chapter 1 Introduction to NI IMAQ for IEEE 1394 Cameras About the NI IMAQ Software ccccccecssscessseceeeseeessneeecseeeesnecesaneeeseaeeessaeeesssaeeeseeens 1 1 Application Development Environment cceecceeseceneeeseeceeeeneeeeneeeaeenses 1 2 Configuring Your IEEE 1394 Camera ooconccnocnnonconononcnnconncononnnonncnnncnncnnncancnnno 1 2 Fundamentals of Building Applications with NI IMAQ for 1394 woes 1 3 VANKAT Lati EAE PAAT PEAP ET pda 1 3 The NHIMAQ Libraries issie n iets tenet e eaa Naat 1 4 Creating an Application scada 1 4 Sample Programs seinnor e a
47. ting 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 Chapter 1 Introduction to NI IMAQ for IEEE 1394 Cameras e 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 include subdirectory The import libraries are located under the 1ib lt environment gt subdirectory for the following platforms Table 1 1 Import Libraries Development Environment Directory Microsoft Visual C lib msve Borland C lib borland Sample Programs Please refer to the readme txt file located in your target installation directory for the latest details on NI IMAQ for 1394 sample programs These programs are installed in the sample subdirectory 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 Software Overview This chapter describes the classes of NI IMAQ for 1394 functions and briefly describes each function
48. uired to store one byte of data Temporary storage for acquired data High speed processor memory that buffers commonly used instructions or data to increase processing throughput The color information in a video signal NI IMAQ for IEEE 1394 Cameras User Manual Glossary chrominance compiler conversion device CPU D A DAC DAQ default setting DLL DMA 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 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 Digital to analog Digital to analog converter An electronic device often an integrated circuit that converts a digital number into a corresponding analog voltage or current 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 A default parameter value
49. uisition functions 2 3 advanced programming examples 3 9 to 3 10 asynchronous grab using low level functions 3 10 asynchronous snap using low level functions 3 10 grab using low level functions 3 9 sequence acquisition using low level functions 3 9 snap using low level functions 3 9 application development 1 3 creating an application 1 4 NI IMAQ libraries 1 4 attribute functions 2 4 buffer management 4 4 C 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 conventions iv 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 examples advanced programming examples 3 9 to 3 10 introductory programming examples 3 5 to 3 8 F features and overview 1 1 G generic functions 2 1 grab functions 2 2 H high level functions 2 2 grab functions 2 2 miscellaneous functions 2 3 sequence functions 2 3 snap functions 2 2 trigger functions 2 3 image display 4 8 to 4 11 introductory examples 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 NI IMAQ for IEEE 1394 Cameras User Manual Index L low level functions acquisition functions 2 3 attribute functions 2 4 utility function
50. ult 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 50 on 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 image 255 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 O National Instruments Corporation 4 9 NI IMAQ for IEEE 1394 Cameras User Manual 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 255 00 E AF lo 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 Intensity Graph IMAQ1394 Init vi IMAO Create IMA0Q1394 Snap vi IM401394 close vi General Error Handler vi Figure 4 10 Displaying an Image Using an Intensity Graph To displ
51. w 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 Border Size Image Name error in no error Image Type 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 All Images No Image error in no error ES error out Figure 4 3 IMAQ Dispose NI IMAQ for IEEE 1394 Cameras User Manual 4 4 ni com Chapter 4 Programming with NI IMAQ for 1394 VIs NI IMAQ for 1394 Acquisition Types Snap Three NI IMAQ image acquisition types are available in Lab VIEW snap grab and sequence The following sections describe each acquisition type and give examples 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

Download Pdf Manuals

image

Related Search

Related Contents

Braun Millennium2 - International Railway co  Gigaset A39H-A49H  USER'S GUIDE - Xitron Technologies  Fujitsu fi-6110 User's Manual  KOHLER K-3554-RA-0 Installation Guide  manual tecnico cirsa multipoints (MN951)  Vivanco WTL 2  étude nationale sur la prévalence des infections liées aux soins    Panas。nーc ライ トアッ プ照明典具(屋外用) 取扱説明書  

Copyright © All rights reserved.
Failed to retrieve file