Title: | A Package for Displaying Visual Scenes as They May Appear to an Animal with Lower Acuity |
---|---|
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. |
Authors: | Eleanor Caves [aut, cre], Sönke Johnsen [aut] |
Maintainer: | Eleanor Caves <[email protected]> |
License: | GPL(>=2) |
Version: | 0.1 |
Built: | 2024-11-05 04:12:19 UTC |
Source: | https://github.com/eleanorcaves/acuityview |
This function provides a simple method for displaying a visual scene as it may appear to an animal with lower acuity.
AcuityView(photo = NULL, distance = 2, realWidth = 2, eyeResolutionX = 0.2, eyeResolutionY = NULL, plot = T, output = "test.jpg")
AcuityView(photo = NULL, distance = 2, realWidth = 2, eyeResolutionX = 0.2, eyeResolutionY = NULL, plot = T, output = "test.jpg")
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, but if F, the final image will still be saved to your working directory |
output |
The name of the output file, must be in the format of output="image_name.filetype"; acceptable filetypes are .bmp, .png, or .jpeg |
Returns an image in the specified format
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 must be square with each side a power of 2 pixels. Example: 512x512, 1024 x 1024, 2048 x 2048 pixels
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
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="Example.jpeg")
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="Example.jpeg")
This function rearranges the output of the FFT by moving the zero frequency component to the center
fft_matrix_shift(input_matrix, dim = -1)
fft_matrix_shift(input_matrix, dim = -1)
input_matrix |
the output of an FFT |
dim |
-1 gives the correct matrix shift for the AcuityView function |