Sentinel bot source

I’ve been sick the last few days, which hasn’t helped in staying focused so I decided to do a few menial tasks, such as cleaning up my references, and some a little bit more involved but not really that demanding, such as adding documentation to the twitter bot I wrote.

While it’s still a bit messy, I think it’s due time I started putting up some code online, particularly because I love doing it so much. When you code for yourself, however, you don’t have to face the wrath of the computer scientists telling you what you’re doing wrong! It’s actually similar in feeling to editing writing, the more you do it the better you get.

As such, I’ve been using Pycharm lately which has forced me to start using PEP8 styling and I have to say it’s been a blessing. There are so many more reasons than I ever thought for using a very high level IDE and I’ll never go back to hacky notepad++ scripts, love it as I may.

In any case, I hope to have some time someday to add functionality – for example have people tweet coordinates + a date @sentinel_bot and have it respond with a decent image close to the request. This kind of very basic engagement for people who mightn’t be bothered going to Earth Explorer or are dissatisfied with Google Earth’s mosaicing or lack of coverage over a certain time period.

The Sentinel missions offer a great deal of opportunity for scientists in the future, and I’ll be trying my best to think of more ways to engage the community as a result.

Find the source code here, please be gentle, it was for fun 🙂

dainlptxkaajaaw

Leafiness

I thought it might be fun to try something different, and delve back into the world of satellite remote sensing (outside of Sentinel_bot, which isn’t a scientific tool). It’s been a while since I’ve tried anything like this, and my skills have definitely degraded somewhat, but I decided to fire up GrassGIS and give it a go with some publicly available data.

I set myself a simple task of trying to guess how ‘leafy’ streets are within an urban for urban environment from Landsat images. Part of the rationale was that whilst we could count trees using object detectors, this requires high resolution images. While I might do a blog on this at a later date, it was outside the scope of what I wanted to achieve here which is at a very coarse scale. I will be using a high resolution aerial image for ground truthing!

For the data, I found an urban area on USGS Earth Explorer with both high resolution orthoimagery and a reasonably cloud free image which were within 10 days of one another in acquisition. This turned out to be reasonably difficult to find, with the aerial imagery being the main limiting factor, but I found a suitable area in Cleveland, Ohio.

The aerial imagery is a 30 cm resolution having been acquired using a Williams ZI Digital Mapping Camera, and was orthorectified prior to download. For the satellite data, a Landsat 5 Thematic Mapper raster was acquired covering the area of interest, with a resolution of 30 m in the bands we are interested in.

This experiment sought to use the much researched NDVI, a simple index used for recovering an estimate of vegetation presence and health.

Initially, I loaded both datasets into QGIS to get an idea of the resolution differences

jezzer.png

Aerial image overlain on Landsat 5 TM data (green channel)

So a decent start, looks like our data is valid in some capacity and should be an interesting mini-experiment to run! The ground truth data is resolute enough to let us know how the NDVI is doing, and will be used farther downstream.

 

Onto GrassGIS, which I’ve always known has great features for processing satellite imagery, though I’ve never used. It’s also largely built on python, which is my coding language of choice, so I feel very comfortable troubleshooting the many errors fired at me!

The bands were loaded, DN -> reflectance conversion done (automatically, using GrassGIS routines) and a subsequent NDVI raster derived.

ndvi2.png

Aerial image overlain on NDVI values. Lighter pixels denote a higher presence of vegetation

Cool! We’ve got our NDVI band, and can ground truth it against the aerial photo as planned.

ndvi1

Lighter values were seen around areas containing vegetation

Last on the list is grabbing a vector file with street data for the area of interest so we can limit the analysis to just pixels beside or on streets. I downloaded the data from here and did a quick clip to the area of interest.

roads1.png

Vector road network (in yellow) for our aerial image. Some new roads appear to have been built.

I then generated a buffer from the road network vector file, and generated a raster mask from this so only data within 20 m of a road would be included in analyses. The result is a first stab at our leafy streets index!

map1.jpg

Visual inspection suggests it’s working reasonably well when compared with the reference aerial image, a few cropped examples are shown below.

