Description Usage Arguments Details Value See Also Examples
Labels groups of pixels in a raster object that share similar attributes.
1 |
x |
Object of class RasterLayer, RasterStack or RasterBrick. |
method |
Labeling method. Choose between 'simple' and 'change'. Default is 'simple'. |
change.threshold |
Numeric element. |
Uses a 8-neighbor connected component labeling algorithm (determined by method) to identify groups of pixels of the same value. Each group receives a distinct numeric label. The function provides two connected component labeling algorithms:
simple - Connects neighboring pixels with the same value. Suitable for categorical data.
spatial - Estimates the MAPE using a 3x3 moving window distinguishes neighboring pixels when the spatial change surpasses change.threshold.
temporal - Estimates the MAPE among all bands in a raster object and distinguishes spatially neighboring pixels when the temporal change surpasses change.threshold.
When using the spatial and temporal methods, the value of change.threshold will influence the output. If the value is negative, the function will return the pixels that are below the threshold and vice versa when positive. Let's assume we are dealing with crop fields. When, using a negative threshold and the spatial method, the function will return homogeneous groups of pixels. This happens because the borders of between fields offer a contract and thus receive higher MAPE values. However, if we apply the same threshold when using the temporal method, the borders will be highlighted. This happens because the crop fields are more variant over time due to their fast growth while the borders remain virtually unchanged. The final output of the function is a list consisting of:
regions - RasterLayer object with region labels.
frequency - data.frame object with the pixel count for each unique value in regions.
A list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | {
require(raster)
# read raster data
r <- brick(system.file("extdata", "ndvi.tif", package="fieldRS"))
# spatial change labeling
or <- ccLabel(r[[1]], method="spatial", change.threshold=10)
plot(or$regions)
# temporal change labeling
or <- ccLabel(r, method="temporal", change.threshold=80)
plot(or$regions)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.