Version 1.0.0
Usage example video: https://youtu.be/2rfpNHpOLc0?si=scOqSBXc5XAaWAz9
Rendered video example: https://youtu.be/rC_Oi0zrVlU
Information about the DigiBall: https://www.digicue.net/digiball
This is an experimental python-based post-processing program for combining DigiBall data (shared from the mobile app) to a video recording. Distance is selected by the user as well as the collision time of the target, giving linear speed. Once linear speed is available, a lot of information about the shot can be shown in a heads-up display.
requires opencv, numpy, pillow
- Start video recording a practice session or a game.
- Open the mobile DigiBall app and verify that the DigiBall is transmitting data.
- Go to the Settings tab and press the Set Tag Button. Type in a description that describes this practice session / game / match.
- Stand in front of the video camera, and simultaneously signal to the camera while pressing the OK button in the Set Tag dialog box. You can raise your arm, give a thumbs up, etc. This will create a visual queue used later to sync the data file to the video file.
- Verify that the Keep Screen Awake setting is set to Yes (it is by default). This will keep focus on the app and allow Bluetooth to continously record data.
- Set your phone down within 15 feet of the table and away from metallic objects.
- Play or observe the game / match.
- When the session is complete, press the End Tag button to close the session. This is optional.
- Clone or copy the code to your computer.
- Copy both the video file and your digiball.log into the main folder (overwrite the existing demo digiball.log file). This data file can be shared from the app by clicking the Share Data button in the Settings tab.
- Run main.py
- Select the video file with the file select dialog.
- Move the slider so that the video is on the frame with the visual queue sync you created earlier.
- Click the Align Data button.
- Select the tag description that you typed in earlier. (Alternatively, enter the epoch or date-time that aligns the DigiBall data with the current frame.)
- Click Align and verify success.
- Adjust the blue lines with the right mouse button. Modify so that the dark blue lines are on the short rails. All lines should be on the slate-cushion interface.
- Now go through the video and use the left mouse button to draw a red line between the cue ball and object ball / target. Then when the spin magnitude data is shown (in the black box), select the impact time. This is shown with a green vertical line in the black box.
- Do this for each shot.
- Your work is automatically saved as a .proj file extension of the video file.
- Clock time, representing the spin applied if it were where an hour hand of a clock points
- RPM (rotations per second) of ball when struck
- Distance between ball and target
- MPH (miles per hour). Translational speed of ball across surface of table
- Tip Percentage. The percent of ball radius from center that the tip struck the ball (blue dot in the diagram)
- Spin Factor Ratio. The ratio of rotational ball speed to linear ball speed in radians/radius.
- When you are done, click the Export Video button. A video will be rendered with a similar heads-up display. Progress percentage is shown in the console. The filename is the same as the original video but with an _out extension before the suffix.
- Sound is lost. Use ffmpeg to copy the audio from the original video to the new video.