[GIS] Suitable Raster processing methods to extract field boundaries from images

digitizinggimpgrassqgisraster

I'm trying to extract field boundaries and features from a lot of aerial images of agricultural land – and avoid digitizing these features manually. I've managed to get a crude raster file of the features that I want by manipulating the threshold colour values in GIMP and geocoding the resulting .tif in QGIS.

Farm outline and resulting Raster overlay

The nine broad contour lines are what I want to extract (and clean up a little) but more importantly I want to remove the randomly distributed noise seen in the middle of the fields. After cleaning the image I plan to convert to a vector and clip the existing farm boundary with it.

I am at a loss as to how to process these data?

I have both QGIS 2.8.1 and GRASS 7 available.

Best Answer

I'm not sure how well this will work without trying on your specific raster, but a few pointers. I assume from your image you used Threshold in GIMP to give you a binary raster (inside field/outside field)

Removing noise

You can use GDAL Sieve to remove the 'salt and pepper' noise - those little holes within the fields.

You can do this from QGIS (Raster > Analysis > Sieve). That should fill any 'holes' (smaller than an area you specify) with the value of the surrounding raster area. If you're lucky and guess the minimum area well, it might also clean up the noise in the gaps between fields too.

Using QGIS to get edges

Depending on how successful that is, and how well you choose the sieve settings, you may be able to convert the noise-free raster straight to polygons. There seems to be a lot of noise in the gaps between fields so there's a good chance you end up with some fields joined together.

Using SAGA to get edges

If you get a reasonably clean noise-free image from Sieve

SAGA GIS has a Raster Connectivty Filter (Grid > Filter > Connectivity Analysis). This will give two outputs

  • a raster, with each contiguous area of pixels given its own ID
  • a shapefile with the boundary of each contiguous area of pixels

Using GIMP to get edges

GIMP has a number of noise-removal and edge filters (e.g. Sobel, Difference of Guassians etc), you might want to try these too.

Post-processing

You might also need to simplify geometries to get rid of the 'staircasing' (the polygon edges will trace round pixel boundaries)

Related Question