diff --git a/404.html b/404.html index 7f06a96..2ec1c9c 100644 --- a/404.html +++ b/404.html @@ -42,7 +42,7 @@ - foto v1.1 + foto v1.2 @@ -60,6 +60,9 @@ diff --git a/CONDUCT.html b/CONDUCT.html index 25bc608..a4be50f 100644 --- a/CONDUCT.html +++ b/CONDUCT.html @@ -21,7 +21,7 @@ - foto v1.1 + foto v1.2 @@ -37,6 +37,9 @@ diff --git a/LICENSE-text.html b/LICENSE-text.html index a5d723d..c60a028 100644 --- a/LICENSE-text.html +++ b/LICENSE-text.html @@ -21,7 +21,7 @@ - foto v1.1 + foto v1.2 @@ -37,6 +37,9 @@ diff --git a/articles/foto-background.html b/articles/foto-background.html new file mode 100644 index 0000000..b6c43bf --- /dev/null +++ b/articles/foto-background.html @@ -0,0 +1,221 @@ + + + + + + + +foto background • foto + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +

The FOTO (Fourier Transform Textural Ordination) method uses a +principal component analysis (PCA) on radially averaged 2D fourier +spectra to characterize (greyscale) image texture (of canopies). Here, +I’ll explain the underlying algorithm, with a worked example. This +should give you a better insight in how the algorithm works and how some +of the parameters influence your analysis.

+

+

Note that the three boxes have very different textures.

+

+

The next step in the algorithm is to transform the data using a +Fourier decomposition.

+
+# fft transform
+fftim_1 <- Mod(stats::fft(im_1))^2
+fftim_2 <- Mod(stats::fft(im_2))^2
+fftim_3 <- Mod(stats::fft(im_3))^2
+

The data now need to be radially averaged, so we calculate the +distance relative to the center of the image.

+
+# calculate distance from the center of the image
+offset <- ceiling(dim(im_1)[1] / 2)
+
+# define distance matrix
+# r is rounded to an integer by zonal
+distance_mask <- sqrt((col(im_1) - offset)^2 + (row(im_1) - offset)^2)
+

We first back convert all data to terra objects +(rasters), to make the raster math easier.

+
+# suppress warning on missing extent (which
+# is normal)
+fftim_1 <- terra::rast(fftim_1)
+fftim_2 <- terra::rast(fftim_2)
+fftim_3 <- terra::rast(fftim_3)
+distance_mask <- terra::rast(distance_mask)
+

Below you see the concentric mask and the 2D FFT frequency plot. +Note, unlike most conventional plots the data is not centered on 0.

+
+par(mfrow=c(1,2))
+plot(log(fftim_1))
+plot(distance_mask)
+

+

For all FFT spectra the data will be radially averaged, removing any +directional components from the data. The terra zonal() +function is used to do this efficiently.

+
+rspec_1 <- rev(
+  terra::zonal(
+    fftim_1,
+    distance_mask,
+    fun = "mean",
+    na.rm = TRUE
+  )[, 2]
+)
+

Plotting the averaged spectra shows subtle differences between the +different textures.

+

