Example Programs

Showing results for 
Search instead for 
Did you mean: 

Extracting a Freeshape ROI


The example demonstrates how to extract a free shape ROI and mask the image with that ROI.



A ROI or region of interest is used to select the important area of an image for processing. ROIs can be used to greatly reduce image processing time. Recall that LabVIEW currently supports rectangular images; this means that image data must be stored in 2D array/ matrix form. This example describes the most robust means of extracting ROIs.

What happens when users want to use a freeform, non-rectangular, ROI?
The most common method of extracting an ROI is creating an ROI descriptor using the rectangle selection tool and the IMAQ Construct ROI(VI), from here the ROI is extracted from the original using IMAQ extract tetragon(VI). Freeform ROI descriptors are also made using IMAQ Construct ROI(VI). In order to extract non rectangular ROIs special steps are taken and are described in this example.




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


  • No hardware is necessary to use this example VI


Steps to Implement or Execute Code

  1. Open the attached file
  2. (Optional) Change the path to the preset image in the block diagram (step 1)
  3. Run the VI
  4. Select a ROI in the dialog shown with any of the tools
  5. Click OK
  6. See the result in the image control


Additional Information or References

Dialog VI that is displayed after the VI is launched

Extract Freeshape ROI - Front Panel GUI 1.png


Main VI

Extract Freeshape ROI - Front Panel 2.png


Extract Freeshape ROI - 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.**