Originally Posted by bugeyed
Sten Kaiser,AKA stoneage, developer of RacquetTune, has an iOS app, SpeedClock, that measures object speed using the iPhone/iPod camera. He includes instructions for measuring serve speed. Here's a link http://appmaker.se/?m=5&s=1
Measuring the speed of tennis balls with a smartphone is an interesting problem that I have been spending some time on (as note above). Since there is some interest here I though I would explain how I did it. As shown at the end of the speedClock video measuring a tennis serve involves recording a video of the event. This means that you don't have be so careful when to start and stop and you can measure yourself. Then you scroll the video to point where the ball is roughly mid screen. The app then starts analyzing the frames around this point in the video. After some image processing the ball is isolated and presented as colored blobs. By aligning them to one point you get information about how much the ball has moved between each frame. In the video this is done manually, but in recent version of speedClock this is done automatically. This gives you the speed in pixels/frame, fun but not so useful. The picture below shows a screen dump of an actual serve with the mid frame and the ball from 2 frames on each side before speedClock aligns them.
Since the iPhone camera is a passive device there is no way for it to know if it is a small, slow, close object or a big, fast distant object. So you have to tell the app either how far away or how big it is. Since a tennis ball is fairly small and the image usually is a little blurred giving the distance is more accurate. On a tennis court this is seldom a problem since you have known distances marked up i.e. from the sideline to the mid point. With that information the app can convert pixels to meters.
Finally you need the time. As Chas Tennis noted, a smart phone can drop frames in low light. However, you can still get the information of the exact time each frame was captured, so a lower frame rate is not a problem. Still you get the best results when the light conditions are good since the motion blur is less.
There are of course other ways to measure the speed, but all has their own challenges.
tennisplayer_85's app will of course be a competitor, but since speedClock has a much broader aim than tennis serves I don't see it as problem. And the app store could benefit from more serious apps this area (as you noted). With the cost of iPhone apps I also think most people can afford both
Since I am developing as much for fun as for profit I am also interested in seeing how you solved the problem. So I am looking forward to buying your app.
racquet apps for the iPhone/iPad.