Skip to content

Interactive Image Segmentation part 1

A few weeks ago I saw this tweet from UrtheCast

It is a stunning image, captured by Deimos 1, of crop circles in Saudi Arabia. I really like desert environments, so much so that I took a course at University on dryland geomorphology and learned all about the amazing features, processes and changes in these environments. The common perception is that most of the world’s deserts are just sand. The USGS reports that sand makes up only 20% of all the world’s deserts. Gravel plains, bare rock, vegetation, infrastructure and agriculture (as image above) are commonly found in drylands.

Agriculture in this case appears as these circular fields are watered by a Center-pivot irrigation system. It is a highly efficient watering system and is used world wide, extensively in the US for example. Detailed mapping of these fields is beneficial for planning a seismic survey as entering areas like these is not only impractical for large seismic vehicles but there is a high risk of damage to crops. Obtaining permission and charting a land owners response requires skilled planning.

Quite often in the field crews will rely on a combination of paper maps, existing digital data and hand digitizing imagery. This is a slow and expensive process, it relies upon the skill of the digitiser, how recent the image being digitized is and how well positioned (georeferenced) it is. What I hope to demonstrate in this series of blogs is how this traditional ‘GIS Mapping’ process is changing, I will also show you how to map these features quickly. But first lets consider a stack of coins…

Image Segmentation with Watershed Algorithm

I am replicating exactly an example from the OpenCV documentation. The article is available here. None of the below is my code.

First off I took my own picture of coins, not the greatest picture ever, but good enough to see the coins.


Then I ran it through the code above (I had to rescale the image, but otherwise code is as the tutorial shows). This is my thresholded image

And finally, the result

Hopefully you can see the red boundary around the coins.

I am not breaking any new ground here only trying a tutorial out for myself. There are plenty of blogs about this process. Have a look. I ran various tests on various images, I have 2 key takeaways from this process.

  1. The contrast of the image is important.
  2. Vary the scaling factor on the thresholded image.

This technique lends itself very nicely to mapping circular fields.

Circular fields

Landsat 8 and Sentinel2a, and soon to be Sentinel 2b, are collecting vast amounts of free to access images and they are available shortly after collection. There is also a wide range of other higher resolution sensors available with data to sell. Gone are the days of one image, now there are hundreds to choose from.

In short, we now have access to the satellite data; it is of a high quality and it is very recent.


This image from April 2017 was acquired by Landsat 8. The question is can we get shapefiles (or similar) out to begin the mapping of the circular fields. The answer is yes, and I’ll show you how next week :).