Golf Simulator Theory
Hi! I'm Martin Paul Gardiner
Electronics and software development engineer and founder of GSA Golf
Below is a number of my golf simulator research and development details - made over the years - that may be of interest to you.
Please feel free to contact me anytime if you have any questions.
VisTrak Ball Spin detection theory
Measuring spin rate from an overhead camera system
A little math is required to deduce the spin rate from the circle arc measured from the rotating and shifting key point pattern on the ball.
Knowing the circle arc length (i.e. the vertical shift of the key point pattern on the ball as viewed from above) and the radius of the ball, the arc central angle can be calculated.
This arc central angle is the rotation in degrees (or radians) for a given time between the two frames (1 ms) and from this, the spin rate can be calculated.
In order to measure the degrees of ball rotation from an overhead camera system that only sees the arc width (chord),
a number of calculations have to be made.
1. Calculate arc length from arc width and ball image radius
Using the formulas:
first find S = height of arc (sagitta or sag)
S = r - sqrt(r² - L²)
r = radius. L = half arc width (chord).
Then find arc length
ArcLen = (π (L² + S²) arcsin (2LS/(L² + S²)) / 180L
2. Calculate degrees of rotation given Arc length and ball radius
Using the formula: CA (Central Angle) = ArcLen * 360 / 2 π r
3. Given time t and the amount of rotation within this time, calculate spin rate in rpm
Using the formula: Spin rate rpm = (r/t) / 6
where r = degrees of rotation
and t is the time in which the rotation occurs.
Divide by 6 to get RPM
Spin rate in RPM = w / 6
Ball spin detection images
Side view of ball spin rotation
Overhead top view of spin rotation
Images were captured with IR Xenon flash and camera exposure down to 25 micro-seconds
Spin dot image processing method.
1. Detect ball in both frames
2. Detect all spin dots with coordinates in both ball images
3. Translate all spin dot coordinates to an origin
4. For side view camera: Rotate spin dots in frame 2 in 1 degree steps thru 360 degrees
For top view camera, shift spin dots down in frame 2 in 1 pixel steps
5. For each step, run a dot matching routine to see if the spin dot pattern matches in both frames and store match result
6. Search match result table for best match.
For side view camera: the degrees of rotation are the best match result
For top view camera: vertical pixel movement has to be converted to degrees.
7. Convert rotation in degrees with frame timing to rpm.
As spin detection with the GSA Golf side mounted system is using 2 cameras to capture the images of the spinning ball,
a direct dot pattern match using just image rotation alone won't always work as the cameras are viewing the ball from slightly different angles.
To fix the problem, image shift on both the x and y axis is also required in the dot matching process.
The above image shows a dot pattern match from the 2 ball images after both rotation and x,y offset shifts.
The red cross hairs in the ball image 1 are of the spin dots in ball image 2 after rotation and x,y shifting.
Note that dots on the perimeter don't always line up and match but that's not an issue as the ROI (Region of Interest) is only around the middle of the ball.
Images were captured with IR Xenon flash and camera exposure down to 25 micro-seconds.
Measuring ball spin with spin dot markings
The big advantage of using balls with dot markings around them, is that you don't have to bend down and align the ball logo to the camera for every shot.
i.e. you can just place the ball on the hitting surface willy-nilly - guiding it with your club or foot - and the system will still detect the correct spin rate and axis
GSA Golf pre-printed Spin dot balls
Price $ 25.00 for 10
Making your own spin dot balls in seconds
Using the supplied enamel black paint pen, you can create spin dot balls in seconds.
First press down on the tip for a few seconds so that paint is absorbed into the hard felt tip.
Then just dab black paint dots into the golf ball dimples in any random fashion all around the ball while holding the ball with your finger tips.
Leave overnight to dry.
Note that in contrast to the (comparatively) very large dots that have to applied to the ball with Uneekor systems,
the dots for GSA Golf spin detection systems are really tiny and so fit into the depression of the dimple.
Thus there is little direct contact with the club and screen with them and thus last far longer.
The advantage of using marked spin dot balls
The main advantage of using spin dot balls is that you don't have to bend down and adjust the ball so that the ball logo or the applied metallic dot is facing in a certain direction.
BTW from what I gather, Trackman and Mevo systems do require you bend down and adjust the ball so that their metal dot - that you are required to apply to the ball - is facing upwards or in the direction of play.
Another advantage is that you can visible see and thus verify the rate of rotation during the video swing playback with visible ball markings.
In contrast, you won't see this if the ball has no markings so you'd have to just believe that the measured ball spin rate is correct.
Spin axis and side spin
As we all know, there's no such thing as side spin but the camera does see horizontal rotation (side spin) as well as vertical rotation (back spin).
As the camera sees the two 2D images of the ball, it would look like the ball is rotating in 2 directions at the same time but that is only due to the spin axis being tilted.
Camera tests revealed that as long as the ball is struck square to the club path (no matter if path is straight, in-to-out or out-to-in), then no side spin or spin axis tilt is imparted on the ball.
If club face differs from club path, then side spin and axis tilt can be detected.
As ball spin axis is 3 dimensional, it cannot be shown as a simple number of degrees.
in order to actually show spin axis, you'd have to calculate a 3D vector which the average golfer wouldn't easily comprehend.
Spin tilt - on the other hand - is simple to understand as it can be shown as a number of degrees.
To calculate spin tilt, a ratio of Side Spin to Back Spin is used.
if Side Spin is the same as Back Spin (i.e. 100 %) , then the ball will be spinning at a 45 degree tilted angle.
if Side Spin is 50% of Back Spin , then the ball will be spinning at a 22.5 degree tilted angle. etc, etc ...
The above shown simple equation is used to calculate the spin tilt.
i.e. side spin 381 / back spin 4064 = 0.09375 / 2 = 0.046875 x 45 = 2.11 degrees spin tilt
As spin axis is 3 dimensional and the cameras are 2D, spin axis itself cannot be directly measured .
However, side spin (i.e. ball side rotation as viewed from the overhead camera) could be measured.
In the above test images, the dot pattern could be seen to have shifted downwards (for back spin) and also rotated some -7 degrees.
Side spin to spin axis conversion is thus required for those golf game software systems that use spin axis.
In addition to the regular ball and club shot video, a separate ball spin video is now also shown.
VisTrak Vcam Spin Axis tilt
The above method of measuring spin axis tilt from the floor mounted VcamSpin system is currently being tested
VisTrak Vcam Spin Axis tilt direction
In order to determine the spin axis tilt direction, 2 matching dots in each frame will be required.
VisTrak Side Spin direction
The above shows the method used to calculate side spin from spin axis tilt.
VisTrak SCX ball spin measurement testing
The above images show the bench test setup for testing the accuracy of the ball spin cameras used in the SCX.
Comparisons between the tachometer read out of the spin rate and the SCX's calculations will be made over a number of different spin rates.
As the tachometer doesn't see spin dots on a white ball, a separate black ball with a single white strip on it had to be made in order for the tachometer to measure spin rates.
VisTrak Vcam Spin, LX and KX ball spin measurement testing
In contrast to the SCX - that sees the ball from overhead - the ball spin cameras in the Vcam Spin, LX and KX3 systems view the ball from the side.
As the amount of rotation is plainly visible in the ball images with these systems, verification with a tachometer should not be required.
VisTrak Vcam Spin
In addition to the current SCX , the floor mounted version (VcamSpin) is also being extensively tested this summer.
In particular, the ability to measure ball spin axis tilt by detecting the center of rotation via the spin dots or ball logo.
Spin axis tilt
The VcamSpin system also measures the spin axis tilt by detecting the center of rotation of the spin dot pattern.
Measuring ball spin without ball markings - the complete process explained
In order to measure ball spin from unmarked balls, super sharp and clear hi-resolution images of the ball have to be captured.
This can only be done with hi-speed (i.e. camera exposure times down to less than 30 micro-seconds in order to eliminate any motion blur of balls traveling at up to 200 mph)
and hi-resolution cameras using IR Xenon flash technology so that the ball dimples can be clearly seen and detected.
Once 2 separate images of the spinning ball have been captured that are only 1 millisecond apart,
dimple edge detection filters have to be applied to the ball images in order to detect the dimples.
As the dimples are viewed on a curved spherical surface, they have to be projected onto a flat surface in order to make any comparisons.
This is done via a process known as UV projection
Once we have both UV projection images, the dot pattern can be extracted.
Thereafter, a series dot pattern matching processes - involving multiple rotation and x,y shifting steps - are performed.
The result of the matching process then determines the amount of ball rotation and its direction within the time of the 2 frames.
From these results, spin rate, side spin and spin axis can be accurately calculated.
Ball spin detection using balls without markings actually uses the same image processing software as balls with spin dot markings.
The only difference is that the spin dots are "virtual dots" instead of "real" dot markings.
In order to create the "Virtual dots", dimple patterns have to be identified which requires sophisticated image processing software like the above shown dimple edge detection software.
As we have already integrated this basic dimple edge detection software into the system, the only next thing to do is to identify the dimple (or virtual dot) pattern from them
and then run them through the below mentioned dot matching image processing software.
Note that: Measured ball spin with balls without markings is currently in development at GSA Golf
It'll be a free update so customers can start off with the marked spin dot ball method and upgrade at a later point for no extra charge.
After all, if the likes of Mevo and Trackman require users to apply a metallic dot to their balls and bend down to align the dot to the direction of play for every shot,
then spin dot balls - that don't require any of this - should be a very welcome blessing.
Xenon flash timing for Stereo S, SCX and VcamSpin (EVS) systems
The above Xenon flash scope images were derived from an optical sensor hooked up to the oscilloscope.
They show flash duration and the flash timing between the 2 ball spin cameras.
Assuming we want to measure up to 10,000 rpm then:
Revolutions per second are 10,000 rpm / 60 = 166 rps.
Revolutions per Milli second = 166/ 1000 = 0.166 rpms.
and finally revolutions per 2.421 milli seconds are 0.166 x 2.421 = 0.4 rpms.
which work out to be around 145 degrees (360 * 0.4) of rotation between frames.
While this is just fine if the camera system is viewing the ball from the side as a full 360 degrees of back spin can be viewed,
but when viewing the ball from above, only around half that (i.e. 70 degrees) of rotation can be viewed before the dot pattern rotates out of the FOV of the cameras.
Thus fame and flash spacing has to halved (i.e. around 1.0 ms) for overhead ball spin camera systems.
The above oscilloscope image shows the camera trigger timing required for overhead ball spin detection .
While this oscilloscope image shows the flash duration and timing required for overhead ball spin detection .
VisTrak Stereo Spin / SCX data capturing method
1. The VisTrak camera detects when a ball is placed in the launch zone area
2. When a ball is detected, the stereo cameras are triggered to grab frames of the ball at the launch position.
3. The VisTrak camera is then placed in full speed mode (590 fps) while constantly checking to see if the ball moves forward.
4. As soon as the ball moves, (strike frame) a trigger signal is sent (via a GPIO line) to the stereo cameras
5. The stereo cameras are programmed to delay any trigger signal by 5 milli-seconds and 5.1 ms
6. The Stereo cameras then detect the height the ball is off the ground and calculates the launch angle and the spin rate based on the ball's rotation within 0.1 ms
7. The ball path - left or right - is detected by the VisTrak camera as is the club speed, face angle and club path
8. The ball speed is then calculated from the distance the ball has traveled from the ball strike frame in the VisTrak camera and the ball's position in the stereo cameras.
Measurung ball spin using the ball's logo
The above image shows how precise the VcamSpin system is at capturing both ball spin and LA with its hi-resolution and hi-speed cameras.
Spin dot ball testing with the ceiling mounted SCX cameras
In order to measure ball spin from ceiling mounted cameras, close up hi-resolution images of the spinning ball are required.
The image shows that the ball dot markings shifted back 31 px which equates to a 22.82 degree of rotation within the 1 ms time frame
which in turn equates to a spin rate of 3803 rpm.
Spin dot ball testing with the floor mounted KX3 and VcamSpin cameras
The same tachometer test as yesterday was made using spin dot balls instead of ball's with a logo on them today.
After a few minor tweaks, all worked out just fine and tachometer readings matched the CP's readings.
Ball speed dependant trigger delays
The new "Speed Trigger" method of delaying the Vcam, Stereo or Ball Spin camera triggers will solve a major issue that the current fixed method of delaying the trigger has.
Namely: the ability to capture images of the flying ball at a set distance from the ball strike position.
The above images illustrate the issue when using a fixed trigger delay.
Depending on the speed of the ball, the captured images of the ball or ball trace are not in a fixed position. i.e. they can appear anywhere in a large FOV.
In order to correct this, a speed dependent trigger delay is required that reduces the trigger delay for high speed shots and automatically increases the trigger delay for lower speed shots.
Using this "Speed Trigger" method, the ball or ball trace will always appear within a small (3ft or so) area.
While this is not so critical for detecting Vcam ball traces (as shown above), it is of paramount importance when capturing high resolution images of the ball for ball spin detection
using 25mm zoom lenses that have a very limited FOV.
Using this method also eliminates the requirement to use a Line Scan trigger camera with VisTrak Stereo LS systems as the effect is similar to a Line Scan trigger camera.
Of course, in order to vary the trigger timing on the fly, the ball speed must be known beforehand.
To do this, a super fast and easy method of ball speed detection has been devised that measures ball speed within the VisTrak frames as they are being captured.
An additional feature is that the user can set and vary the distance the ball is captured from the ball strike position
so that it is consistent for all ball speeds - from small 10 mph chips to full 200 mph drives.
BTW - for those that are interested - this feature is capturing linear ball speed (i.e. the rate at which the ball is moving forward - irrespective of its vertical launch angle)
and not true ball speed that requires that the vertical launch angle be known.
Thus, knowing the rate at which the ball is moving forward and the desired ball image capture distance is from the strike position,
allows us to calculate how long to wait until this desired distance can be reached.
Note: True ball speed is then calculated after the system has acquired the vertical launch angle.
Also note that when using this feature,
any user defined camera internal trigger delays are set to zero as the trigger delay is then controlled by the CP's SpeedTrigger software function.
Frame timing for the VisTrak Stereo S overhead ball spin detection cameras
Amongst many other things, I've had to work out the frame timing for the VisTrak Stereo S ball spin cameras.
i.e. the time between capturing the first frame for the spinning ball and the second frame.
In order to do this, we need to know what the linear speed is of a ball rotating at a certain RPM
This is calculated as follows:
w = RPM / 60 second/minute ×2π rad/rev
where w = angular velocity and rad = radians
v=ωr = linear speed
Example: the linear speed of a ball rotating at 8000 rpm would be :
838 rad/s x 0.021 m (radius of golf ball) = 17.598 m/s
Time required for the ball to rotate by 20 mm at this speed = 1.16 ms
where 20mm is the max amount of linear distance the camera will be able to see in one revolution.
Thus a 1 ms time between frames should be sufficient to capture up to 10,000 rpm.
Accuracy of the overhead mounted Stereo S spin detection cameras work out to be around +/- 50 rpm.
Accuracy of the side floor mounted spin detection cameras work out to be +/- 2 rpm.
The increase in accuracy of the side floor mounted spin cameras is due to the fact that a full 360 degrees of rotation is visible
whereas only 70 degrees of rotation per frame is visible if the cameras are viewing the ball from above.
Comparison of Ball image size VS Stereo disparity methods of vertical launch detection
The above table shows the comparison results of the Ball Image Size VS Stereo Disparity methods of ball vertical launch angle detection.
i.e. for a ball at various distances from the cameras.
While at first glance there's not a great difference in the two methods, the stereo disparity method has one big advantage though.
Namely: Disparity values don't differ when the ball path is left or right, whereas, ball image size will differ greatly with varying ball paths.
i.e. the ball image size will get smaller the further it is away from the cameras and not match up to the ball image size if going straight.
So in order to use the ball image size method of detecting the height of the ball (and thus be able to calculate the vertical launch angle)
the ball image size has to be adjusted in accordance with the ball path.
So what is really required, is the distance the ball is from the camera before we can calculate the ball height.
Measuring ball data with stereo cameras
Stereoscopic vision explained
The above diagram explains the basic stereoscopic principles.
Note: the above diagram shows the stereo cameras for the VisTrak IRV Stereo where the direction of play is from right to left and not from bottom to top as with the regular VisTrak Stereo system.
If the two 2 stereo cameras are aimed precisely at the center line and a ball is placed at floor level, the images of the will appear on top of each other.
The disparity of the ball is then zero (or near zero) and this is known as the "Converging point"
When the ball is elevated, the images of the ball in the camera frames will start to separate. The distance the ball images are apart is the "Disparity".
Using a "disparity to ball height" table and with weighted calculations, the exact height of the ball can be determined.
Knowing where the ball was before ball strike (frame 1) and the trigger delay time on the stereo cameras, the ball LA, speed and path can be determined.
Ball path is simply derived from the divergence the center of the disparity distance is from the center line.
i.e. a perfectly straight shot would show that the 2 ball images are the exact same distance from the center line.
Converging camera test shots
Measuring ball speed from an overhead cam vs a side mounted cam.
Measuring ball speed from a side mounted cam (as with a floor mounted launch monitor), is quite straight forward.
Other than path deviation, the distance the ball has traveled during the camera exposure time or frame time can easily be measured.
Measuring ball speed from a ceiling mounted camera requires more calculations as the apparent distance the ball has traveled will be distorted.
i.e. the higher the launch angle, the shorter the distance will appear.
The above diagram shows how to obtain the true distance from the overhead camera.