To download NI software, including the products shown below, visit ni.com/downloads.
Overview
The example demonstrates how to calculate a centroid of the portion of an IMAQ image.
Description
In order to find the centroid of a portion of an image a ROI (region of interest) can be used to define the desired portion of the IMAQ image. Since the 'IMAQ Centroid' function does not support ROIs the ROI has to be converted to a image mask before. Masks isolate a part of an image for processing.
Requirements
Software
Hardware
Steps to Implement or Execute Code
Additional Information or References
How Does the IMAQ Centroid VI Work?
http://digital.ni.com/public.nsf/allkb/4F4947441856350B86256B3E0074FD39
Region Of Interest Frequently Asked Questions (FAQ)
http://digital.ni.com/public.nsf/allkb/82C6023BCC87F5CA86256F38006D2C98
**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.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
This example only works with 8-bit image data due to a long standing and occasionally reviled weakness of the "IMAQ ROIToMask 2" function. The example would have been more useful if it instead shows the gyrations one must go through to work with any image bit depth.