Example Code

Extract a Part of an Image Using Vision Development Module for LabVIEW

Overview

 

Use this example to extract a part of an image defined by a rectangle.

 

Description

 

This example is installed with the Vision Development Module and can be accessed from the LabVIEW Example Finder. This example uses IMAQ Extract.vi to extract a rectangular region from a source image and copy it into a separate IMAQ image buffer. IMAQ Extract.vi uses the Optional Rectangle input defined by the left, top, right, and bottom coordinates of the rectangle you want to extract. You can also scale down the extracted region using the X Step and Y step inputs. For example, using an X Step of 2 while reduce the size of the extracted region by a factor of 2 in the x dimension.

 

Hardware and Software Requirements

 

LabVIEW Vision Development Module

 

Steps to Implement or Execute Code

 

  1. Open the VI from the LabVIEW Example Finder under Help » Find Examples » Toolkit and Modules » Vision » Image Management » Extract Image.vi.
  2. Change the Optional Rectangle input to define the left, top, right, and bottom coordinates of the rectangular region that you want to define.
  3. Change the X Step and Y Step inputs to scale the extracted image. 
  4. Run the VI.

Additional Information or References

 

Front Panel:

2017-12-19 13_18_35-Extract Image.vi Front Panel.png

 

J. Calvert

Applications Engineering 

National Instruments

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

Contributors