Example Code

Image subtract and multiply by RGB Gain

Code and Documents

Attachment

Overview

This code takes two images from IMAQdx compatible cameras and will take the absolute difference of the images and multiply that difference by an RGB gain.

Description

This is a relatively simple VI with a state machine architecture. There are three states; Snap, Process, and Close. The initial state is the Snap state, which will snap images from both cameras, or one camera if desired, and then pass these images into the Process state. The Process state waits for a value change event on any of the R, G, B gain values and then processes the image. The Process state loops back into the same state, unless the Snap or Stop buttons are pressed. The final state is the Close state which disposes of all the image references.

Steps to Implement or Execute Code

  1. Download the attached VI in whichever version you will be able to run
  2. Select Camera 1 and Camera 2 on the front panel
  3. Run the VI
  4. Modify one of the RGB gain values to fire the processing event structure and process the images
  5. Continue to modify the gains, or snap a new image

Requirements

Software

LabVIEW 8.6 or later and the associated Vision Development Module and Vision Acquisition Software

Hardware

Any IMAQdx Compatible camera, you can use two cameras if you would like however the delay in the sequence structure should allow you to snap an image from the same camera twice.

Additional Images or Video


Subtract and Gain Example.JPG

VI Snippet

Subtract and Gain LV2012.png

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

Contributors