ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

C# exception calling ParticleFilter2 method

Hi,

 

This is my first post and I hope you can help me with my strange problem.

 

I'm trying to call ParticleFilter2 method in my C# code, but it throws an exception when I exceute the code and I don't know why.

 

This is the code:

 

[code]

CWIMAQParticleFilter2Data pfd2 = new CWIMAQParticleFilter2Data();

object oNum = new object ();

 

pfd2.RemoveAll();

 

pfd2.Add(1);

 

pfd2.Item(1).Parameter = CWIMAQMeasurementTypes.cwimaqMeasurementArea;

pfd2.Item(1).Range.Initialize(0, 50);

pfd2.Item(1).Exclude = false;

pfd2.Item(1).Calibrated = false;

 

imaq.ParticleFilter2(imgU8_tmp2, imgU8_tmp1, pfd2, true, ref oNum);

[/code]

 

imgU8_tmp2, and imgU8_tmp1 are image variables and they works with others methods.

 

imaq is the activeX control AxCWIMAQVision and it works properly in other points of the code, but in this one I recived the followin exception:

 

[quote]

An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll

 

Additional information: Exception has been thrown by the target of an invocation.

[/quote]

 

I don't know if I had something bad defined or if I'm forgotting something but, I can't use neither ParticleFilter2 nor ParticleFilter2. However, I can call ParticleFilter, but I need to use some of the new filtters added in the new one

 

Anyone knows what is happening?

 

Thanks in advance

0 Kudos
Message 1 of 1
(3,234 Views)