LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counter of colour objects

Hi I have problem with my LV program. My counter doesn't work. My program track a colour object and i try to count how many object appear on the image out in for example 60 sec. Counter count to 130 instead of 1 , 260 instead of 2 390 instead of 3. It is because vision assistant works on frames and make 130 matches instead of 1. (on my avi file of course) I dont know how to do properly counter , Can You help me?Smiley Happy

Download All
0 Kudos
Message 1 of 11
(4,461 Views)

Please include the missing template file

C:\Users\Wojtek\Desktop\LABVIEW INZYNIERKA\template 2.png

in your system.

0 Kudos
Message 2 of 11
(4,362 Views)

Ok I attached template. Please look at the blue wire when program is started and open probe watch window then. There is 1 or zero match . I would like to count when is 1 and increment . 

0 Kudos
Message 3 of 11
(4,353 Views)

ok your VI works as expected, it counts one object per frame but the problem is, I guess, that you are reading your AVI file as fast as possible. The AVI file is original acquired at a frame rate of 15 frames per second but your Read AVI and Process loop rate isn't timed and apparently in your case run as fast as 130 iterations (frames) per second.

 

If you add Wait Until Next ms Multiple primitive inside your loop and input 67 (ms), you'll slow down to something closer to real time and get approx 15 hits per second.

 

Hope this helps.

0 Kudos
Message 4 of 11
(4,344 Views)

It's done . The problem is that my result for one cycle is 130 and i want 1 not a 130. Id like to take matches from blue wire and make counter sth like that : If number of matches is (like in blue wire(1 but no 0 )) procedeed and increment , for next full cycle the same. The shift register show from 1 to 130 and it not help me . I need data from blue wire ( 1 or 0) . The counter have to count how many object was on the image . (for 1 cycle 1 , for 2 cycles =2, for 3 cycles =3 when its only 1 object on image ). I need help 

0 Kudos
Message 5 of 11
(4,342 Views)

Ahh you need help ... okey Smiley Happy

 

OK let's recap, here is what I see

1 - You have an AVI file that is supposed to run at 15 frames per second

2 - The AVI file consists of 130 frames (now I see where that value comes from)

3 - What you call a cycle is a repetition of your AVI file so 130 frames or 130 loop iterations in LabVIEW

4 - Each frame detects 1 object and increments your counter by 1

5 - The counter value therefore increases by 130 for every AVI file playback iteration

 

What is it you do not understand? Do you want to only increase your counter every time the AVI file is wrapping (re-starting)? 

0 Kudos
Message 6 of 11
(4,338 Views)

Let me try to do some more guessing on what you are trying to achieve.

  • You are monitoring a surface continuously (so not just analyzing data from a repeated AVI file)
  • Once in a while a particle (object) may cross the surface from one edge and disappear again on another edge
  • When that happens you want to count +1 (an object passed through)

If that's the case what you need to do is to track the object, so increment by 1 when the object appears the first time but stop incrementing if an object is detected in the following frame and the distance to the object in the previous frame is less than a pre-defined value.

That way you know that you are looking at the same object and therefore do not need to increment your counter.

 

This approach gets complicated if multiple objects can be present on the image at the same time.

1 - You'll have to compare the coordinates between them all to see if it's an object present in the previous frame

2 - It becomes much more complicated if the objects start crossing each others or even come close to each others. You'd then have to look at direction gradients, speed and other parameters to identify and separate the different objects.

 

0 Kudos
Message 7 of 11
(4,331 Views)

Yes its complicated but i just divide result for 130 and i have 1 😄 Its simple and satisfy me 😄

You say something about speed of  this object, I would like to measure that but i dont know how to do this . I have Coordinates from boundle box and real time . So maby there is opportunity to count a way of object from oordinates then divide / time and it will be velocity. Here is my present project.

 

0 Kudos
Message 8 of 11
(4,324 Views)

Is this school homework or actual work?

Velocity can be calculated if you know the distance travelled in a specific amount of time and you have all you need in your example to do that. I'll let you figure out how to calculate that distance based on the positions data.

You timing control is still not correct, refer to my previous suggestions if you want a more accurate real time simulation.

 

0 Kudos
Message 9 of 11
(4,318 Views)

Vi with ms multiple

0 Kudos
Message 10 of 11
(4,304 Views)