{"id":21539452,"url":"https://github.com/bluegreen-labs/foto","last_synced_at":"2025-04-10T03:26:23.082Z","repository":{"id":56937037,"uuid":"164666071","full_name":"bluegreen-labs/foto","owner":"bluegreen-labs","description":"The FOTO (Fourier Transform Textural Ordination) R package.","archived":false,"fork":false,"pushed_at":"2024-02-19T20:30:12.000Z","size":21394,"stargazers_count":5,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-11T16:27:55.928Z","etag":null,"topics":["classification","classification-algorithm","computer-vision","remote-sensing","texture"],"latest_commit_sha":null,"homepage":"https://bluegreen-labs.github.io/foto/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluegreen-labs.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-08T14:27:35.000Z","updated_at":"2024-06-11T16:27:55.929Z","dependencies_parsed_at":"2023-10-01T05:15:29.965Z","dependency_job_id":"c57ff774-f60b-4f47-8acc-cd8dd8e85238","html_url":"https://github.com/bluegreen-labs/foto","commit_stats":{"total_commits":80,"total_committers":2,"mean_commits":40.0,"dds":"0.012499999999999956","last_synced_commit":"f6513b225bd3bc0ff9008dd6c2e0009c2988cf9b"},"previous_names":["khufkens/foto"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluegreen-labs%2Ffoto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluegreen-labs%2Ffoto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluegreen-labs%2Ffoto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluegreen-labs%2Ffoto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluegreen-labs","download_url":"https://codeload.github.com/bluegreen-labs/foto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248150025,"owners_count":21055846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","classification-algorithm","computer-vision","remote-sensing","texture"],"created_at":"2024-11-24T04:15:22.535Z","updated_at":"2025-04-10T03:26:23.039Z","avatar_url":"https://github.com/bluegreen-labs.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FOTO\n\n[![R-CMD-check](https://github.com/bluegreen-labs/foto/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bluegreen-labs/foto/actions/workflows/R-CMD-check.yaml)\n[![codecov](https://codecov.io/gh/bluegreen-labs/foto/branch/master/graph/badge.svg)]( https://app.codecov.io/gh/bluegreen-labs/foto)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/foto)](https://cran.r-project.org/package=foto)\n[![](https://cranlogs.r-pkg.org/badges/grand-total/foto)](https://cran.r-project.org/package=foto)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3337885.svg)](https://doi.org/10.5281/zenodo.3337885)\n\nThe FOTO (Fourier Transform Textural Ordination) method uses a principal\ncomponent analysis (PCA) on radially averaged 2D Fourier spectra to\ncharacterize (grayscale) image texture. The FOTO method was described by\n[Couteron et\nal. 2005](https://doi.org/10.1111/j.1365-2664.2005.01097.x)\nto quantify canopy stucture in relation to biomass and biodiversity.\nMore recently, the code base of this package was used in a similar study\nby [Solorzano et\nal. 2018](https://doi.org/10.1117/1.JRS.12.036006).\nAlthough the techniques as presented in these papers is applied on a\ncanopy level, the principle works on images of all types.\n\n\n## How to cite this package\n\n\u003e Please cite the software in publication as: Koen Hufkens (2019). foto:\nan R implementation of the “fourier transform textural ordination”\nmethod. \u003chttps://doi.org/10.5281/zenodo.3337885\u003e\n\n## Installation\n\n### stable release\n\nTo install the current stable release use a CRAN repository:\n\n``` r\ninstall.packages(\"foto\")\nlibrary(\"foto\")\n```\n\n### development release\n\nTo install the development releases of the package run the following\ncommands:\n\n``` r\nif(!require(remotes)){install.packages(\"remotes\")}\nremotes::install_github(\"bluegreen-labs/foto\")\nlibrary(\"foto\")\n```\n\nVignettes are not rendered by default, if you want to include additional\ndocumentation please use:\n\n``` r\nif(!require(remotes)){install.packages(\"remotes\")}\nremotes::install_github(\"bluegreen-labs/foto\", build_vignettes = TRUE)\nlibrary(\"foto\")\n```\n\n## Use\n\nTo classify image texture using the FOTO algorithm use the `foto()`\nfunction. The `foto()` routine returns a nested list with the source\ndata (aggregated zones used and fourier components used in the PCA\nanalysis) and a final colour image consisting of the three major\nprincipal components for every pixel.\n\n\u003cdetails\u003e\n\u003csummary\u003e\ndetailed parameter description (click to expand)\n\u003c/summary\u003e\n\u003cp\u003e\n\n| Parameter   | Description                                  |\n|-------------|----------------------------------------------|\n| x           | a raster layer (stack or brick)              |\n| window_size | a window size in pixels                      |\n| plot        | plot output (TRUE / FALSE)                   |\n| norm_spec   | normalize the radial spectrum (TRUE / FALSE) |\n| method      | “zones” or “mw” (i.e. moving window)         |\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n### Zones\n\nThe original implementation used discrete zones (blocks of x pixels\nwide, window_size parameter) to classify an image. This original\nimplementation is the default, and the least computationally intensive,\nas it effectively reduces to resolution of the orignal data. In short,\ndata is aggregated at the size of the specified window.\n\nAn example analysis is run below. In the resulting image pixels with a\nsimilar colour have a similar texture. The analysis is run on a\nhistorical image of plantations near Yangambi, DR Congo, as recovered in\nthe [COBECORE project](http://cobecore.org/). The regular pattern of\nplanted trees is picked up readily by the algorithm.\n\n``` r\n# load the library\nlibrary(foto)\n\n# load demo data\nr \u003c- raster::raster(system.file(\"extdata\", \"yangambi.png\",\n                          package = \"foto\",\n                          mustWork = TRUE))\n\n# classify pixels using zones (discrete steps)\noutput \u003c- foto(r,\n     plot = TRUE,\n     window_size = 25,\n     method = \"zones\")\n```\n\n![](https://bluegreen-labs.github.io/foto/articles/foto-vignette_files/figure-html/figure_1-1.png)\n\n``` r\n\n# print data structure\nprint(names(output))\n#\u003e [1] \"zones\"          \"radial_spectra\" \"rgb\"\n```\n\n### Moving window\n\nTo maintain the resolution of the original image a moving window\napproach can be used (method = “mw”). This approach overlays a window of\nsize x (window_size parameter) on every pixel in the image and applies\nthe FOTO methodology. This obviously represents a considerable\ncomputational burden and should be used with caution. An example is\ngiven below for a smaller subsection of the processed image above. The\noutput format of the moving window analysis is consistent with that of\nthe zoned approach.\n\n``` r\n# crop the image for speed\nr \u003c- crop(r, extent(1,100,1,100))\n\n# crop the image\noutput \u003c- foto(r,\n     plot = TRUE,\n     window_size = 25,\n     method = \"mw\")\n#\u003e A moving window approach is computationally intensive.\n#\u003e This might take a while.\n```\n\n![](https://bluegreen-labs.github.io/foto/articles/foto-vignette_files/figure-html/figure_2-1.png)\n\n## Partitioned normalization\n\nPartitioned normalization as described in [Barbier et\nal. 2010](https://onlinelibrary.wiley.com/doi/10.1111/j.1466-8238.2009.00493.x) is not\nprovided but easily accomplished once all images are processed. I refer\nto this paper for the appropriate routines.\n\n## References\n\n-   Couteron P, Pelissier R, Nicolini E a., Paget D (2005) Predicting\n    tropical forest stand structure parameters from Fourier transform of\n    very high-resolution remotely sensed canopy images. Journal of\n    Applied Ecology, 42, 1121–1128.\n\n-   Barbier N, Couteron P, Proisy C, Malhi Y, Gastellu-Etchegorry\n    J-P (2010) The variation of apparent crown size and canopy\n    heterogeneity across lowland Amazonian forests. Global Ecology and\n    Biogeography, 19, 72–84.\n\n-   Solórzano JV, Gallardo-cruz JA, González EJ et al. (2018)\n    Contrasting the potential of Fourier transformed ordination and gray\n    level co-occurrence matrix textures to model a tropical swamp forest\n    ’ s structural and diversity attributes. Journal of Applied Remote\n    Sensing, 12, 036006.\n\n## Acknowledgements\n\nThis package is supported through the Belgian Science Policy office\nCOBECORE project (BELSPO; grant BR/175/A3/COBECORE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluegreen-labs%2Ffoto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluegreen-labs%2Ffoto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluegreen-labs%2Ffoto/lists"}