This slideshow requires JavaScript.

Lastly, we can use this this data to scale things up, and make a map of the wider area in Cleveland. This would be simple to do for anywhere with decent road data.

map3.jpgThis might be useful for sending people on the scenic route, particularly in unfamiliar locations. Another idea might be to use it in a property search, or see if there’s a correlation with real estate prices. Right now I’ve run out of time for this post, but might return to the theme at a later date!

 

Blur detection

I thought I’d supplement the recent blog post I did on No-Reference Image Quality Assessment with the script I used for generating the gradient histograms included with the sample images.

I imagine this would be useful as a start for generating a blur detection algorithm, but for the purposes of this blog post I’ll just direct you to the script on github here. The script takes one argument, the image name (example: ‘python Image_gradients.py 1.jpg’).  Sample input-output is below.

fusion_mertens

Input image

Image_gradients.png

Plot generated

 

 

Sony a7

I was fortunate enough to track down a Sony a7 within my price range last weekend. I’ve written about it in a number of forms on this blog (UAV cameras, revisited, What camera for a UAV?), and have been trying to hunt one down for the last few months.

It arrived this afternoon, and I’ve had a little play with it just to try and get a feel for it’s operation. Coming from a comparatively stone age Canon 500d, the controls feel slick and the electronic viewfinder also feels very different, but good different. It came with the 28 – 70mm kit lens, which is good news as I think it might have been a pain to track one down separate from the body.

One huge upside I’ve already identified is how easily the photos are to upload via Wi-Fi to my computer. I didn’t think it’d matter much to me, but I can see it being quite useful in general, saves from scrambling for card readers and such.

The only downside I’ve identified so far is the punishingly short battery life. The electronic viewfinder is beautiful, and the real time leveling information is amazing, but it drains the battery like nobody’s business. I’ve already ordered a backup battery, and should look forward to taking more photos in less difficult conditions!

I thought I’d include a few sample images here, including one I took of a building site a few minutes from where I live. I really should have brought down a tripod, but the fact that it came out as clear as it did is remarkable to me.

build.jpg

A building site near my house

DSC00032-2.png

A different angle, lots of light from street

lightdarkselfie.jpg

My first (and probably last) ever selfie, for a special occasion

UAV cameras revisited

I revisited an earlier blog post, What camera for a UAV?, for an article for GIM international this month. I had a great time expanding upon lots of what I have learned about over the last two years!

I seemed to have raised a few eyebrows at the suggestion that GoPros are not optimal for photogrammetric use, as they have frequently been used and their lenses have been very well modeled, but in the spirit of the article I still thought it was worth pointing out!

gimout-0.png

First page from the GIM article

You can find the full article here.

A few more from Sentinel bot

I’ve been busy in a lab for the last week or so, so haven’t gotten around to a blog post (Which I’m excited about!) I was planning, though will hopefully be able to get it done tomorrow. For now, here’s a hand picked 10 image gallery from my twitter bot’s feed, for your viewing pleasure! There are some amazing braided rivers in the world!

If anyone is interested in higher resolution images (these are ~20% reduced) please get in touch.

This slideshow requires JavaScript.

A slippy map for Sentinel bot

Over the weekend I decided to expand on what was in sentinel bot‘s portfolio by having an automatically updating slippy map, which plots where the point for which sentinel bot has found an image is in the world, as long with the basic metadata of date acquired and lat/lon. I was trying to the leaflet’s marker-clusterer to work but to no avail, couldn’t quite get the knack of it! If anyone has experience with it I’d love to hear from you. I continued with just the pins nonetheless!

One really cool github project I used was this, which allows you to cycle through basemap providers for leaflet and provides you with the javascript code for inserting into your own map. I chose Heidelberg university’s surfer roads for no reason in particular, but may change this in the future. I think I’ll be returning to that github for future slippy maps!

In any case, the product is not perfect, but gives an interesting view of what the bots activities have been for the week it’s been active. I’m not trying to reinvent Earth Explorer, so will probably spend no more time on this, but it was an enjoyable pursuit!

Check the map here.