Example Program Drafts

Showing results for 
Search instead for 
Did you mean: 

Programmatically Create Polygon Region of Interest (ROI) and Mask

by Member Daniel_H1 on ‎11-09-2012 10:51 AM

This VI shows how you would convert a series of points (x-pixel, y-pixel) into a polygon ROI and an image mask. You could use this to programmatically create your ROI or Mask from the results of other machine vision functions. For example, if you used pattern matching to find several items in your image, you could use their locations to programmatically create the ROI and mask.

This was created in LabVIEW 2012, with NI-IMAQ 4.7. A version saved for LabVIEW 2009 is also attached.

1) Download the attached "sample poly ROI.vi"

2) Click the folder on the "Image Path" control in order to browse. Select an image you want to view.

3) Run the VI

4) Modify the points to alter the ROI and Mask

Block Diagram Steps:

1) Load an image from file

2) Extract the ROI

3) Unbundle the "Contours" array of clusters, then index out the first contour

4) Create the image that will be used for creating the mask

5) Define the points for the polygon. The points are in the format of (X-pixel, Y-pixel), where (0,0) is the top-left pixel.

6) Concatenate the Points into a 1D array

7) Bundle the Poins array into the Contour cluster

8) Write the new ROI information back to the image property node

9) Create and display the mask, using the ROI to define the Mask

poly roi mask block diagram.png

poly roi mask front panel.png

Member aveo

Amazing program. This program made my job so easy. Thank You Daniel.

Member jhonduar

Empezando Estoy pana estafa labview cuando abro tu programa la parte de imaq roit o mask esos iconos me aparecen en blanco q debo hacer

Member Daniel_H1
Member jhonduar

yo tengo instalado ni imaq 2012 porqte tengo labview 2012 tu crees q pueda instalar el 2014 para q me aparezcan esos iconos?