Assessing Ship Sizes using SAR – Practical Application of Mathematic Morphology

Introduction

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.

Data

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.

Workflow

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).

Notebook

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.

workflow_test_data skip

Conclusion

 

4.1 Final Result – Original Workflow

The result obtain by following the workflow of the paper is not ideal, mostly because of the thresholding method. Therefore, another end result is created without the thresholding and some other optimized characteristics.

Figure 6: Overview of the ship mask after following the original workflow as closely as possible. Note that all the siphs were identified correctly, but also some high-reflectance objects along the cost (which can be easily masked out).
Figure 7: Close-Up of some ships with the ship mask overlayed. While some of the "glow" around the edges of the ship were removed, it does not seem like the shape of the ship mask objects closely resemble the shape of container ships.

4.2 Final Result – Adapted Workflow

Looking purely at the results, not the method of the workflow itself, it seems that the workflow can be drastically shortened and made less complex while still obtaining good results. 

Therefore, an adapted workflow was created, incorporating less steps and still yielding a good result.

The optimized workflow consists only of an erosion followed by an Otsu’s thresholding.

Figure 9: Recognition of a vertically oriented large ship.
Figure 9: Recognition of slightly angled ship.
Figure 10. Recognition of a cluster of ships. Note that smaller ships are not recognized at all due to the size of the structuring emelent.
Figure 10. Recognition of a cluster of ships. Note that smaller ships are not recognized at all due to the size of the structuring emelent.

5. Conclusion

While at a first glance the methodology of the paper seemed quite straight-forward, upon further investigation it seemed more complex. Not only was it not possible for me to implement the correct thresholding algorithm (throwing off the results), but also some of the morphpological steps were hard to reproduce (mainly the multi-angular steps). 

 

To me, it also seems that the workflow is overly complicated. While I can not verify my (or their) results due to missing ground-truth data, it seems like some steps could be streamlined while still obtaining good results.

Leave a Reply

Your email address will not be published. Required fields are marked *

Further Reading
Recent Updates