Example Code

Extract a Rotated Rectangular Image Selection

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

The example demonstrates how to select and extract a rotated rectangle from an IMAQ image.

 

Description

The 'IMAQ Select Rectangle' function allows the user to specify a rectangular area in the image. It then outputs the coordinates of that rectangular area to be used with other functions. For example, if used with the 'IMAQ Extract' function, the user can output a separate image display that will just show the selected rectangular area. The 'IMAQ Select Rectangle' function also allows the user to select a rotated rectangular area. However, in order to appropriately extract the selected rotated rectangular area in a separate image display, you cannot simply wire the rectangular coordinates into the 'IMAQ Extract' function as done previously. The easiest way to extract the image while maintaining the appropriate rotation angle involves using the 'IMAQ Convert Rectangle to ROI', the 'IMAQ Extract Tetragon' and the 'IMAQ Rotate' function.

 

Requirements

 Software

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

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Run the VI
  2. Select an (rotated) rectangle

 

Additional Information or References

IMAQ Extract Rotated Rectangle LV2012 NIVerified.vi - Front Panel.png

 

IMAQ Extract Rotated Rectangle LV2012 NIVerified.vi - Block Diagram.png

 

 

 

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

National Instruments | Applications Engineer | www.ni.com/support

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