Example Code

Swap Taps from a Camera Link Interface

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

Code and Documents

Attachment

Overview

This example demonstrates how to swap taps for Camera Link interfaces that do not support this feature out of the box.

 

Description

If you have a PCIe-1429 which you need to swap taps you may notice that you cannot currently setup the swap in the camera file as the PCIe-1429 does not have this circuitry.

 

Below is one option to programmatically swap the two taps in LabVIEW. Even though you cannot set the PCIe-1429 to swap taps, you can post process the image to swap the pixels after acquisition.

 

This example uses IMAQ ImageToArray to get the pixel data into an array and then Decimate 1D Array to separate the odd and even fields. Finally, use Interleave 1D Array to swap the two fields and IMAQ ArrayToImage to get the array back to the image data type.

 

IMAQ ArrayToImage is available in NI Vision Development Module (VDM). If you are working with a grayscale image and do not have VDM you can use an Intesity Graph to display your image from an array. This eliminates the need to use IMAQ ArrayToImage.

 

Requirements

 Software

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

 Hardware

  • No hardware is necessary to use this example VI
  • Optional: NI PCIe-1429

 

Steps to Implement or Execute Code

  1. Download and open the attached file
  2. Run the program

 

Additional Information or References

Tap Swap IMAQ image LV2012 NIVerified - Front Panel.png

 

Tap Swap IMAQ image LV2012 NIVerified - Block Diagram.png


Note: If your taps are interlaced vertically, use Transpose 2D Array to rotate your image after IMAQ ImageToArray and use an additional Transpose 2D Array to rotate your image before the final IMAQ ArrayToImage.

 

For color images use IMAQ ColorImageToArray and IMAQ ArrayToColorImage in place of IMAQ ImageToArray and IMAQ ArrayToImage, respectively. Be sure to change the Image Type of IMAQ Create if your image is not 8-bit grayscale. IMAQ ColorImageToArray and IMAQ ArrayToColorImage are available in NI Vision Development Module.

 

Also see: Swap Taps Using IMAQ Interlace community example for another way to swap taps in LV.

 

**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.**

--Michelle

National Instruments

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