To download NI software, including the products shown below, visit ni.com/downloads.
Overview
The example demonstrates how to find particles and calculate the centroids of those particles.
Description
The 'IMAQ Particle Analysis' function will only operate on a binary image. Thus, the center of mass calculation returned is based upon all of the pixels in the particle having the same intensity (again since the function operates on a binary image). However, the particle analysis function can still be used to calculate the center of mass for a particle while taking into consideration the varying intensities of the pixels in a particle.
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
Remark:
A previous version of this example uses an own algorithm for calculating the center of mass (centroid). Since there is already a standard function in the VDM called 'IMAQ Centroid' that does the same thing, the algorithm was replaced by the standard function.
**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.