I would like to emulate the obsolete CWIMAQVision ParticleCoefficients method using a wrapper function with repeated calls to CalculateCoefficients. I am running into problems in how to copy the 1D variant array returned by CalculateCoefficients into the 2D array that ParticleCoefficients is expecting. I am looking for something like the following:
Public Function MyParticleCoefficients( _
SourceImage As CWIMAQImage, _
ParametersArray As Variant, _
ParticlesReport As CWIMAQFullParticleReport, _
CoeffecientsArray As Variant _
) As Long
Dim I As Long
Dim J As Long
Dim varCoeffsArray As Variant
For I = LBound(ParametersArray) To UBound(ParametersArray)
ParticleCoeffecients = frmImagProc.Process.CalculateCoefficients(SourceImage, _
ParametersArray(I), ParticlesReport, varCoeffsArray)
' Copy the results to 2D array that was originally passed in
For J = 0 To ParticlesReport.Count - 1
'I get an error here saying CoeffecientsArray(I, J) =<Type Mismatch>
CoeffecientsArray(I, J) = varCoeffsArray(J)
Next J
Next I
End Function
Any thoughts would be appreciated.
Thanks,
Dave