MLNI – Cut The Ball (Billy Zou)

Cut The Ball

In this assignment, I combined ml5.js with p5.js and developed a simple interactive game, with the help of PoseNet.

Basically, the player should cut the circle with his/her nose. Position of player’s nose is tracked all the time. When player’s nose penetrate a circle, the circle will be destroyed.

Nose Detection

Nose is detected using PoseNet.

Among all body parts, I picked the nose and saved its position in an object. This object would also be used by circle objects to detect penetration.

Penetration

Penetration is divided into to parts. The first part is nose coming from outside the circle and the other part is nose leaving the circle. If both conditions are satisfied, a penetration is detected. Then, the ball will be destroyed and the system will record this action as a successful cut.

Limit Objects

There are two parts in this program that require object limit. First is cleaning the circle cut or expired. Since there will be at most 1 big circle on the screen and a new circle will be generated every 5 seconds. What I did was not displaying the circle when it was not available and when a new object was assigned to the variable, the old one would be cleaned automatically.

When a circle is cut, there will be an explosion effect. In fact it is hundreds of small circles. All circles will be removed after 1 second. Of course they are stored in an array first, and finally the array will be emptied.

I find that what PoseNet does is quite similar to Kinect SDK. I am looking forward to utilizing more interesting machine learning modals.

Leave a Reply