Title: | Fourier Transform Textural Ordination |
---|---|
Description: | A tool to use a principal component analysis on radially averaged two dimensional Fourier spectra to characterize image texture. The method within the context of ecology was first described by Couteron et al. (2005) <doi:10.1111/j.1365-2664.2005.01097.x> and expanded upon by Solorzano et al. (2018) <doi:10.1117/1.JRS.12.036006> using a moving window approach. |
Authors: | Koen Hufkens [aut, cre] , Jonathan V. Solorzano [ctb], BlueGreen Labs [cph, fnd] |
Maintainer: | Koen Hufkens <[email protected]> |
License: | AGPL-3 |
Version: | 1.2 |
Built: | 2024-11-15 05:25:37 UTC |
Source: | https://github.com/bluegreen-labs/foto |
Note that the input matrix should be square or results will be discarded
foto( x, window_size = 61, harmonics = 29, method = "zones", norm_spec = FALSE, high_pass = TRUE, pca = TRUE, plot = FALSE )
foto( x, window_size = 61, harmonics = 29, method = "zones", norm_spec = FALSE, high_pass = TRUE, pca = TRUE, plot = FALSE )
x |
an image file, or single or multi-layer SpatRaster (RGB or otherwise), multi-layer data are averaged to a single layer |
window_size |
a moving window size in pixels (default = 61 pixels) |
harmonics |
number of harmonics to consider (29 by default) |
method |
zones (for discrete zones) or mw for a moving window approach |
norm_spec |
normalize radial spectrum,
bolean |
high_pass |
apply high pass filter to radial spectra,
bolean |
pca |
execute PCA, |
plot |
plot output, bolean |
returns a radial spectrum for a moving window across a raster layer
## Not run: # load demo data r <- terra::rast(system.file("extdata", "yangambi.png", package = "foto", mustWork = TRUE )) # classify pixels using zones (discrete steps) output <- foto(r, plot = FALSE, window_size = 25, method = "zones" ) # print data structure print(names(output)) ## End(Not run)
## Not run: # load demo data r <- terra::rast(system.file("extdata", "yangambi.png", package = "foto", mustWork = TRUE )) # classify pixels using zones (discrete steps) output <- foto(r, plot = FALSE, window_size = 25, method = "zones" ) # print data structure print(names(output)) ## End(Not run)
This routine process images as a batch, normalizing the PCA analysis across images. This global normalization makes it possible to compare the resulting PCA scores across images and infer trends over different remote sensing tiles or across time.
foto_batch(path, window_size = 61, method = "zones", cores = 1)
foto_batch(path, window_size = 61, method = "zones", cores = 1)
path |
directory containing (only) image files to process |
window_size |
a moving window size in pixels (default = 61 pixels) |
method |
zones (for discrete zones) or mw for a moving window approach |
cores |
number of cores to use in parallel calculations |
returns a radial spectrum for a moving window across a raster layer
## Not run: # load demo data path path <- system.file("extdata", package = "foto") # classify pixels using zones (discrete steps) output <- foto_batch( path = path, window_size = 25, method = "zones" ) ## End(Not run)
## Not run: # load demo data path path <- system.file("extdata", package = "foto") # classify pixels using zones (discrete steps) output <- foto_batch( path = path, window_size = 25, method = "zones" ) ## End(Not run)
Normalize values between 0 and 1, internal function only.
normalize(x)
normalize(x)
x |
a matrix or vector |
returns a normalized matrix or vector
This is an internal function and not to be used stand-alone.
rspectrum(x, w, hm, n = TRUE, h = TRUE, env, ...)
rspectrum(x, w, hm, n = TRUE, h = TRUE, env, ...)
x |
a square matrix |
w |
a moving window size |
hm |
harmonics to consider as features |
n |
normalize, bolean |
h |
high pass filter on the two first spectra values
set to 0, limits the influence of low frequency components
bolean |
env |
local environment to evaluate |
... |
additional parameters to forward |
Returns a radial spectrum values for the image used in order to classify texture using a PCA (or other) analysis.