Tracking colored balls from phone camera

2 views (last 30 days)
Hello,
I want to track multiple colored balls with my phone camera (each ball has a different color).
I have edited this script : openExample('vision/MotionBasedMultiObjectTrackingExample')
in such a way that it works live with my phone instead of using pre recored videos and this works quite well. However I have a few problems with which I would like to get some help.
  • When two balls are close together they are seen as one object
  • I would like to distinguish different colored balls
  • I already tried several of the standard online scripts. However these fail to cope with changing light in the background. and this is something this script does very well

Answers (1)

Shashank Gupta
Shashank Gupta on 10 Dec 2019
Hi Dominique,
The first problem which you mentioned about the script which is combining two different color and seeing them as one object arising because the script when create an object during the foreground segmentation convert the image to Binary image and use that masked image to create a bounding box or extract an object from the image, thus it lost the color property of image.
Instead you can first threshold out different color ranges from the image after the foreground segmentation and use them to extract or distinguish different colored balls. In case if you are not familiar with how to approach this, May be this LINK will give you a good head start.
I hope this helps.

Products


Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!