LabVIEW manually selects multiple ROIs in an IMAQ image

LabVIEW manually selects multiple ROIs in an IMAQ image

A VI was designed to generate and overlay a series of regions of interest (ROIs) on an image and display them in the IMAQ image control. Want to pick some of them for subsequent processing. Can the ROI be manually selected in the control?

Programmatically generated ROIs are usually saved into predefined clusters called ROI Descriptors. In other words, to select a subset of ROIs from an ROI group, getting the subset requires a rule to identify which one is selected. Within Region is a useful and convenient rule that can be set manually using the image display control.

ROIs generated programmatically are usuallysaved to a pre-defined cluster called ROI Descriptor. To select a part of ROIsof an ROI group, in other words, to get a subset needs a rule to identify whichone is selected. Being inside a region is a useful and convenient rule that canbe set manually with the image display control.

The IMAQ image display control provides some tools for "select image area" on the tool palette, as shown in the figure below. Areas can be easily drawn on the displayed image using these tools.

The IMAQ image display control provides sometools on the tool palette for "selecting an area of the image", as inthe following figure. You can use these tools to easily draw a region on thedisplayed image.

NOTE: Although it is also an ROI, this ROI (called the control ROI) belongs to the indicator, but not to the IMAQ image overlay (called the resulting ROI).

Notes:  Although it is ROI as well, this ROI (namedcontrol ROI) belongs to the display control, but not to the IMAQ image overlay(named generated ROI). The following VI code snippets and steps will show how to use the rectangular ROI tool
of the IMAQ image display control to select a subset of the generated ROI. These steps assume that you already have a VI with IMAQ image display controls on the front panel, and that you already have a set of image ROIs in the ROI descriptor.

The following VI snippet and steps will showyou how to use the rectangle ROI tool of IMAQ image display control to select asubset of generated ROI. These steps assume you already have a VI with IMAQimage display control on the front panel and a set of image ROIs in an ROIDescriptor.

1. Display the generated ROIs by overlaying them on the IMAQ image. You can use MAQ Overlay ROI in Vision and Motion>>Vision Utilities>>Overlay.

2. Add a control ROI via the Rectangular ROI tool on the image display control. A while loop or event structure can be added in the graph to wait for this user action.

3. Use the property node of the IMAQ Image Display control to get the ROI descriptor of the control's ROI.

4. Use IMAQ to ungroup the generated ROIs into ROI descriptor arrays in Vision and Motion>>Vision Utilities>>Region of Interest. The array is easier to index and identify individually.

5. Compare the generated ROI with the boundaries of the control ROI and use the conditional index of the for loop to pick out the generated ROI within the control ROI. This identification logic can only handle rectangular control ROIs.

6. Clear the overlay set in step 1 and overlay the regrouped selected ROIs to be displayed. These functional VIs used here can be found in the Vision and Motion>>VisionUtilities>>Region of interest and Vision and Motion>>VisionUtilities>>Overlay subpanel.

7. The Selected ROI descriptor contains only the selected ROI. It can be used in the subsequent process.

The manufacturer does not provide LabVIEW examples. According to the relevant instructions of the communication protocol, the program suitable for the project is written. A screenshot of the program is shown below.

​The source program is near the word file, double-click to download

Guess you like

Origin blog.csdn.net/bjcyck/article/details/131840048