Assessing Ship Sizes using SAR – Practical Application of Mathematic Morphology


Based on the paper by M. Stasolla and H. Greidanus from 2016, a workflow is followed to estimate ship sizes based on Sentinel-1 imagery. Most importantly, a fundamental element in their workflow is the usage of mathematical morphology to “clean” the SAR image in order to estimate the real-world boundaries of ships.
Figure 1, original description from paper: Results of the various processing steps described in Section 2: (a) tgt; (b) tgt_HED; (c) tgt_ROT; (d) tgt_X; (e) tgt_Y; (f) tgt_XY; (g) tgt_XY_BW and (h) rectangle of derived length and width laid over the original amplitude image. The area of the frames is 200 m  200 m. In (a), (b) and (h), range is horizontal and azimuth is vertical. The pixel values of coloured images range from 0 (blue) to maximum (red); binary results are shown in black and white. The green rectangles in (a), (c) and (g) represent the minimum bounding box enclosing the pixel cluster.
The same methods will be adapted for a Sentinel-1 image from the entrance of the Suez Canal from the end of March 2021, showing a large accumulation of ships waiting for the obstruction of the canal to clear.


The data used in this project is a Sentinel-1 SAR VV-polarized single band image from the 29th of March 2021, downloaded from Google Earth Engine.

Figure 2: SAR Image of the southern entrance to the Suez Canal on the 20th of March 2021 (before the obstruction).
Figure 3: SAR Image of the southern entrance to the Suez Canal on the 29th of March 2021 (during the obstruction). The many ships waiting for the obstruction to clear and pass the canal are clearly visible as bright spots.

Preprocessing for Morphology

First, a small subset of several ships es extracted, since a small image is easier to work with during the testing phase.

In order to prepare the data for the binary mathematical morphology, the values of the image are reclassified based on a threshold, which is manually chosen. The threshold chosen is 0, being the divider between negative values (bo reflectance to sensor) and positive values (where a return is measured). The resulting image still has some error pixels and the ships are quite deformed.

Figure 4: Extract of large image for testing purposes.
Figure 5: Subset, reclassified with the threshold 0.


As outlined in the paper, the workflow starts with a multi-angular erosion, followed by a thresholding for their specific purpose. Following a rotation, multi-scale openings and closings are performed, which are then added. The final result, after another thresholding, is a minimum bounding box of the ship.

The workflow relies heavily on a thresholding via CFAR, after some testing it becomes clear that the implementation unfortunately exceeds the scope of this exercise. Since the paper mentions some alternatives to CFAR, namely Otsu’s thresholding method, this was implemented instead.

Figure 6: Workflow as outlined in the paper (CFAR - constant false alarm rate).


This Jupyter Notebook recreates the workflow of the paper on a subset test image than the original Suez Canal image. As outlined in the notebook, compromises needed to be made with regards to certain steps since they were not reproducible. Additionally, some thresholds that were calculated adaptively in the paper were selected manually. At the end, a ship mask is still obtained.

The data and all notebooks, including the notebook on the full dataset, can be found on GitHub.