| Title: | A Package for Displaying Visual Scenes as They May Appear to an Animal with Lower Acuity |
| Version: | 1.1.1 |
| Date: | 2026-01-28 |
| Description: | This code provides a simple method for representing a visual scene as it may be seen by an animal with less acute vision. When using (or for more information), please cite the original publication. |
| Depends: | R (≥ 3.0.0) |
| Imports: | imager (≥ 0.40.1), fftwtools (≥ 0.9-7), plotrix (≥ 3.2.3), tools, grid, grDevices, graphics |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| NeedsCompilation: | no |
| Packaged: | 2026-01-29 13:50:38 UTC; emc39 |
| Author: | Eleanor Caves [aut, cre], Sönke Johnsen [aut] |
| Maintainer: | Eleanor Caves <eleanor.caves@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-01-29 14:00:02 UTC |
AcuityView
Description
This function provides a simple method for displaying a visual scene as it may appear to an animal with lower acuity.
Usage
AcuityView(
photo = NULL,
distance = 2,
realWidth = 2,
eyeResolutionX = 0.2,
eyeResolutionY = NULL,
plot = TRUE,
output = NULL
)
Arguments
photo |
The photo you wish to alter; if NULL then a pop up window allows you to navigate to your photo, otherwise include the file path here |
distance |
The distance from the viewer to the object of interest in the image; can be in any units so long as it is in the same units as RealWidth |
realWidth |
The real width of the entire image; can be in any units as long as it is in the same units as distance |
eyeResolutionX |
The resolution of the viewer in degrees |
eyeResolutionY |
The resolution of the viewer in the Y direction, if different than ResolutionX; defaults to NULL, as it is uncommon for this to differ from eyeResolutionX |
plot |
Whether to plot the final image; defaults to T |
output |
The name of the output file, must be in the format of output="image_name.filetype"; acceptable filetypes are .bmp, .png, or .jpeg |
Value
Returns an image in the specified format
Image Format Requirements
Image must be in 3-channel format, either PNG, JPEG or BMP. Note: some PNG files have an alpha channel that makes them 4-channel images; this will not work with the code. The image must be 3-channel.
Image size
Image must be square with each side a power of 2 pixels. Example: 512x512, 1024 x 1024, 2048 x 2048 pixels
For Linux Users
You may need to install the fftw library in order for the R package "fftwtools" to install and perform correctly. The FFTW website and install information can be found here: http://www.fftw.org/ This library can easily be installed on Ubuntu with: apt-get install fftw3-dev
Examples
## Not run:
require(imager)
photo <- system.file("extdata/reef.bmp", package = "AcuityView")
reef <- load.image(photo)
AcuityView(photo = reef, distance = 2, realWidth = 2,
eyeResolutionX = 2, eyeResolutionY = NULL,
plot = TRUE,
output = file.path(tempdir(), "Example.jpeg"))
## End(Not run)
FFT Matrix Shift
Description
This function rearranges the output of a 2D FFT by moving the
zero-frequency component to the center of the matrix. It is used
internally by AcuityView() to correctly align spatial frequencies.
Usage
fft_matrix_shift(input_matrix, dim = -1)
Arguments
input_matrix |
The output of a 2D FFT. |
dim |
Integer. |
Value
A matrix with the zero-frequency component shifted to the center.