ParticleCoefficients Method
Syntax
CWIMAQVision.ParticleCoefficients SourceImage, ParametersArray, ParticlesReport, CoefficientsArray
Return Type
On success, this method returns 0. On failure, this method returns a negative number.
Purpose
Obsolete—Use ParticleMeasurement instead. Calculates the coefficients of all detected particles. This method returns an array of coefficients whose measurements are based on the results from Particle.
Remarks
Use this method with U8 images.
Parameters
SourceImage As CWIMAQImage
The image used by the Particle method. ParticleCoefficients needs this image to get the calibration values.
ParametersArray As Variant
An array containing the parameter list you want to extract. The parameter list contains elements from the enumeration CWIMAQParticleParameters.
ParticlesReport As CWIMAQFullParticleReport
A report object containing the ParticlesReport that the Particle method generated.
CoefficientsArray As Variant
On return, a 2D array filled with the computed particle coefficients. The array columns contain parameter coefficients extracted from a particle. The array rows contain the same coefficients extracted from each particle measurement. The method returns the computed coefficients particle by particle.
Example
Private Sub Run_Click() Dim report1 As New CWIMAQFullParticleReport Dim parameterarray(0 To 3) As CWIMAQParticleParameters Dim coeffarray Dim i ' Do particle analysis CWIMAQVision1.Particle CWIMAQViewer1.Image, report1 ' Calculate the area, orientation, and center of mass for each particle parameterarray(0) = cwimaqParticleArea parameterarray(1) = cwimaqParticleOrientation parameterarray(2) = cwimaqParticleCenterMassX parameterarray(3) = cwimaqParticleCenterMassY CWIMAQVision1.ParticleCoefficients CWIMAQViewer1.Image, parameterarray, report1, coeffarray ' For each particle, display the Area, Orientation, and mark the center of mass For i = 0 To report1.Count - 1 Dim Area Dim Orientation Dim X Dim Y Dim Text As String Dim oval As New CWIMAQOval Dim point As New CWIMAQPoint Dim textOptions As New CWIMAQTextOptions Area = coeffarray(0, i) Orientation = coeffarray(1, i) X = coeffarray(2, i) Y = coeffarray(3, i) Text = "A: " & CStr(Area) & " O: " & Format(Orientation, "##0.00") oval.Initialize X - 4, Y - 4, 8, 8 CWIMAQViewer1.Image.Overlays(1).DrawOval oval, cwimaqDrawModePaint point.Initialize X, Y textOptions.HorizontalAlignment = cwimaqHorizontalTextAlignmentCenter textOptions.Style = cwimaqTextStyleNormal textOptions.Font = "Arial" textOptions.Size = 16 textOptions.ForeColor = vbWhite CWIMAQViewer1.Image.Overlays(1).DrawText point, Text, textOptions Next End Sub