Tuesday
Apr272010

Laying down tracks

I'm currently saving money, and in August, I plan on buying an adventure touring motorcycle.  Specifically, I'll be buying the KTM 990 Adventure.  Anyway, I could talk all day about adventure touring, and motorcycles, and my exploits on my old KLR, but the point is, I've been researching routes that I plan on riding.  Part of this research is creating GPS tracks to follow over specific passes/trails I want to ride.  I looked around for easy ways to do this and I setteled on using Google Earth to create my tracks, and then convert those tracks to GPX so I can upload them to my unit (a Garmin Gecko 201, and iPhone 3Gs).   Just a note though, Garmin has a program called MapSource, that you can also use to do this type of trip planning.  I just wanted to stick with GE because I use Linux at home, and that's what I'll be doing most of my planning in.

I created a quick screen cast that shows how to create your tracks and then convert them.  I did this at work, and I didn't have a mic, so it's silent.  Sorry about that.  The key points to take from the video are:

1. When creating a new track, you have to leave the dialog open while you are creating.  It's not super user friendly IMO, and may throw you off at first.

2. You can right click to erase a placed point on your track.

3. You pan around the map with the arrow keys while creating tracks.

4. Save your track as KML not KMZ.

5. Use the following command to convert your track: gpsbabel -i kml -f file.kml -o gpx -F file.gpx

Here is the video:

 

Other misc updates:

1. I'm still slowly working on the ski stats xml file.  I've decided I don't need it until next ski season anyway, so I'm taking my time.

2. I updated the README file in the QTCanon repo to have instruction on how to build the app on Linux. On Windows you still need to have the Canon SDK to build the app.  I hope to have binaries built soon for download.

Monday
Apr122010

New bike

