Sunday, 27 October 2013

Raspberry Pi Camera - Injury Diagnosis

When I'm not doing Dad Geekery, one of my other hobbies is keeping fit by running, cycling and swimming.  For a while I've been trying to think of a way to combine the two.  The arrival of a Raspberry Pi camera module over the summer gave me an idea....

Over the past couple of years I've been suffering from frequent left calf muscle injuries.  Basically when I run I get a sore left calf and occasionally I get a minor muscle tear.  Earlier in the year I bit the bullet and went to see a physio about it.  The advice from the physio was:

  • I needed to rest it to let it heal, and
  • The reason I get calf injuries is because my left leg is weaker then my right leg, (in fact the whole of the left side of my body is a relative weakling).

So the recommendation from the physio was to rest and then also to do a lot of left side strengthening, (e.g. knee bends, hopping up and down steps, doing interesting things with elastic resistance bands).

The "weak left side" diagnosis rings true through some other observations:
  • When I swim breast stroke I'm told my left leg kicks much less strongly than my right leg,
  • When I cycle and get tired, my left knee drops inwards and knocks against the cross bar,
  • When I went to buy new running trainers from a running specialist they did video analysis as I ran on a treadmill.  This showed my left foot landing and then rolling inwards too much which puts stress on my knee and calf muscle.

So when two things happened at once in a week during August 2013 (calf going ping again and the arrival of my RasPi camera module) I decided to do some scientific analysis.  The plan was to use my RasPi camera module to analyse me doing some physical jerks, do a period of strengthening and then repeat the analysis.

So first I needed to have a decent setup for the camera module. Using the magic of Lego I built this rig:

So the Lego keeps it all stable and with a hinged Lego piece (hidden by the ribbon cable on the image) allowing me to adjust the camera position up and down.

I then set this up outside on my patio so as to be able to record video of myself doing various exercises.  Here's the setup, (essential use of my old Lego case to keep it off the ground):

Using this command I could record a short video:
raspivid -t 10000 -o video1.h264

I could then turn this into an MP4 using this command:

MP4Box -fps 30 -add video1.h264 video1.mp4

(I had to install the MP4Box application to do this).

Here's a video of me jumping on the spot:

Now I think just by watching the video you can see my left foot being placed out wider than my right foot and my knee dropping outwards.

Transferring the video to a PC and using Quicktime, I could advance the video frame by frame.  I select the frame where my foot was planted and just about to spring up, so to my mind the point where there is maximum stress on my leg.  I did a print screen, pasted the image to Word and then drew straight lines from the middle of my knee downwards.  Here's the image I got:

So the line on my right leg goes down pretty straight from the middle of my knee to my heel.  On my left leg my knee is really turned outwards. More evidence of my dodgy left side.

Here's the equivalent for me running on the spot.  First the video:

...and then a split screen image:

Same again, this time for me skipping.  Video first:

...the the split screen image:

So overall, some excellent evidence of my weakling left side and how it impacts various exercises.

Over the course of August I embarked on a series of strengthening exercises to build up my left side.  I did a bit more strengthening in September / early October but at that time was more focused on training for a 10K run and then a multi-stage bike ride I was doing in middle of October.  The 10K race then the bike ride passed with no more injury and no evidence of my right knee knocking the cross bar.  

I ran this morning and, whilst I didn't get injured again I felt a bit of a niggle in my left calf.  It was cold day, the route was hilly and I'm a little paranoid about it; all things that might have contributed to the niggle.

So I decided to re do the analysis.  First the jumping:

...with the image:

The running video:

<Insert this when YouTube stops being so dumb>

...with the image:

...and finally the skipping video:

...with the skipping image:

Now I did two things differently in October when compared to August.  Firstly I had the camera aligned differently so you can't see my feet and secondly I only took 5s of video footage. A bit daft that!

My observation is that things are straighter now than they were back in August.  The straight line from my left knee runs down the middle of my calf.

So my strengthening exercises are working and I have tangible proof of this.  Thanks Raspberry Pi camera board!  However I'm not 100% sure everything is super straight so I will come back to this in a couple of months and re-run the exercise.