Description Usage Arguments Value Note See Also Examples
View source: R/watershed_tree_delineation.r
Detect potential crown using watershed based segmentation of an NDVI image
1 2 3 4 | watershed_tree_detection(image_fname, extent, index_name = "NDVI", bg_mask,
neighbour_radius = 2, watershed_tolerance = 0.008,
rough_crowns_shp_fname = "", writemask = F, plott = F, max_npix = Inf,
parallel = F, nWorkers = 2, bandnames = NULL)
|
image_fname |
Filename of the image to run the tree detection on |
extent |
Raster extent object. Default is NA, which means the entire image will be analyzed. |
index_name |
Character (for a spectral index) or numeric (for an individual wavelength). The spectral index or wavelength on which to perform the watershed segmentation. If a wavelength is provided, it should be expressed in nm. Default is "NDVI". |
bg_mask |
List. Uneven positions should provide index names or wavelength numbers. Even positions in the list should provide the cut-off value of the spectral index, below which, pixels are considered background. Default is list('NDVI',0,1). |
neighbour_radius |
Numeric. The radius to be considered for the detection of neigbouring objects in m. Higher values causes greater smoothing in the detection of objects, and then trees. Default is 2 m. |
watershed_tolerance |
. The tolerance setting in the EBImage::watershed operation. Lower values cause greater separation. Defualt is 0.08, designed for NDVI. |
rough_crowns_shp_fname |
Character. Filename for the output polygon shapefile. The default is to not write the output away. |
writemask |
Logical. If T, a binary tif file with the same name as rough_crowns_shp_fname will be written away depicting how the image data was masked before segmenting. Default is F. |
plott |
Logical. Do you want to plot results? Default is False. T does not work yet! |
max_npix |
Integer. If set, image_name will be tiled to have fewer than max_npix pixels and processed in tiles. Tiling, and setting max_npix needs to be set if parallel = T. Default is Inf. |
parallel |
Logical. Would you like the tiles to be processed in parallel? Default is False. |
nWorkers |
If running the code in parallel, how many workers should be used? Default is 4. |
bandnames |
Character. In case the bands aren't named according to wavelength and following csic convention, they can be provided. Default is NULL in which cases bandnames are read from the image file and csic naming convention is assumed. |
A SpatialPolygons object of suspected trees crowns.
the raster::rasterToPolygons step is slow - look for ways to speed it up!
Tiled processing does not appear to work for unprocessed data?
polygons_to_seeds
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
watershed_tree_delineation(
image_fname = 'E:/FISE/forest/CanopyHealthMonitoring/PWN/flights_final/150727_mca/150727_mca.bsq',
extent = raster::extent(c(747400, 747490, 4463900, 4463990)),
#extent = raster::extent(c(747400, 747420, 4463900, 4463920)),
index_name = 'NDVI',
bg_mask = list('NDVI',0.35,800, 1200),
plott = T,
neighbour_radius = 1,
watershed_tolerance = 0.08,
rough_crowns_shp_fname = 'C:/Users/pieterbeck/Documents/temp/test_treedetection_pols.shp')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.