Example Code

IMAQdx: Record Section of Grab to Record to AVI File

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Vision Development Module
  • LabVIEW

    Driver

  • NI Vision Acquisition Software

Code and Documents

Attachment

Overview

The example demonstrates how to save acquired images to a AVI video.

 

Description

The example is based upon the standard Low-Level Grab Async example from the LabVIEW example finder.

The image acquisition is asynchronous since the IMAQdx Configure Acquisition is configured to use multiple image buffers and the image buffer is read with IMAQdx Get Image when an event has been triggered. To accomplish this a dynamic event has been created that triggers whenever the IMAQdx driver reports that a new image has been recorded.

The acquired images are then recorded into a AVI video file. AVI is a container format that can use different codecs with different characteristics regarding encoding and decoding speed as well as compression efficiency. Not every Windows system features the same set of possible video codecs, therefore the IMAQ AVI2 Get Codec Names function reads the available codecs so the user can decide which codec to use. For simplicity the example uses the first available codec.

 

Requirements

 Software

  • LabVIEW 2012 Base Development System (or compatible)
  • Vision Development Module 2012 (or compatible)
  • NI-IMAQdx 4.0 (or compatible)

 Hardware

  • NI-IMAQdx driver supports the following buses and standards:
    Gigabit Ethernet Cameras Supporting GigE Vision, FireWire IEEE 1394 Cameras, USB 2.0 Cameras Supporting Microsoft DirectShow (often called 'webcam'), USB 3.0 Cameras Supporting USB3 Vision

 

Steps to Implement or Execute Code

  1. Open the attached file
  2. Select the path to the AVI file
  3. Select the camera name
  4. Run the VI
  5. Activate the Record button to start writing image frames to the AVI
  6. Release the button to stop recording

 

Additional Information or References

IMAQdx Low-Level Grab Async with AVI Recording - Front Panel.png

 

IMAQdx Low-Level Grab Async with AVI Recording - Block Diagram.png

 

KnowledgeBase: What Is the Difference Between NI-IMAQ, NI-IMAQdx, and NI-IMAQ I/O?
http://digital.ni.com/public.nsf/allkb/0564022DAFF513D2862579490057D42E

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

Regards,
Isaac S.
Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.