This week our team continued our efforts to integrate the full system in order to have a smooth-running demo by Monday, April 1st. In terms of our schedule, I am on track.
I continued running tests of our backend on the live video and solving bugs that emerged due to edge cases, and I mainly worked on improving the pocket detection algorithm in the physics model. First, I modified it to account for the direction of the trajectory. I also modified the trajectory output when a ball is directed towards a pocket. Previously, the trajectory drawn would be between the ball’s center and the pocket’s center. However, this leads to an inaccurate trajectory; instead it is more natural to extrapolate the trajectory from the ball’s center to the point on the pocket’s radius which it intersects. Lastly, I make sure to check how close to the center of the pocket the intersection between a trajectory and the pocket is. This is because an intersection with the pocket doesn’t necessarily mean that the ball will be potted. An example to consider would be if the trajectory is right on the edge of the pocket’s radius. Even though there is an intersection, the ball will not be potted as it will not fall into the pocket. Hence, in this case, the trajectory would instead collide with a wall.
Aside from the physics model, I worked on the calibration of our system on startup. I added a method to calibrate the wall detection and pocket positioning using the first 50 frames taken on startup of our system. This is because the wall and pocket locations shouldn’t change much, so we shouldn’t need to re-detect these components on each frame taken by the video. I also added a small modification of our wall detection model to ensure that the left and right walls are to the left and right of the midpoint of the frame (similarly to ensure that our top and bottom walls are to the top and bottom of the frame). This helped inaccurate detection of our walls that caused them to be on the wrong side of the table on some frames.
Lastly, I have been working on improving the ball detection to make it more accurate and reduce false positive detections. I am using a color mask to distinguish the balls from the table, which will allow the balls to contrast more with the table and eliminate false positives caused by subtle contour detections on the table. This is still a work in progress that I am to complete tomorrow (Sunday, March 31st).
In the coming week, I will continue running integration tests to solve any bugs that may arise as we try out more edge cases. I hope to help out with implementing the spin trajectory — a new feature of our system that we have decided to add and began to work on last week. This week I also ordered LED lights, so I hope to install them in the coming week and make sure that the lighting conditions improve our detection models.