How To: Extract Bright Spots from a SAR Image with QGIS

Problem

You have a SAR image with lots of bright spots in the ocean that correspond to ships, oil drilling platforms and other lartge hunks of metal.  You would like to make a data set of points that correspond to all these bright spots to use for further analysis, such as determining which bright spots are stationary over time by seeing in the same place in multiple images.

Ok - so first you need to load the image into QGIS as a raster layer. First create a working folder somewhere and save the image (should be a geotiff) in the folder.  If you need to get the ASAR tiff from an overlay in Google Earth, try getting the properties for the image overlay and get the URL to the image from the popup window.

Technique 1: Digitize Manually

Pro: Simple
Con: slow
  • Load the Tiff as a raster layer in QGIS.  Set the project CRS to the CRS of the image.
  • Create a new vector layer as point data.  Select the same CRS as the image.   Put the new shapefile in a folder inside your working folder.
  • Toggle edit mode on the new layer
  • Zoom in to a bright spot that you want to capture.  Zoom in far enough so you can start the see the individual pixels - they should be between 50 and 150 meters across.
  • Select the add point tool and create a new point at the center of the brightest part of the bright spot.
  • lather, rinse, repeat
  • When you're done, toggle editing on the vector layer in order to save it
  • Toggle the new layer on and off and look for any bright spots that you missed
  • You're done

Technique 2: Bulk Feature Extraction

Pro: Operates on the entire raster at once - can be much faster than manual digitization if there are lots of points to capture

Con: Can pick up noise in the image, and will also miss some points that a human coder would not

Step 1: Load the raster

 Load the Tiff as a raster layer in QGIS.  Set the project CRS to the CRS of the image.

Step 2: Create the mask

We need to create a "mask" that will define the part of the image we want to analyze.  This is necessary because most SAR images that we will use will have some coverage on land, where there are lots of very bright metal things that we don't care about, and they also experience a brightness gradient across the image that results is a bright strip along one edge where everything gets washed out and you can't separate the truly strong radar signatures from the noise.

To do this, create a new polygon vector layer using the same CRS as the image.  Call it "mask" and save it in your working folder.

Toggle editing and create a new polygon that covers only the area where you want to extract bright spots.  This means you should keep the edge of the polygon a few kilometers offshore, exclude any islands or other  bright features that you know you don't want.  Also exclude the bright edge of the image where it gets too noisy.

Save your new layer

Step 3: Apply the mask to the raster

Now we're going to strip out all the parts of the raster that are outside of the mask

To do that in QGIS we will use the warp tool

Select Raster->Warp and fill out these fields.  Leave the other fields unchecked

Input File:  This is the original raster image

Output File:  The new raster to create.   you might call this "masked.tif"

Source SRS: This is the CRS of the original raster

No Data Values: 0

Mask Layer: select your newly made polygon layer

Load into Canvas: Check this so you can see what you got

Hit OK and it should create a new raster layer for you, but the COLOR WILL BE WRONG

All the areas outside your polygon should now be transparent (so you see the white background)

All the areas inside your polygon should be non-white, but the color might be wrong

To fix this, open the properties of your new raster and in the style tab, change "Render as" to "Single band grey" and hit OK

Step 4: Figure out what threshold you want to use

What we are going to do here is extract only the brightest pixels in the image and set them all to the value 1, and set everything else to 0, which we have defined as meaning "no data"

So in order to do that, we need to decide what "brightest" means.  For 8-bit Tif images like the ones we display in Google Earth, the range of values in the image is from 0 to 255, where 0 is black and 255 is white.  So we need to decide what the minimum value is that will be considered "bright".  This will vary from image to image.

One quick way is use the mean and standard deviation of all the values in the masked image and select a threshold that is about 4 or 5 standard deviations away from the mean.

        [TBD - finish this]

Step 5: Apply threshold filter to the masked raster

[TBD]

Step 6: Extract polygons

        [TBD]

Step 7: Extract polygon centroids

[TBD]









Comments