After you’ve peeked at all of the neighbors backyard landscaping (or their clutter), satisfied your curiosity about what’s behind that 8-foot wall, checked out what the top of a water tower actually looks like, what’s next?
Well, I’ve been practicing flying more gracefully for one thing. And I got to use it last week when I shot some video for my brother, who’s selling his house. I’ll post a bit about that another time. This week I got distracted by a different idea — data collection.
Now I’m not the first to think of a drone as a data collection device. There’s plenty of farmers that are monitoring their crops with drones that fly preprogrammed patterns over their land, and construction companies that have automated drones that track their progress and validate that plans are being followed. Frankly, I think this is a giant industry that is just now getting figured out — I should probably buy some stock.
But in my own little world I like to push my technology (i.e. toys) to its limit, or at least think wistfully about the possibilities. How many people in my neighborhood park their cars on the street? How many in the driveway? How many don’t move for days? These are trivial questions not even worth thinking about, right? But wait, could I actually answer them?
DJI sells a wide range of drones. The Mavic Mini that I have is one of the lowest models they offer, but they have some sophisticated drones that can certainly be programmed to autonomously gather such data. There’s a few pieces of the puzzle that require extra effort but it can be done. One of the things that makes this possible is that DJI drones actually have a developer’s API. That means 3rd party apps can be used to control the drones. The Mavic Mini isn’t yet supported by the API, but it’s supposed to be coming out soon. It’s still a cheap, pretty limited drone, but how much could I accomplish?
So I spent a few days reading on the topic. There are some sophisticated companies already providing solutions for some of this stuff. But I’m cheap… what can I do on the cheap? Turns out there’s a pretty popular package called Open Drone Map and it’s shockingly easy to use.
The idea is to stitch together images (still images) from a drone and correlate them to actual GPS coordinates, and present the results as a data-set. Once you’ve done that you can map terrain, count cows (or cars), look for sick crops, or figure out how far along a giant construction project is. Some companies use thermal cameras or custom made drones to gather their data.
What I wanted to know first was if this software would be useful with my lowly Mavic Mini (basically a toy drone) and whether I would even be able to get it running. Totally as an experiment, I decided to play with the video that I had already shot from the drone doing a circle maneuver over my house (see a previous post).
It turns out my Mac Book Pro may be the limiting factor. I have 52 seconds of 2.7K video at 30 fps. I used FFMPEG to convert my video into ~1500 horribly low quality still images. I knew 1500 images would take forever even if it did work so I threw out 9/10ths of the images and tried processing 150 of them. The docker command I found went right to work on the images but quickly died — out of memory. I cut that down to about 75 images and scaled them down by half (i.e. 1/4th of the pixels) since the quality was so bad to begin with. I tried again and it worked! Oh my, it ran in less than 2 hours and I wasn’t even sure what to do with the result. I found that it produces an OBJ file and I found Mesh Lab to display my house as a 3D Object — I was very excited and took the above screen shot. It took me the rest of the day to figure out how to put it on the web. I used three.js to throw together this quick demo.