+
+ + + +
+ + + + +
+ + + + + + + + diff --git a/articles/foto-background_files/figure-html/unnamed-chunk-1-1.png b/articles/foto-background_files/figure-html/unnamed-chunk-1-1.png new file mode 100644 index 0000000..1b24af9 Binary files /dev/null and b/articles/foto-background_files/figure-html/unnamed-chunk-1-1.png differ diff --git a/articles/foto-background_files/figure-html/unnamed-chunk-2-1.png b/articles/foto-background_files/figure-html/unnamed-chunk-2-1.png new file mode 100644 index 0000000..e0e2fa8 Binary files /dev/null and b/articles/foto-background_files/figure-html/unnamed-chunk-2-1.png differ diff --git a/articles/foto-background_files/figure-html/unnamed-chunk-6-1.png b/articles/foto-background_files/figure-html/unnamed-chunk-6-1.png new file mode 100644 index 0000000..9735e0d Binary files /dev/null and b/articles/foto-background_files/figure-html/unnamed-chunk-6-1.png differ diff --git a/articles/foto-background_files/figure-html/unnamed-chunk-9-1.png b/articles/foto-background_files/figure-html/unnamed-chunk-9-1.png new file mode 100644 index 0000000..ffebe5b Binary files /dev/null and b/articles/foto-background_files/figure-html/unnamed-chunk-9-1.png differ diff --git a/articles/foto-vignette.html b/articles/foto-vignette.html index f14f5de..c61ddba 100644 --- a/articles/foto-vignette.html +++ b/articles/foto-vignette.html @@ -44,7 +44,7 @@ - foto v1.1 + foto v1.2 @@ -62,6 +62,9 @@ diff --git a/articles/foto-vignette_files/figure-html/figure_1-1.png b/articles/foto-vignette_files/figure-html/figure_1-1.png index 4844414..abb3472 100644 Binary files a/articles/foto-vignette_files/figure-html/figure_1-1.png and b/articles/foto-vignette_files/figure-html/figure_1-1.png differ diff --git a/articles/foto-vignette_files/figure-html/figure_2-1.png b/articles/foto-vignette_files/figure-html/figure_2-1.png index 4b83fbb..094b839 100644 Binary files a/articles/foto-vignette_files/figure-html/figure_2-1.png and b/articles/foto-vignette_files/figure-html/figure_2-1.png differ diff --git a/articles/foto-vignette_files/figure-html/figure_3-2.png b/articles/foto-vignette_files/figure-html/figure_3-2.png index cba02da..f8b97e9 100644 Binary files a/articles/foto-vignette_files/figure-html/figure_3-2.png and b/articles/foto-vignette_files/figure-html/figure_3-2.png differ diff --git a/articles/foto-vignette_files/figure-html/figure_3-3.png b/articles/foto-vignette_files/figure-html/figure_3-3.png index d05e7ea..7eb52d7 100644 Binary files a/articles/foto-vignette_files/figure-html/figure_3-3.png and b/articles/foto-vignette_files/figure-html/figure_3-3.png differ diff --git a/articles/index.html b/articles/index.html index a7d4bdb..7b49b18 100644 --- a/articles/index.html +++ b/articles/index.html @@ -21,7 +21,7 @@ - foto v1.1 + foto v1.2 @@ -37,6 +37,9 @@ @@ -65,7 +68,9 @@

Articles

All vignettes

-
foto
+
foto background
+
+
foto
diff --git a/authors.html b/authors.html index 68b1baa..655acba 100644 --- a/authors.html +++ b/authors.html @@ -21,7 +21,7 @@ - foto v1.1 + foto v1.2 @@ -37,6 +37,9 @@ @@ -86,13 +89,13 @@

Citation

Hufkens K (2024). foto: Fourier Transform Textural Ordination. -R package version 1.1, https://github.com/bluegreen-labs/foto. +R package version 1.2, https://github.com/bluegreen-labs/foto.

@Manual{,
   title = {foto: Fourier Transform Textural Ordination},
   author = {Koen Hufkens},
   year = {2024},
-  note = {R package version 1.1},
+  note = {R package version 1.2},
   url = {https://github.com/bluegreen-labs/foto},
 }
diff --git a/index.html b/index.html index 1ab18fc..e78e757 100644 --- a/index.html +++ b/index.html @@ -49,7 +49,7 @@ - foto v1.1 + foto v1.2 @@ -67,6 +67,9 @@ diff --git a/news/index.html b/news/index.html index b28c2d6..709e35d 100644 --- a/news/index.html +++ b/news/index.html @@ -21,7 +21,7 @@ - foto v1.1 + foto v1.2 @@ -37,6 +37,9 @@ @@ -62,6 +65,11 @@

Changelog

Source: NEWS.md +
+ +
@@ -37,6 +37,9 @@ diff --git a/reference/foto_batch.html b/reference/foto_batch.html index c6403fb..2d6254b 100644 --- a/reference/foto_batch.html +++ b/reference/foto_batch.html @@ -24,7 +24,7 @@ - foto v1.1 + foto v1.2 @@ -40,6 +40,9 @@ diff --git a/reference/index.html b/reference/index.html index 4f4e518..926c1b6 100644 --- a/reference/index.html +++ b/reference/index.html @@ -21,7 +21,7 @@ - foto v1.1 + foto v1.2 @@ -37,6 +37,9 @@ diff --git a/reference/normalize.html b/reference/normalize.html index 553fe3b..93a9b61 100644 --- a/reference/normalize.html +++ b/reference/normalize.html @@ -21,7 +21,7 @@ - foto v1.1 + foto v1.2 @@ -37,6 +37,9 @@ diff --git a/reference/rspectrum.html b/reference/rspectrum.html index 1855f75..af50600 100644 --- a/reference/rspectrum.html +++ b/reference/rspectrum.html @@ -21,7 +21,7 @@ - foto v1.1 + foto v1.2 @@ -37,6 +37,9 @@ diff --git a/sitemap.xml b/sitemap.xml index 99a3ffd..a8f94d5 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -9,6 +9,9 @@ /LICENSE-text.html + + /articles/foto-background.html + /articles/foto-vignette.html