Example Program Drafts

Showing results for 
Search instead for 
Did you mean: 

Create New Image from User Selected ROI

by Active Participant The_Chancenator on ‎12-29-2009 02:43 PM


This VI allows users to select a rectangular region of interest (ROI) and save that ROI to its own image file.  This would be useful if you would like to extract out a portion of your larger image and save it as its own image file.


This VI uses the IMAQ VI's to create a memory location for an image, open that image and then display it. The VI then uses the IMAQ Select Rectangle to open a prompt which allows the user to define a rectangular Region Of Interest (ROI). The IMAQ Extract VI creates a new image for the ROI which is then saved to file. This process is repeated for each ROI that needs to be created in a for loop.

Steps to Execute Code

1.  Select the source image you would like to select ROI's from.
2.  Select the path for the folder that you'd like to save the images to.
3.  Choose how many images to create (how many seperate ROI's you will draw).
4.  Choose an image type.  Image types must match. U8 Grayscale and RGB U32 are supported by the JPEG format.  If you would
     like to use different formats, then change the IMAQ WriteJPEG File to another format that is compatible with these image types.
5.  Run the VI.  Select your ROI, then press OK.


This VI uses Vision and LabVIEW 2009.  It is compatible with U8 and U32 image types.  If you would like to use a 16 bit (or other type of image), then replace the IMAQ Write JPEG File 2 with an image file type that is compatible with your type of image.

VI Snippet

Create Image from ROI_2009.png

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**

Member SeWi

Exactly what i was looking for! Thanks