Title: | A Package for Displaying Visual Scenes as They May Appear to an Animal with Lower Acuity |
Version: | 0.1 |
Date: | 2017-04-28 |
Author: | Eleanor Caves [aut, cre], Sönke Johnsen [aut] |
Maintainer: | Eleanor Caves <eleanor.caves@gmail.com> |
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 |
LazyData: | true |
RoxygenNote: | 6.0.1.9000 |
NeedsCompilation: | no |
Packaged: | 2017-05-08 21:35:15 UTC; ecaves |
Repository: | CRAN |
Date/Publication: | 2017-05-09 07:10:48 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 = T,
output = "test.jpg")
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, 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 |
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
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")
FFTMatrixShift
Description
This function rearranges the output of the FFT by moving the zero frequency component to the center
Usage
fft_matrix_shift(input_matrix, dim = -1)
Arguments
input_matrix |
the output of an FFT |
dim |
-1 gives the correct matrix shift for the AcuityView function |