Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Particle Filter 2 - unexpected behavior

Why don't these two methods of using IMAQ Particle Filter 2 yield the same results?
The sort method I use on the first filter method yields the six main dots.  The same sort method run on the second filter results does not yield the desired dots.
 
Download All
0 Kudos
Message 1 of 5
(6,234 Views)
Sorry, I forgot to save default values for search criteria.  It's correct now.
0 Kudos
Message 2 of 5
(6,228 Views)
Hi,

I took a look at your code and it appears that the reason that you are getting different results is because you are passing it different values.  If you place a probe or an indicator on the selction values being passed to the Partical filter you will see that one is recieving an array with one element and the other has 2. If you make sure that the particle filter is recieving the same inputs then they will yeild the same results.  I hope this helps.

Regards,
GG
0 Kudos
Message 3 of 5
(6,208 Views)
I think two different issues may be causing you problems:

1. The Vision image wire is a pass by reference data type, rather than LabVIEW's typical pass by value. Consequently, using a single image in a branched wire will cause unpredictable results. I suspect this is only an issue in the example you provided, and may not be an issue in your actual project.

2. The API for IMAQ Particle Filter 2 can be difficult to understand. It is, however, able to encapsulate any logical combination of parameters that you want, just not usually on the first try. Review the following from the NI Vision Help, and also look at the corrected VI that I attached.

Range specifies whether to include or exclude the values given in Range Lower Value and Range Upper Value.
When Range is Include (FALSE), the particle meets the criteria if Range Lower Value £ particle measurement < Range Upper Value.
When Range is Exclude (TRUE), the particle meets the criteria if Range Upper Value £ particle measurement or particle measurement < Range Lower Value.

Keep/Remove Particles controls whether particles that meet any of the criteria specified in Selection Values are removed. When Keep/Remove Particles is TRUE, particles meeting any of the criteria are removed. If FALSE, only particles meeting any of the criteria remain.



Hope this helps,
Kevin C.
Message 4 of 5
(6,206 Views)
Kevin C,
 
That was exactly what I needed.  You are correct that I am not passing the image to two different places in my actual code, that was just a demo version for this posting.
 
I was confused about the action of the Range input.  I'm not sure why, the help file is quite clear now that I read it again.
 
I am now getting exactly the results I need.  Thanks!
 
0 Kudos
Message 5 of 5
(6,179 Views)