High Speed Video Analysis

11,902 bytes added, 11:31, 26 January 2020
no edit summary
[[File:Kinovea1.jpg|right|thumb|300px|An example of the analysis from Kinovea. You can see a number of markers being tracked. The blue elbow marker has the circle of movement shown, and the knee and shoulder have acceleration displayed.]]High Speed Video is a great way of analyzing your [[Running Form]]. While high end equipment is extremely expensive, the latest smartphones are quite capable and the software is freely available. I'll focus on using the Kinovea software, though I'll look at some of the mobile apps in the near future. I believe you can use Kinovea to evaluate [[Foot Strike]] (initial and maximum force), [[Vertical Oscillation]], [[Overstriding]], [[Arm Position| Arm Swing]], Forward lean, and Impact. I'll add details of how to do this in the near future. =Equipment===Camera==You'll need a camera capable of recording high-speed video at a reasonable resolution. In the past, I've used a GoPro, but their fisheye distortion is a less than ideal. The iPhone 6 & 7, and the Samsung Galaxy S7 will all record HD (1280x720) at 240 Frames Per Second (FPS), which is eight times as fast as typical video. I found that this resolution and frame rate is perfectly adequate for analyzing a runner. Using a lower frame rate and a high resolution did not produce as good results. I found that using the zoom lens on my iPhone 7+ from further away produced better results than the wide-angle lens, as there are is less perspective distortion. You'll also need a tripod and an adapter for your phone. I'm lucky enough to have a professional grade, heavy-duty tripod, but something far simpler should suffice. I purchased a cheap tripod adapter and Bluetooth remote control at the same time. (<jfs id="B00PMDSEXK" noreferb="true" n="Tripod adapter and remote control"/>)==Treadmill==It should be perfectly possible to video a runner outside, but you'll only get a small number of options for relatively inexpensive cameras strides, and it can be tricky to analyze the motion as effectively as you can when recording on a treadmill. The main downside of a treadmill is that most runners have a slightly different running form compared with running outside. Ideally, you want a treadmill that doesn't have a side rail that gets in the way of the camera's view of the runner. This is mostly an issue with this abilitymeasuring movement of the hip from the side, so it's not a huge deal. =Cameras with High Speed Video=Markers=={| classThe Kinovea software tracks motion using visual markers, and I've found these <jfs id=" B010L610EC " noreferb="true" n="50 Colored Ping Pong Balls," nonl="wikitablet"/> worked pretty well. I simply use duct tape looped around to stick them to my clothing. You can read more about the various types of markers I've tested further down this page, and there are other approaches that might work for your situation. I put markers on my forefoot, heel, ankle, knee, hip, shoulder, wrist, and head. Which locations you choose to track will depend on what you're trying to measure.==Clothing==! CameraIt's important to wear clothing that is skintight and plain. Loose clothing will move independent of your body and give incorrect tracking. If the clothing is patterned, it's likely to confuse Kinovea. I wear black tights and a white long-sleeved compression top. Wearing black socks to match the black tights helps avoid create a colored area that can confuse the tracking. Initially I chose predominantly black shoes and covered them with black duct tape for use with white markers. After some experimentation, I found that as long as the marker is a strongly contrasting color to the shoe, and the shoe doesn't have any of the marker color on it, there is no problem.! Resolution==Room==! Pixel CountThe room you use to take the measurements is surprisingly important. It's critical you have lots of light, so that the cameras shutter speed is fast enough to freeze the motion. You also need enough distance between the treadmill and where you set up the camera that you're not getting perspective distortion. A plain background behind the treadmill is best, though you can get the software to work against a visually noisy background. The room should also have a fairly solid floor, so that the running doesn't balance the camera. Adding something of a known size into the frame at the same distance as the runner is needed if you want to calibrate measurements.! Resolution=Recording =|It's worth spending a little time to get the camera positioned correctly. You want the runner to fill most of the frame so that you're not wasting resolution. If you want to evaluate the runner with the treadmill at an incline, don't forget to allow for this when positioning the camera. You want the camera positioned perpendicular to the runner, and as level as possible. Ensure the camera has the near edge of the treadmill in view so that it can see each foot strike. I used a Bluetooth remote control to record my running, and I'd recommend using the remote control even if you have a friend helping you. You don't want to touch the phone when starting and stopping recording as any camera shake will cause problems. I'd recommend recording several relatively short clips (~30 seconds), as high-speed video takes up a lot of memory. The more powerful your PC, the longer the segment you'll be able to process.| rowspan=Evaluation=Kinovea is fairly easy to use, and there's a good online help section. That said, there's a few caveats that you should be aware of, so let me walk you through the process.* If you recorded your video in portrait mode, you'll need to rotate it before importing into Kinovea. I used "3Rotate & Flip"|on the iPhone prior to transferring it, which worked okay. Hopefully the next version of the Kinovea will understand rotated video, as this is a pain. * The next step is to transfer the video to your PC. I used Dropbox, but there are many other solutions. * I'd recommend using the experimental version of Kinovea 0.8.25, as it has some nice additional functionality, and appears to be completely stable. Download from [ Casio EX-ZR100] * The first time you start up Kinovea, I'd recommend changing some of the preferences. ($360Options menu, then select preferences.)Casio EX-ZR10** Click on drawings, then the tracking tab. I find setting the object window to 30x30 pixels and the search window to 90x90 pixels is a good starting point. The default uses a percentage of the overall video window and is too big, causing tracking problems. | 432 x 320** If you have a powerful PC, click playback, then the memory tab. Increase the working zone to 30 seconds and memory to 1024 Mb. | 138* It's fairly obvious how to open your file.2K| 240* The first thing to do is to adjust playback speed so that you're playing the video in slow motion. There is a slider bar just above and right of the playback buttons, so slide this to the left to slow things down. |-* You normally set up a "working window" as a subset of the video clip. For performance, only a small subset of the video can be loaded into memory for analysis. Play video, or click on the main timeline to choose your starting point, then click the "[" button to mark the start. Likewise, at the end of your chosen section use the "]" button. | 224 x 160* If you want to measure distances, you will need to add a line and calibrate it. Simply click on the line tool just below the video window and draw a line over your known measurement. Then right click and select "calibrate", setting the correct distance. The measure should be adjusted for the perspective difference if the known distance is offset from the thing you are measuring. | 35* To track movement, moved to the beginning of your working window. You'll want to right click on a marker and select "track path". It's easier to click the middle of your marker if you're zoomed in, which you do using control and the mouse wheel.8K* Once you'd set your track point you'll see two concentric rectangles and a small cross. The cross marks of the center of the object being tracked, and the inner rectangle should surround your marker, with a little bit of the background included. The larger rectangle is the search window. For each frame, the software looks for the image in the small rectangle within the area defined by the larger rectangle. Getting these areas right is critical to successful tracking. If you right-click near the cross and select "configuration…" You'll get a dialogue that will allow you to tweak the size of the two rectangles. <br/>[[File:KinoveaConfigure.jpg|none| 480thumb|-400px| 224 x 64]]| 14* If you click play, or frame advance, you'll see the line made by the marker recorded on the playback window. If the line doesn't track your marker, but jumps around, it's a sign that the software is finding a better match for your object window within the search window. Tweaking these can often, but not always resolve the problem. The first time you play after asking Kinovea to track an object it will do the analysis, thereafter it will replay the track it recorded. You can see this analyzed section of the video as a pink bar in the time window.3K| 1000* Within the configuration window, you can also set the software to display a metric such as acceleration, speed, etc. You can use this to determine the frame with the highest acceleration, or the slowest speed, or whatever else it is you're interested in. For instance, tracking vertical acceleration of a torso marker and looking for the frame with the maximum value would tell you when the greatest landing forces are likely to be.|-* There is another option on the configuration dialog called "display rotation circle." This will show the circle around which a market is moving.| rowspan=* You can measure angles by clicking the angle icon and then clicking on the video window. You then move the three points so they line up with the joint you're trying to measure, and it will display the angle. With the experimental version, you can right click on one of the points and select "4track path"|and the software will track the three markers, showing the changing angle as things progress. The problem I found with this functionality is that you can't tweak the object and search windows for each point, so it easily gets confused unless you have a really clear marker.=Appendix – Testing Markers=Casio EXThe Kinovea software tracks motion using visual markers. These markers should be round, as the software doesn't understand a rotating marker. So, if you put a red square on your ankle, as that square turns with your leg movement, the software will lose track. You also want the marker to be on a plain background that has good contrast with the marker. I tested a number of approaches to markers, and I found that colored ping-ZR1000pong balls work best.Casio EX==Colored Ping-ZR700Pong Balls==Casio EXI started off using standard ping-ZR400[http://www.amazonpong balls, which work well against a dark background, but I needed something that would work with other colors of clothing and tried painting standard white ping-Exilimpong balls, and then discovered that you could buy ping-Ex-zr300-Digital-Ex-zr300gd/dp/B0085ME7HC Casio EX-ZR300] ($369)[http:/pong balls in assorted colors quite cheaply. I found these <jfs id=" B010L610EC " noreferb="true" n="50 Colored Ping Pong Balls, " nonl="t"/www> worked pretty well.amazonThere is a wide enough variety of colors to work on different attached the ping-Exilimpong balls to my clothing using a loop of duct tape which worked fine in most cases. Ordinary double-Exsided sticky tape is quite strong enough, but I've not experimented with any of the extra sticky varieties. Touching the ping-zr200pong balls to running shoes is a little trickier. The duct tape loop works okay, but they're far more likely to fall off a shoe than clothing. I did permanently attach a pair of ping-Digitalpong balls to some older shoes which works really well if that's an option. I covered the side of the shoe in black duct tape, then glued the ping-Expong ball to it. If you use this approach, I'd recommend dropping the duct tape with sandpaper first, partly to reduce any reflections, and partly to give it a better key for the glue. I also found cutting a small X into the ping-zr200we/dp/B006596OUA Casio EXpong ball where it's glued on helps strengthen the bond. I found that these colored ping-ZR200] ($320)pong balls were the easiest to use, and produced the most useful tracks of any of the markers I've tried.Casio EX{| class="wikitable" style="margin-ZR20Casio EXleft: auto; margin-ZR15right: auto; border: none;"| 640x480- valign="top"| 307[[File:Big Balls.2Kjpg|none|thumb| 120200px|This is a close up of the ping-pong balls with the loop of duct tape attached.]]| 512x384[[File:Bigballs Shoes.jpg|none|thumb|200px| 196Here's a close up of the ping-pong ball on my shoes. You can see that the balls are stuck to duct tape that goes over the reflective patterns on the shoes.6K]]| 240- valign="top"|[[File:Big Balls 2-SS.jpg|none|thumb|200px| 224x160This is how the balls look overall. You can see that the shoulder ping-pong ball still looks round even though my shoulder is rotated away, if this was a flat bit of circular sticky tape, the software would struggle as it would've become partly out of sight.]]| 35[[File:Big Balls 2.8Kjpg| 480none|-thumb| 224x64200px| 14This is the result of Kinovea tracking a number of strides. This is too many tracks over too many strides to be useful for analysis, it's only done to show how successful the marker is at being tracked.3K]]| 1000}==Colored Tape Markers==The advantage of using sticky tape is that you're more likely to have some hanging around that you can improvise with. I simply cut some circles out of blue decorators masking tape, and this worked reasonably well. I think there were some issues with my circles being rather roughly cut, and the blue color was not quite enough contrast against my black tights. I'm going to retest with some circular stickers of brighter colors.{|class="wikitable" style="margin-left: auto; margin-right: auto; border: none;"| rowspan- valign="2top"|[http[File://wwwKinovea Tape-SS.amazonjpg|none|thumb|200px|Here's the tape markers in can see that the markers on the shoulder and knee no longer look round due to the slight rotation of the joint, something that doesn't happen with the spherical ping-Digital-Camera-System-10-30mm/dp/B005OGQXJW Nikon J1pong balls.]] ($400)| 640 x 240[[File:Kinovea Tape.jpg|none| 153.6Kthumb| 400 (5 second max)200px|Like the image of the ping-pong balls above, this is the tracks from many strides. You can see the upper body markers were tracked fairly well, but some of the leg markers failed, and the tracks wander off on their own.]]| 320 x 120}==LED Lights==| 38Juanma K suggested I try using LEDs as markers. He'd successfully used string of LEDs with the unwanted lights taped over. I found an alternative style of LED that are individual lights - <jfs id="B01JYDGC4Q" noreferb="true" n="30 LED Party Lights," nonl="t"/>. These were quite bright and are easy to tape on. The main downside to these LEDs as markers is it you need fairly low light for them to stand out, which can make it tricky to see the overall position of the rest of your body. It can also be a little tricky running in very low light on a treadmill. The upside is that you don't have to worry about your clothing or background colors, especially if you use them in very low light.4K{| 1200 (5 second max)class="wikitable" style="margin-left: auto; margin-right: auto; border: none;"|-| rowspanvalign="3top"|[http[File://wwwLED Lights (2).amazonjpg|none|thumb|200px|Here's the LED lights taped to a running shoe, one illuminated and one GoPro Hero3 Black Edition] ]|[[File:LED Lights ($4003) | 1280x960| 1228.8Kjpg| 100none|-thumb| 1280x720200px| 921This is a close up of one of the little LED lights.6KIt shown here turned off so that you can see it more clearly. Each LED has 3 tiny coin style batteries to power it. You twisted the end to turn the light on and off.]]| 120[[File:LED Lights (1).jpg|-none| 848x480thumb| 407K200px| 240This is a close up of the light illuminated. It's quite bright, but does tend to direct most of the light in the direction of the tube. This means that when it's taped to you the light is not pointing at the camera.]]|-valign="top"| [http[File://wwwKinovea Lights Dark2.jpg|none|thumb|200px|In near darkness these lights work amazingly well for tracking.amazonIt's trivial to set up the object and search Windows, and there are no concerns with clothing color, or background GoPro Hero3 Silver Edition] ($300)]| 848x480[[File:Kinovea Lights Dim.jpg|none|thumb| 407K200px| 120You might be able to get these LED markers to work in dim conditions, but I found it rather tricky. In brighter light than this it's impossible to track the LEDs.]]
=Camera Recommendations=Miniature Ping-Pong Balls==There are pros and cons to the various cameras. * I've used the Casio cameras thought that a number of times, and they are easy to use and smaller sized ping-pong ball would work wellbetter than its launch her cousin. The resolution and quality of My expectation was the higher frame rates it too poor to smallest size would be of much usea little more precise, so don't expect to and the lighter weight would be able to use the 1000 fps modea little more stable. * You can sometimes get [ purchased some <jfs id=35454X937677&xs"B011RAAJRU" noreferb=1&url"true" n="Mini Ping Pong Balls," nonl=http%3A%2F%2Fwww"t"/> that are 0.ebay75"/19mm rather than the normal Ping Pong size of"/40mm.html%3F_from%3DR40%26_nkw%3Dcasio%2Bexilim%2Bhigh%2Bspeed%26_sop%3D1 used High Speed EXILIM cameras on ebay] for a reasonable costin practice, I found it rather harder to get Kinovea to track these small balls.* The Nikon J1 is crippled by its 5 second maximum record time.* The GoPro a good frame rate I had to tweak the object and search windows to be quite a nice resolutionbit smaller, as well as a WiFi remote control* There is no LCD screen for replay and even then it lost track of the video balls on the GoPro, so you need to by the [http://wwwmy lower legs.amazonThe upper body markers which I'd painted orange worked{| class="wikitable" style="margin-Touchleft: auto; margin-BacPacright: auto; border: none;"|-HERO-Cameras/dp/B009PK9SB8 LCD Screen] for $80. =Evaluating the videovalign="top"|[[File:Miniballs.jpg|none|thumb|200px|The simplest approach is to step through the video frame by frame, which is possible Mini ping-pong balls with many software video players. For a more detailed analysis you can extract each frame into a separate photo file using the free open source software [ FFMpeg]full-sized ping-pong ball for comparison. You can use see the small loops of duct tape I used the following command to extract separate images, but you probably want to extract a short relevant clip before you run this command or you will end up with too many image files to handlestick them in place. ]] ffmpeg -i input|[[File:MIniballs Shoes.avi jpg|none|thumb|200px| I glued a couple of mini ping-f image2 image-%4dpong balls to some black duct tape hide stuck to my shoes.jpeg]]Where|[[File:* InputPainted Miniballs.avi is jpg|none|thumb|200px|Here's the name painting of your input video file* imagethe ping-%4dpong balls.jpeg is the name of the output filesSpray painting ping-pong balls can be quite exciting, with %4d replaced by as they so light the frame number=Sample Output=Below are four consecutive frames spray from a recording at 120 fps to give a sense of the resolution and timing can sends them spinning out of the available video from a Casio cameracontrol. These pictures look identical on first glanceI'm sure that this is an excellent technique for applying paint to rectum objects, but there is slight movement visible if you rapidly swap between the imagesand might be an awesome experimental arts technique. {| class="wikitable" ]]
|- valign="top"
|[[File:HSVAKinovea Miniballs1-Sample-0413SS.jpg|none|thumb|x300px]]200px|[[File:HSVAHere you can see the mini ping-Sample-0414pong balls in place.jpg|none|thumb|x300px]]|[[File:HSVA-Sample-0415Kinovea Miniballs1.jpg|none|thumb|x300px]]200px|[[File:HSVA-Sample-0416.jpg|none|thumb|x300px]]|} =Automated Analysis Software=I am hoping to write some software that will perform some automated analysis. Here are my current thoughts on You can see the algorithm that could be used. * Capture:** Shoot so that the runner is shown from the waist down.** Use good light to ensure a fast shutter speed.** The runner should be against a relatively plain background, on flat, level ground. ** Put markers tracks on the runner over the hip, knee, ankle, heel and forefootlower legs are getting lost.* Processing:** Scan the video, extracting each frame.*** This may be the trickiest part, as working with video in code is rather nasty. ** Scan each frame to detect the five markers and reduce them to the x/y coordinates.** For each set of five markers, identify the body positions:*** (The hip will be the highest.*** The knee will be next highest.*** The forefoot will be furthest away of the remaining three.*** The heel and ankle can be found based on the angle between then and the forefoot.** Find the frames that represent the first contact. This will be the first frame where either the forefoot or heel ceases to move.** Find the frames that represent the last contact. This will be the first frame that follows first contact where both the forefoot and heel lower legs are in motion.** For the first contact frame:*** Measure the angle of the heel/forefoot line harder to estimate strike angle and therefore strike index. This can be categorized into FFS, MFS, RFS.*** Find the horizontal distance from the middle of the foot to the hip to check for [[Overstriding|overstriding]]. *** Look track at the angle between the hip/knee and the knee/ankle to determine how straight the leg is. A straighter leg may indicate a higher impact forceleast partly because they're faster moving. ** Evaluate the frames between first and last contact:*** Determine if the heel touches down at any point. This can further categorize FFS.*** Look at the change in knee angle to see how the landing force is absorbed. ** Evaluate the frames between two first contact points:*** Measure [[Cadence)]].*** Measure the contact time, the float time, and the ratio between the two. *** Try to determine paw back from the maximum horizontal distance from the midfoot to the hip and the horizontal distance at contact. *** Try to determine the probable horizontal speed of the foot at contact.*** Try to evaluate the peak deceleration of the hip on landing to determine impact forces. ** Output metrics and possibly key images with overlays of the angles and lines.