<< return to Pixycam.com

Counting moving objects

Hello guys, just wanted to ask, what parameter (data sent by pixy2 to arduino) can you suggest that I can use to count moving objects with similar color. For example, multiple yellow tablets that is transported on a conveyor belt. Thank you.

Hello,
You can teach Pixy2 the yellow object and then point Pixy2 at the conveyer belt and it will tell you the number of objects it sees. It will also give you a separate tracking index (m_index) for each object as it moves.

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:ccc_api

Hope this helps!

Edward

1 Like

Thank you very much! Last question, will it still be possible if 4 randomly spaced tablets will pass through its vision at a time?

Hello,
Yes, 4 should be very reasonable. Pixy2 can track many more objects at a time (hundreds). The limiting factor is usually how many can you fit within the image.

Edward

Hello again! Unfortunately, I have a problem. I can count the yellow tablets in a reasonable manner but when a tablet gets close together, it detects them as one block hence giving an error to the final count. Can you suggest a possible solution? Thank you so much for your reply!

Hello,
You might play with the “max merge dist” parameter (probably reducing it):

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:pixymon_index#color-connected-components-expert-tab

Hope this helps!

Edward

Thank you very much!

Hello again! I already decreased the max merge distance down to 1 and it does not work flawlessly based on how I test it. I thought of using a coordinate to produce a virtual line. As soon as the x y coordinate of the tablets pass through the “line”, I count it. However, the problem is that two or more tablets sitting close to each other is counted as 1. Any possible solution that you can suggest? Thank you very much!

Hello,
My mistake – it sounds like you need to increase the max merge dist. (sorry)

Edward