Disappearing Time

Time seems to disappear so quickly and I always have so many things to do. I get ready for work, go to work, come back from work, go swimming, go shopping, cook, eat and wash up dinner, watch the news, write an entry on my blog, read a bit of my book and go to bed.

I seem to need a lot more time. I’d like some time to work on my side projects, some time to make and write Christmas cards. What I’m probably not very good at is prioritising. I’m writing this blog post when I could be doing something more important. Never mind, there’s always tomorrow!

Fake owls

Today whilst I was out I thought I saw an owl. The owl appeared to be sat on top of some high voltage wires in the railway substation. I took a couple of photos with my phone, a train came past, and the owl hardly moved. I got a bit suspicious so I went on Google Street View to see what the owl was actually sitting on and this is what I saw:

The owl is of course a complete fake. It’s there to deter other birds from sitting on the wires in the substation which could lead to them shorting out the power.

In my defence it was getting quite dark so I couldn’t see the fake owl very clearly. Next time I’ll just look out for the foxes, they’re definitely real.

Training Schedule

I’m starting to get back to fitness. I’m able to run at a moderate pace for 10 miles but I’m still lacking my old strength and endurance. I need a proper training schedule to ensure I’m going to be ready for my marathon in just 4 months time.

Here’s what my schedule looks like:

Monday: Swimming for 1 hour, running every day is not a good idea and a swim is great for stretching and endurance.

Tuesday: Reps run with Worthing Harriers, this is typically hills, fartleks or some other sort of reps session.

Wednesday: Rest day, I will probably use this for a shorter run as I get into 2016. Use Wednesday to do strength work at home working on the core and upper body.

Thursday: Moderately long run with Worthing Harriers, this is typically a 8-11 mile run around the streets of Worthing.

Friday: Long afternoon run if possible, I get the afternoon off work on a Friday so I need to try and use the light in the afternoon to go for a run going into the countryside.

Saturday: Race (if there is one) otherwise short tempo run. Need to run 10+ miles at race pace starting around 8 minute miling upping to 6:30 miling by March time.

Sunday: Morning long run with Worthing Harriers, I need to start around 12 miles, upping this to 20+ miles in March.

That’s my plan and I will try to stick to it as close as possible from now on (eek).

Level crossings part 2

Two weeks ago, I discussed an outline of how to predict when then level crossing near my flat is open or closed. I made an aside that I could use a camera to detect when the crossing is open or closed.

I’ve realised that I have an old tablet that will work great for this purpose. I can put it on the windowsill plugged into it’s charger and use it to report back on the level crossing.

Now I just need to implement the technology to make that happen. I’ve got two choices here: it’s a windows based tablet so I can create an executable using something like openCV or I can create a browser based application.

A while back I started doing a project which relied on HTML5 to do some basic image recognition. I’ve decided I’m going to try that approach again because it makes my solution so easy to port. If I get a new device, as long as it runs the Chrome web browser then it should be able to do the exact same task. The development also requires only two really simple tools, the browser and a text editor to write code in.

Here’s the plan of attack:

  1. I’m going to create a page with a HTML5 video element and a 2D canvas element
  2. The video from the device’s camera is set to be the source of the video
  3. At fixed time periods the video is copied into the canvas
  4. Once an image is loaded into the canvas, the individual pixels can be read
  5. The pixels are read in an intelligent way to determine if the level crossing lights are flashing or not.
  6. This data is sent to the server

The first four steps are fairly trivial to implement once you know what you are doing. The fifth step is where the magic happens.

This image recognition task is actually quite simple. Determining if a light is on or off is a simple task. What makes the task more difficult is the fact that the lights are sufficiently far away from my flat that they are quite small, they are also right behind a set of traffic lights and the lighting conditions change dramatically throughout the day.

My first approach is to try to resolve the barrier lights from the traffic lights. Its just about possible with the camera on the tablet. I simply need to compare the red value of the point where the lights are against the red value of another reference point just to the side of the barrier lights. I need to make sure I choose this reference point such that it is always darker than the lights no matter what the illumination conditions.

Now I just need to set the camera very still on my windowsill!

I set the webpage to requests a PHP page whenever the state of the crossing changes. The PHP page updates a MySQL database. I’ve then created another simple PHP page which reads the data from the database and displays a pretty graph. In my third post I’ll report on my data findings.

Advent

It’s the first of December so it’s time to get out the advent calendar. I’m not a huge fan of the “traditional” advent calendar. What’s the point of tiny poor quality chocolates? If I wanted the chocolate I wouldn’t buy it in over-priced calendar form.

I do have a more contemporary advent calendar. I’m participating in the Advent of Code. Instead of chocolates, two puzzles are served up each day which must be solved using code. The challenges are all Christmas themed and are (at least so far) fairly easy and fun. Even a programming beginner could have a go, it’s a great way to get started.