Package 'foto'

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-10-16 05:20:11 UTC
Source: https://github.com/bluegreen-labs/foto

Help Index


Calculates FOTO classification of texture

Description

Note that the input matrix should be square or results will be discarded

Usage

foto(
  x,
  window_size = 61,
  harmonics = 29,
  method = "zones",
  norm_spec = FALSE,
  high_pass = TRUE,
  pca = TRUE,
  plot = FALSE
)

Arguments

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 TRUE or FALSE

high_pass

apply high pass filter to radial spectra, bolean TRUE or FALSE

pca

execute PCA, TRUE or FALSE. If FALSE only the radial spectra are returned for additional manipulation. Plotting is ignored if set to FALSE.

plot

plot output, bolean TRUE or FALSE

Value

returns a radial spectrum for a moving window across a raster layer

See Also

rspectrum

Examples

## 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)

Calculates FOTO classification of texture for an image batch

Description

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.

Usage

foto_batch(path, window_size = 61, method = "zones", cores = 1)

Arguments

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

Value

returns a radial spectrum for a moving window across a raster layer

See Also

rspectrum foto

Examples

## 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 a matrix or vector

Description

Normalize values between 0 and 1, internal function only.

Usage

normalize(x)

Arguments

x

a matrix or vector

Value

returns a normalized matrix or vector


Calculates a radial spectrum

Description

This is an internal function and not to be used stand-alone.

Usage

rspectrum(x, w, hm, n = TRUE, h = TRUE, env, ...)

Arguments

x

a square matrix

w

a moving window size

hm

harmonics to consider as features

n

normalize, bolean TRUE or FALSE

h

high pass filter on the two first spectra values set to 0, limits the influence of low frequency components bolean TRUE or FALSE

env

local environment to evaluate

...

additional parameters to forward

Value

Returns a radial spectrum values for the image used in order to classify texture using a PCA (or other) analysis.