I have created rasters showing different types of vegetation (bushes, trees, open land) with help from lidar data. Now I'm looking for a method to turn these images into polygons.
I'm using a Mac and preferably QGIS, GDAL, GRASS etc. I do have the possibility to use Windows but I'd prefer staying in Mac OS X.
Here is the source image:
Blue (with some red) means trees and red is bushes. White is open land.
And this image (drawn by hand) is kind of what I'd like to achieve:
Any ideas?
I've tried r.neighbors
some but I'm not satisfied.
Update: I have now tried Majority and it looks better. But the narrow part in the south east part is not being included. I guess those dots are not in "majority". How could I make them being included? It's like if I need minority but not extreme minority…
See image below (note that I have only included bushes, the red color from the original image):
Best Answer
You can use a Majority Filter followed by Polygonize for this type of operation. QGIS has a majority filter in the SAGA toolbox. Polygonize is found in the
Raster tab > Conversion > Polygonize (Raster to Vector...)
. For more cartographically pleasant vector features, use Simplify Geometry to smooth the rough vector edges:Vector > Geometry Tools > Simplify Geometries...
Another option is to use a Guassian Filter in the SAGA toolbox and then threshold that output using the Raster Calculator. In this second example, I used a double pass circular Guassian Filter with a stdev of 3 and a search radius of 30. I then thresholded the resulting image using the following syntax in the raster calculator:
"Filtered Grid@1" > 0.7
The resulting output is overlaid in transparent blue on the original: