SAR images can see through clouds and in darkness, and are therefore very useful for operational monitoring of our seas. Detecting ships, icebergs, wind patterns, and oil spills is daily business in Europe with the Sentinel-1 satellite. Want to see for yourself how to extract information from a SAR image? In this tutorial, we’ll use the SNAP toolbox for Sentinel-1 to extract information on the number of ships at sea.
SAR images are often used for monitoring ship traffic, oil spills, and conditions at sea, because they can see through clouds and darkness, and the waves a SAR satellite like Sentinel-1 emits, can be used to detect small objects and oil spills, while covering a large area. In this tutorial, we’ll be extracting information from Sentinel-1. The tutorial describes how to extract information on ships in a Sentinel-1 image, but you can use the same method to find oil spills, and estimate wind speed and direction at sea at the time the image was taken.
Getting the data and the tools
For this tutorial, I downloaded a Sentinel-1 image from the English channel – lots of ships there – taken on 13 March 2016. If you want more info on how to look for images and download them, check this out. Make sure to get an image that starts with S1A_IW_GRDH as that’s the format we’ll be working with.
Also, download the software we’ll be using today from this website. One Toolbox can process the images of all the Sentinels, whether they are optical or SAR images. You can choose which features you install during the installation process. For this tutorial, you only need the Sentinel-1 toolbox.
Time to see that image!
Once you’ve got all the tools and data, open the SNAP toolbox, and import the image through File –> Import –> SAR Sensors –> Sentinel-1. You can import the zip file you’ve downloaded, or, if you’ve already unzipped it, just go into the folder and find the manifest.safe file.
The image will open in the Product Explorer side bar on the left. Feel free to have a look around the different folders, where you’ll find all the details on that Sentinel-1 image you’ve always wanted to know – or not.
The most interesting folder is the last one – Bands. Open it and double click one of the bands to open it in the Viewer. Be aware that this is not georeferenced, so you have to use your imagination to see which way is up. There are ways to georeference the image, but as our ship detection results will come out just fine without georeferencing, we’re going to skip this step here.
Preparing your data
Before we can do the actual detection, we do need to work with the image a bit. Any satellite image is delivered with DN numbers, the values of each pixel within the image. Those DN numbers don’t mean anything in physics, and the ship detection algorithm is based on an analysis of the physical properties of each pixel. We therefore have to calibrate the image first.
Go to Radar –> Radiometric –> Calibrate.
You don’t need to change the parameters on the first page. Switch to the second tab, and select both VH and VV (Control + click). The parameter we need is Sigma0. When you’ve done that, press Run.
A second product will open in the Product Explorer window.
Extracting ship information
Now we’re ready for the ship detection. If you’re curious about the physics behind it, the Help section in the SNAP Toolbox gives a good overview of the Object Detection algorithm used.
Go to Radar –> Feature Extraction –> Ocean Tools –> Ocean Object Detection.
* Make sure that the name of the Source Product in the first tab is the name of the calibrated image, not that of the original image. * I selected the Sigma0_VH band as the Source Band for the land-sea mask * No need to change any of the parameters in the other tabs, but make sure you note in Tab 5 where the result will be stored on your computer. The default is your user folder (C:/Users/username in Windows).
And click Run.
Now – it took my computer nearly 4 hours to run the object detection. So run it overnight if you can, or while you can wait and leave your computer be, because the toolbox takes up a lot of memory.
Unless of course, your computer is better than mine :).
To visualize the results, open a band of the ship detection results from the Product Explorer window. Now, go to the Layer Manager, in the sidebar all the way to the right. If it’s not there, you can find it under Layer –> Layer Manager.
Press the plus icon.
When the Add Layer window appears, add the Object Detection Results.
Not the nicest overview, and besides, our image is still flipped.
Making the ship detection results look better
So let’s open the results in something like QGIS. For this, find the object detection XML in your files. As a default, they’ll be placed under C:\Users\username.snap\var\log, or however your user folder is called.
I’ve imported the XML file in LibreOffice Calc, by using the “=” sign as a delimiter. Excel should have an XML import function. Make sure it looks something like this:
and save it as a CSV file.
This can easily be imported into QGIS. I’ve added the OpenStreetMap tiles as a background, and ended up with this:
Let me know how it works for you! You can also play around with other feature extraction tools in the SNAP Toolbox, the methodology remains the same.