From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Long time pre-trigger image streaming application

Code and Documents

Attachment

Overview

These two codes are long time pre-trigger image streaming application and the file reader.

  • Image streaming to binary file with Long time pre-trigger.vi
  • Read Binary File with header info.vi

Description

For long time pre-trigger image streaming application like 10 minutes, we need to use binary file as circular buffer because cannot use memory area like queue.

Requirements

Software

LabVIEW 2015 or compatible

NI-IMAQdx 15.5.0 or compatible

Hardware

Camera for IMAQdx

(I use PC camera of DELL latitude E7250. And I set the PC camera to RGB_U32 in MAX because the code is for RGB_U32.)

Steps to Implement or Execute Code

<MAX>

1. Set Camera to RGB_U32 in MAX.

<Image streaming to binary file with Long time pre-trigger.vi>

1. Open the VI.

2. Set the File Path if needed.

3. Select the Camera Name.

4. Set the Pretrigger size.

5. Run the VI.

6. Push the Trigger button.

7. Push the Stop button.

<Read Binary File with header info.vi>

1. Open the VI.

2. Set the File Path.

3. Run the VI.

Additional Information or References

<Header Info>

The header info is prepended to the binary file, and file reader application uses the header info to read image in order from the binary file.

無題.png

<“Pre_trigger” state>

"Image streaming to binary file with Long time pre-trigger.vi" is state machine code, and, on "Pre_trigger" state, it stores the image to binary file as circular buffer.

無題.png

<“Trigger detection” and “Post_trigger” state>

On “Trigger detection” and “Post_trigger” state, the code stores image as below.

無題.png

If these codes don't match your application, please improve this code on your own.

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

Contributors