Spring's here, and I'm done with skiing.  It's warming up and the sun is out until about 8 these days.  Must be time to mountain bike!  I decided to use a hefty chunk of my commission this quarter to get a new bike.  I really didn't want to spend more then $1500, and I wanted a 29er after discussing the many benefits with my buddy Brandon (he's a bike nut).  After looking around, it seemed like Gary Fisher had the best selection of 29ers.  I mulled it over for a few days, and ended up getting a Gary Fisher Mamba.  It's the lowest end hard tail 29er Gary Fisher makes, but I think it's more than enough bike for me at this point.  I'm sad to say, but I haven't gotten much done in the way of the time lapse app due to the amount of ridding I've been doing on this thing.  Let's just say my butt is perpetually sore right now and my legs are in a constant rubbery state.  I logged a ton of miles in and around the open space near my house as well as a super fun trip up the first segment of the Colorado Trail last Saturday.  I managed to get some decent footage from the ride as is evident in my poorly edited video:

 

So other than riding my ass off, I do have a few updates on the skiStats.pl script.  I've been plowing through the ski resort info for the north_america.xml file, and I've got a good portion of the East Coast knocked off, all of CO, most of MT, and UT, and I'm starting on New Mexico.  I'm sure this is going to stretch out over at least another month, but it'll be pretty nice when I've got it all working.  Still to come:

 

  • Get the Windows version of QTCanon working from Github
  • Create the project page for QTCanon
  • A ton more mountain bike riding
  • Some motorcycle riding with video to follow

 

 

Wednesday
Mar312010

Updates for the week

I've got the QT-Canon repo moved from SVN to Git, and you can now check out the code from my GitHub.  On Ubuntu, you can check out the repo and, if you've got the QT SDK installed, build and run the application.  On Windows, you can check out the code, but you can't build it yet, because I haven't figured out what I need to (and am allowed to) include from the Canon SDK.  Give me a few days, and I should have this worked out.  As far as the Mac goes, well that could never happen, I'm not sure yet.  I guess I'll wait and see what happens once people start using this thing.

On the gpx_tools front, I've made some good progress the last few days.  I know I should be working on the algorithms to figure out how many runs you skied and vertical skied, but I got the idea in my head, that the script should know which resort you skied at and present you with data about that resort.  Because this is a brute force problem, I figured I'd just hit it head on.  I started with a GPX file that had waypoints for all the resorts in North America that I got from Travel By GPS.  I decided to turn this into a general purpose XML file (noth_america.xml), and stripped the GPX specific header from the file.  Then I added more info to each resort including: base elevation, vertical, average snow fall, number of runs, number of lifts, and the url for each resort.  I'm going to the website for each resort (and using wikipedia for the larger resorts), and grabbing the information above and adding it to the XML.  For any of the data I can't get, I put a -1 as a place holder.  When I'm all finished, I can spend time looking for the missing data for each of the resorts.  Here is a sample entry in the XML file:

<wpt lat="39.638997000" lon="-106.347394000">
  <ele>8120</ele>
  <vertical>3450</vertical>
  <name>Vail</name>
  <numruns>193</numruns>
  <numlifts>34</numlifts>
  <snow>190</snow>
  <longestrun>2</longestrun>
  <url>http://www.vail.com/mountain/mountain-home.aspx</url>
</wpt>

 

Next, I updated the ski_stats.pl script to use the XML file to figure out which resort you skied at.  The results are pretty nice:

 

 

That's all I've got for now.  Things I plan on tackling in the next week or so are getting the QT-Canon app building on Windows from the GitHub repo, building out the QT-Canon project page, working on the XML file and ski_stats script, and I've been cooking up an idea in my head for another pretty slick QT application.
-- Rob
Saturday
Mar272010

Welcome

Hi and welcome to my new site.  Over the last few years, I've been leaving my mark all over the net.  Well starting today, I've decided to make a permanent home for myself.  Carve out a little corner of the net to bed in.  This site is my personal blog/website/project page, and will contain much randomness that you may or may not be interested in.  All in all, I hope I can post some useful code and share my unique view on things ranging from motorcycles, the interwebs, gadgets, dogs, and maybe every once in a while some politics (don't hold me to that).

I just got this thing up, so there may be some broken links (I imported my old blog) and I'm still working on getting my projects over to my GitHub .  Please be patient with me, as I do have a full time job.  I know I owe a few people from my old blog some updates on a few things.  I'm going to do my best to get updates for code, as well as updated instructions posted ASAP.

Thanks for stopping by!

Wednesday
Feb172010

Perl script for creating time lapse videos from a GoPro HD camera

A few months ago, I bought a GoPro HD helmet cam. It takes 1080p video at 30fps, and is basically bomb proof. Video is not the only thing this little beast does, however. It has a mode to take continuous still pictures at given intervals ( 2,5,30,60 seconds ). Because it has a rather nice glass, wide angle lens, you can capture a lot in a single shot. This camera basically does all the hard work for you, so all you have to do is stitch the pictures back together. If you remember correctly (and you probably don't, because let's face it, who reads this blog?), I did a post on how to use ffmpeg to do stuff. In there I showed how you could use ffmpeg to create time lapse videos from stills. Basically you just do the following:

ffmpeg -r 15 -b 1800 -i IMG_%04d.JPG movie.avi

Anyway, this works for the GoPro as well (except the regex for the image name), but you get a cropped square picture, and pretty poor compression. So how do we fix that? Like so:

ffmpeg %d.JPG -r 12 -croptop 180 -cropbottom 180 -s hd720 -vcodec ffv1 movie.avi

Again, the name regex is incorrect in this case, but I'm just using this for demonstration. So, this solves the problem of formatting the video to your liking, but there are two other issues that need to be accounted for:

1. When taking more >1000 images the GoPro makes a new folder and starts the image count over again. So your images end up in folders like 100MEDIA, 101MEDIA, so on and so forth.

2. You now have images with the same name in multiple folders.

The problem with this is the way ffmpeg handles the input of still images. It would be nice if you could just input *.jpg, but you can't. Because you have to have your images named sequentially, you can't delete pictures out of the sequence either.

Because of these problems, I wrote a perl script that grabs all the images in any of the MEDIA folders, resizes and renames them, by modified time, and then puts then in a single folder. It then creates the movie for you.

Download the script here (Update: I added a line to escape spaces in the file names before piping it to ImageMagick)

 To make this script run on Windows:

1. Install Perl from ActiveState - ActivePerl
2. Install ImageMagick - Windows Bins
3. Save the above script into a file called "makeMovie.pl"
4. Copy all the MEDIA folders from your GoPro to a folder on your machine once you've captured your images
5. From the command line, switch into the folder with your MEDIA folders and copy the perl script into the folder
6. Run the perl script

To run this on Linux (Ubuntu):

1. Install imagemagick - sudo apt-get install imagemagick
2. Copy the above script into a file called "makeMovie.pl"
3. From the command line chomod the file - chmod +x makeMovie.pl
4. Copy your MEDIA folders from your GoPro to a folder
5. Copy your perl script into the same folder as the MEDIA folders
6. Run the perl script

Here's a few examples of what you get:

And one from skiing:

Page 1 ... 3 4 5 6 7 ... 8 Next 5 Entries ยป