microsoft / Azure-Kinect-Sensor-SDK

A cross platform (Linux and Windows) user mode SDK to read data from your Azure Kinect device.
https://Azure.com/Kinect
MIT License
1.47k stars 613 forks source link

Billiard Ball Tracking #1936

Open los93sol opened 11 months ago

los93sol commented 11 months ago

I'm reworking the old OpenPool project, it originally used a Kinect, then a Kinect V2 for Windows, and I'm attempting to update it to use Azure Kinect DK. In a nutshell it works like this, you mount a projector and an Azure Kinect above a pool table, the Azure Kinect detects balls on the pool table and send a UDP payload with the updated ball positions to a Unity application that projects realtime, interactive scenes onto the pool table based on the movement of the balls. Due to the projection traditional cameras fail to reliably detect. I've been trying to get this working for over a month and am having extremely limited success.

The gist of the code is that the user first crops out the table to narrow what needs inspected, then the user adjusts two sliders for near and far range to further narrow the scope of what needs to be inspected within the Z axis. At this point it should be a rectangle sized to the playing surface and the z range between the top of a ball and the table bed to filter out immediately things like a player leaning over the table or a pool cue not within the playing bounds. The next step is to define a blob min/max size and erode/dialate to fine tune from there.

I'm pretty sure that my method is failing because I am not a CV developer so I'm probably doing something wrong, but I'm trying to avoid throwing AI at the solution because it needs to be very low latent for the projected effects. I believe my first issue is in the fact that the original code normalizes the depth to a value between 0 and 255 and I have no clue how to properly port this.

If anyone has any insight or interest in helping me get this sorted out I would greatly appreciate it