Title: | Colour Vision Models |
---|---|
Description: | Colour vision models, colour spaces and colour thresholds. Provides flexibility to build user-defined colour vision models for n number of photoreceptor types. Includes Vorobyev & Osorio (1998) Receptor Noise Limited models <doi:10.1098/rspb.1998.0302>, Chittka (1992) colour hexagon <doi:10.1007/BF00199331>, and Endler & Mielke (2005) model <doi:10.1111/j.1095-8312.2005.00540.x>. Models have been extended to accept any number of photoreceptor types. |
Authors: | Felipe Malheiros Gawryszewski [aut, cre] |
Maintainer: | Felipe Malheiros Gawryszewski <[email protected]> |
License: | GPL-2 |
Version: | 2.1.0 |
Built: | 2025-01-09 04:46:20 UTC |
Source: | CRAN |
Colour vision models, colour spaces and colour thresholds. Provides flexibility to build user-defined colour vision models for n number of photoreceptor types. Includes Vorobyev & Osorio (1998) Receptor Noise Limited models <doi:10.1098/rspb.1998.0302>, Chittka (1992) colour hexagon <doi:10.1007/BF00199331>, and Endler & Mielke (2005) model <doi:10.1111/j.1095-8312.2005.00540.x>. Models have been extended to accept any number of photoreceptor types.
The DESCRIPTION file:
Package: | colourvision |
Type: | Package |
Title: | Colour Vision Models |
Version: | 2.1.0 |
Date: | 2024-12-19 |
Authors@R: | person("Felipe", "Malheiros Gawryszewski", role = c("aut", "cre"), email = "[email protected]") |
Description: | Colour vision models, colour spaces and colour thresholds. Provides flexibility to build user-defined colour vision models for n number of photoreceptor types. Includes Vorobyev & Osorio (1998) Receptor Noise Limited models <doi:10.1098/rspb.1998.0302>, Chittka (1992) colour hexagon <doi:10.1007/BF00199331>, and Endler & Mielke (2005) model <doi:10.1111/j.1095-8312.2005.00540.x>. Models have been extended to accept any number of photoreceptor types. |
License: | GPL-2 |
Imports: | graphics, stats, utils, Matrix |
Suggests: | testthat, knitr, rmarkdown, corrplot, rgl |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2024-12-23 11:26:13 UTC; argiope |
Author: | Felipe Malheiros Gawryszewski [aut, cre] |
Maintainer: | Felipe Malheiros Gawryszewski <[email protected]> |
Repository: | CRAN |
Date/Publication: | 2025-01-08 23:50:17 UTC |
Index of help topics:
CTTKhexagon Chittka (1992) colour hexagon CTTKhexagon3D Chittka (1992) colour space for tetrachromatic animals. CTTKmodel Chittka (1992) colour vision model D65 CIE Standard Illuminant D65 in quantum flux (umol/m2/s) EMline Endler and Mielke (2005) 1-D colour space EMmodel Endler and Mielke (2005) colour vision model EMtetrahedron Endler and Mielke (2005) tetrahedron colour space EMtriangle Endler and Mielke (2005) triangle colour space GENmodel N-dimensional generic colour vision model GENplot Generic model colour space 2D and 1D plot GENplot3d Generic model colour space 3D plot Q Total photon capture Qr Photoreceptor relative quantum catch RNLachrom Weber achromatic contrast for the Receptor Noise Limited Model (Vorobyev & Osorio 1998) RNLmodel Receptor Noise Limited Models (Vorobyev & Osorio 1998) RNLplot Receptor noise limited model 2D and 1D plot RNLplot3d Receptor noise limited model 3D plot RNLthres Colour thresholds based on the Receptor Noise Limited Model (Vorobyev & Osorio 1998). Rb Brazilian savannah background reflectance spectrum. bee Honeybee photoreceptors colour_space N-dimensional colour spaces colourvision-package Colour Vision Models deltaS Chromaticity distances energytoflux Irradiance from energy to quantum units. logistic Logistic curve noise_e Receptor noise photor Photoreceptor sensitivity spectra. plot.colourvision Plot colour vision models into chromaticity diagrams plot3d.colourvision Plot colour vision models into 3D chromaticity diagrams. radarplot Radar plot spec.denoise Smooth function for reflectance spectra.
Further information is available in the following vignettes:
colourvision-vignette |
Using colourvision (source, pdf) |
Felipe Malheiros Gawryszewski [aut, cre]
Maintainer: Felipe Malheiros Gawryszewski <[email protected]>
Gawryszewski, F.M. 2018. Colour vision models: Some simulations, a general n-dimensional model, and the colourvision R package. Ecology and Evolution, 10.1002/ece3.4288.
##Honeybee photoreceptor sensitivity curves data("bee") ##Grey background: ## with 10 percent. reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(10, length(300:700))) ## Read CIE D65 standard illuminant already converted to quantum flux: data("D65") ##Reflectance data ## with a sigmoid spectrum and midpoint at 500nm and 550 nm R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1, R2[,2]) ## Run colour vision model: model<-CTTKmodel(photo="tri", R=R, I=D65, Rb=Rb, C=bee) ##plot data in the colour space plot(model)
##Honeybee photoreceptor sensitivity curves data("bee") ##Grey background: ## with 10 percent. reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(10, length(300:700))) ## Read CIE D65 standard illuminant already converted to quantum flux: data("D65") ##Reflectance data ## with a sigmoid spectrum and midpoint at 500nm and 550 nm R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1, R2[,2]) ## Run colour vision model: model<-CTTKmodel(photo="tri", R=R, I=D65, Rb=Rb, C=bee) ##plot data in the colour space plot(model)
Honeybee (Apis mellifera) photoreceptor sensitivity curves.
data("bee")
data("bee")
A data frame with 401 observations on the following 4 variables.
Wavelength
a numeric vector
UV
a numeric vector
Blue
a numeric vector
Green
a numeric vector
Original data were interpolated to 1nm intervals from 300 to 700nm.
Chittka, L., and P. Kevan. 2005. Flower colour as advertisement. Pp. 157-196 in Practical pollination biology.
data("bee") plot(bee[,2]~bee[,1], col = "violet", type="l", xlab="Wavelength(nm)", ylab= "Absorbance") lines(bee[,3]~bee[,1], col = "blue", type="l") lines(bee[,4]~bee[,1], col = "green", type="l")
data("bee") plot(bee[,2]~bee[,1], col = "violet", type="l", xlab="Wavelength(nm)", ylab= "Absorbance") lines(bee[,3]~bee[,1], col = "blue", type="l") lines(bee[,4]~bee[,1], col = "green", type="l")
Generates a colour space based on any number of photoreceptor types and finds a colour locus for a given photoreceptor output.
colour_space(n, type="length", length=NA, edge=NA, q=rep(1,n), recep.noise=FALSE, e=NA)
colour_space(n, type="length", length=NA, edge=NA, q=rep(1,n), recep.noise=FALSE, e=NA)
n |
Number of photoreceptor types. Function accepts any number of photoreceptor types >=2. For instance, trichromatic: |
type |
Whether the colour space should be built with a fixed vector length ( |
length |
Vector length used to construct the colour space. Used when |
edge |
Edge length used to construct the colour space. Used when |
q |
Photoreceptor output values |
recep.noise |
Whether receptor noise should be used to calculate colour locus coordinates. |
e |
Vector representing photoreceptor noises. Used when |
This function is used internally in colour vision models.
A list with the following dimensions:
coordinates |
Colour locus of photoreceptor output values |
vector_matrix |
Matrix of column vectors, each representing one photoreceptor type |
Felipe M. Gawryszewski [email protected]
Pike, T.W. 2012. Generalised chromaticity diagrams for animals with n-chromatic colour vision. Journal of Insect Behavior 255: 277-286.
Renoult, J. P., A. Kelber, and H. M. Schaefer. 2015. Colour spaces in ecology and evolutionary biology. Biol Rev Camb Philos Soc, doi: 10.1111/brv.12230.
Q
, Qr
, CTTKmodel
, EMmodel
, RNLmodel
, GENmodel
#A trichromatic colour space based on Endler and Mielke (2005) tri<-colour_space(n=3, length=0.75, q=c(0.5,0.2,0.3)) #showing: #(1) Limits of the colour space (triangle) plot(0, ylim=c(-1,1), xlim=c(-1,1), asp=1, ylab="X2", xlab="X1", type="n") polygon(x=tri$vector_matrix[1,], y=tri$vector_matrix[2,], lty=2) #(2) Vectors (length=0.75) used to build the colour space (arrows) arrows(x0=0,y0=0, x1=tri$vector_matrix[1,1], y1=tri$vector_matrix[2,1], col="red") arrows(x0=0,y0=0, x1=tri$vector_matrix[1,2], y1=tri$vector_matrix[2,2], col="red") arrows(x0=0,y0=0, x1=tri$vector_matrix[1,3], y1=tri$vector_matrix[2,3], col="red") #(3) Colour loci of given photoreceptor outputs points(x=tri$coordinates[[1]], y=tri$coordinates[[2]], pch=21, col="blue", bg="blue")
#A trichromatic colour space based on Endler and Mielke (2005) tri<-colour_space(n=3, length=0.75, q=c(0.5,0.2,0.3)) #showing: #(1) Limits of the colour space (triangle) plot(0, ylim=c(-1,1), xlim=c(-1,1), asp=1, ylab="X2", xlab="X1", type="n") polygon(x=tri$vector_matrix[1,], y=tri$vector_matrix[2,], lty=2) #(2) Vectors (length=0.75) used to build the colour space (arrows) arrows(x0=0,y0=0, x1=tri$vector_matrix[1,1], y1=tri$vector_matrix[2,1], col="red") arrows(x0=0,y0=0, x1=tri$vector_matrix[1,2], y1=tri$vector_matrix[2,2], col="red") arrows(x0=0,y0=0, x1=tri$vector_matrix[1,3], y1=tri$vector_matrix[2,3], col="red") #(3) Colour loci of given photoreceptor outputs points(x=tri$coordinates[[1]], y=tri$coordinates[[2]], pch=21, col="blue", bg="blue")
Plots Chittka (1992) colour hexagon for trichromatic animals and a line plot for dichromatic animals.
CTTKhexagon(x, y, photo=3, vnames=c(expression(E[1]),expression(E[2]),expression(E[3])), pch=16, bty="n", yaxt="n",xaxt="n", col="black", xlim="auto", ylim="auto", asp=1, ann=FALSE, axes=FALSE, vectors=FALSE, ...)
CTTKhexagon(x, y, photo=3, vnames=c(expression(E[1]),expression(E[2]),expression(E[3])), pch=16, bty="n", yaxt="n",xaxt="n", col="black", xlim="auto", ylim="auto", asp=1, ann=FALSE, axes=FALSE, vectors=FALSE, ...)
x |
x-coordinate |
y |
y-coordinate. |
photo |
Number of photoreceptor types. |
vnames |
Vector names. |
pch |
see |
bty |
see |
yaxt |
see |
xaxt |
see |
col |
see |
xlim |
see |
ylim |
see |
asp |
see |
ann |
see |
axes |
see |
vectors |
Whether vectors representing direction of photoreceptor outputs should be plotted. |
... |
Other arguments passed to |
Felipe M. Gawryszewski [email protected]
Chittka, L. 1992. The colour hexagon: a chromaticity diagram based on photoreceptor excitations as a generalized representation of colour opponency. J Comp Physiol A 170:533-543.
##Honeybee photoreceptor sensitivity curves data("bee") ##Grey background: ## with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant already converted to quantum flux: data("D65") ##Reflectance data ## with a sigmoid spectrum and midpoint at 500nm and 550 nm R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1, R2[,2]) ## Run colour vision model: model<-CTTKmodel(photo="tri", R=R, I=D65, Rb=Rb, C=bee) ##plot data in the colour space CTTKhexagon(x=model[,"X1"], y=model[,"X2"])
##Honeybee photoreceptor sensitivity curves data("bee") ##Grey background: ## with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant already converted to quantum flux: data("D65") ##Reflectance data ## with a sigmoid spectrum and midpoint at 500nm and 550 nm R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1, R2[,2]) ## Run colour vision model: model<-CTTKmodel(photo="tri", R=R, I=D65, Rb=Rb, C=bee) ##plot data in the colour space CTTKhexagon(x=model[,"X1"], y=model[,"X2"])
Plots a hexagonal trapezohedron representing Chittka (1992) colour space for tetrachromatic animals (Thery and Casas, 2002).
CTTKhexagon3D(x, y, z, s.col = "red", f.col = "black", vnames = c("E1","E2","E3","E4"), type = "p", radius = 0.01, add = F, xlab = "", ylab = "", zlab = "", box = F, axes = F, ylim = c(-1, 1), xlim = c(-1, 1), zlim = c(-1,1), aspect = T, vectors=F, ...)
CTTKhexagon3D(x, y, z, s.col = "red", f.col = "black", vnames = c("E1","E2","E3","E4"), type = "p", radius = 0.01, add = F, xlab = "", ylab = "", zlab = "", box = F, axes = F, ylim = c(-1, 1), xlim = c(-1, 1), zlim = c(-1,1), aspect = T, vectors=F, ...)
x |
x coordinate of points to be plotted |
y |
y coordinate of points to be plotted |
z |
z coordinate of points to be plotted |
s.col |
Colour to be used for plotted items. See plot3d in the rgl package. |
f.col |
Colour of tetrahedron lines. See plot3d in rgl package. |
vnames |
Vector names. |
type |
see plot3d function in the rgl package. |
radius |
see plot3d function in the rgl package. |
add |
see plot3d function in the rgl package. |
xlab |
see plot3d function in the rgl package. |
ylab |
see plot3d function in the rgl package. |
zlab |
see plot3d function in the rgl package. |
box |
see plot3d function in the rgl package. |
axes |
see plot3d function in the rgl package. |
ylim |
see plot3d function in the rgl package. |
xlim |
see plot3d function in the rgl package. |
zlim |
see plot3d function in the rgl package. |
aspect |
see plot3d function in the rgl package. |
vectors |
Whether vectors representing direction of photoreceptor outputs should be plotted. |
... |
Other arguments passed to function plot3d in the rgl package. |
Felipe M. Gawryszewski [email protected]
Chittka, L. 1992. The colour hexagon: a chromaticity diagram based on photoreceptor excitations as a generalized representation of colour opponency. J Comp Physiol A 170, 533-543.
Thery, M., and J. Casas. 2002. Predator and prey views of spider camouflage. Nature 415, 133-133.
Chittka (1992) colour hexagon extended to animals with any number of photoreceptors types.
CTTKmodel(photo=ncol(C)-1, R, I, Rb, C, interpolate=TRUE, nm=seq(300,700,1))
CTTKmodel(photo=ncol(C)-1, R, I, Rb, C, interpolate=TRUE, nm=seq(300,700,1))
photo |
Number of photoreceptor types. Model accepts any number of photoreceptor types ( |
R |
Reflectance of observed objects. A data frame with first column corresponding to wavelength values and following columns with reflectance values. |
I |
Irradiance spectrum. A data frame with two columns only: first column corresponding to wavelength values and second column with irradiance values. Irradiance values must be in quantum flux units. |
Rb |
Background reflectance. A data frame with two columns only: first column corresponding to wavelength values and second column with reflectance values. |
C |
Photoreceptor sensitivity curves, from lowest to longest lambda-max. A data frame: first column corresponding to wavelength values and following columns with photoreceptor sensitivity values (see function |
interpolate |
Whether data files should be interpolated before further calculations. See |
nm |
A sequence of numeric values specifying where interpolation is to take place. See |
The original model is available for trichromatic animals only. Thery and Casas (2002) derived a version for tetrachromatic animals which is implemented here. In colourvision
, this model was extended to any number of photoreceptors types (Gawryszewski 2018; see also Pike 2012). The colour hexagon in Chittka (1992) has a vector of length = 1.0 The chromaticity coordinates in colourvision
preserve the same vector length.
Photoreceptor outputs () are calculated by:
where is given by
Qr
.
Then, for trichromatic vision, coordinates in the colour space are found by (Chittka 1992):
For tetrachromatic vision (Thery and Casas 2002):
For a pentachromatic animal following the same vector length:
Qri |
Photoreceptor photon catch values after the von Kries transformation (see function |
Ei |
Photoreceptor output values. Values can vary from 0 to 1. |
Xi |
Coordinates in the colour space. |
deltaS |
Euclidean distance to the origin of the colour space. It represents the conspicuousness of the stimulus ( |
Felipe M. Gawryszewski [email protected]
Chittka, L. 1992. The colour hexagon: a chromaticity diagram based on photoreceptor excitations as a generalized representation of colour opponency. J Comp Physiol A 170:533-543.
Gawryszewski, F.M. 2018. Colour vision models: Some simulations, a general n-dimensional model, and the colourvision R package. Ecology and Evolution, 10.1002/ece3.4288.
Pike, T.W. 2012. Generalised chromaticity diagrams for animals with n-chromatic colour vision. Journal of Insect Behavior 255: 277-286.
Thery, M., and J. Casas. 2002. Predator and prey views of spider camouflage. Nature 415:133-133.
CTTKhexagon
, CTTKhexagon3D
, photor
, RNLmodel
, EMmodel
, deltaS
##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ## Grey background ## with 10 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(10, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ## Reflectance data ## with a sigmoid spectrum and midpoint at 500nm R<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) ## Run model model<-CTTKmodel(photo=3, R=R, I=D65, Rb=Rb, C=C) #plot plot(model)
##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ## Grey background ## with 10 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(10, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ## Reflectance data ## with a sigmoid spectrum and midpoint at 500nm R<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) ## Run model model<-CTTKmodel(photo=3, R=R, I=D65, Rb=Rb, C=C) #plot plot(model)
CIE Standard Illuminant D65. Datum has already been converted to quantum flux (umol/m2/s) and therefore can be used in colour vision models directly.
data("D65")
data("D65")
A data frame with 107 observations on the following 2 variables.
l.nm
a numeric vector
Standard.Illuminant.D65
a numeric vector
data("D65") plot(D65, type="l")
data("D65") plot(D65, type="l")
Calculates a matrix with all possible pairwise comparison between stimulus reflectance spectra based on a given colour vision model output.
deltaS(model)
deltaS(model)
model |
Output of a colour vision model |
.
A matrix with pairwise chromaticity distances.
Felipe M. Gawryszewski [email protected]
CTTKmodel
, RNLmodel
, EMmodel
,GENmodel
##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ## Grey background ## with 10 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(10, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ## Reflectance data ## with a sigmoid spectrum and midpoint at 500nm R1<-logistic(x=seq(300,700,1), x0=450, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R3<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1,R2[,2],R3[,2]) ## Run model model<-CTTKmodel(photo=3, R=R, I=D65, Rb=Rb, C=C) #Chromaticity distances between R1, R2 and R3 deltaS(model)
##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ## Grey background ## with 10 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(10, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ## Reflectance data ## with a sigmoid spectrum and midpoint at 500nm R1<-logistic(x=seq(300,700,1), x0=450, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R3<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1,R2[,2],R3[,2]) ## Run model model<-CTTKmodel(photo=3, R=R, I=D65, Rb=Rb, C=C) #Chromaticity distances between R1, R2 and R3 deltaS(model)
Plots a colour space for dichromatic Endler and Mielke (2005) colour vision model.
EMline(x,y=rep(0, length(x)), type="length", vnames=c("E1","E2"), ylim="auto", xlim="auto", ann=FALSE, axes = FALSE, ...)
EMline(x,y=rep(0, length(x)), type="length", vnames=c("E1","E2"), ylim="auto", xlim="auto", ann=FALSE, axes = FALSE, ...)
x |
x-coordinate |
y |
y-coordinate |
type |
Whether the colour space should be built with a fixed vector length, or a fixed edge length (distance between vertices). |
vnames |
Vector names |
ylim |
see |
xlim |
see |
ann |
see |
axes |
see |
... |
Other arguments passed to |
The original model is available for tetrachromatic animals only. Colour space is built either with a vector length = 0.75 or a edge length = sqrt(3/2), to match the tetrahedron proposed by Endler and Mielke (2005).
Felipe M. Gawryszewski [email protected]
Endler, J. A., and P. Mielke. 2005. Comparing entire colour patterns as birds see them. Biol J Linn Soc 86:405-431.
EMtriangle
, EMtetrahedron
, EMmodel
EMline(x=0.1, pch=16, col="red")
EMline(x=0.1, pch=16, col="red")
Endler and Mielke (2005) colour vision model extended to animals with any number of photoreceptor types.
EMmodel(photo = ncol(C)-1, type="length", R, I, Rb, C, interpolate=TRUE, nm=seq(300,700,1))
EMmodel(photo = ncol(C)-1, type="length", R, I, Rb, C, interpolate=TRUE, nm=seq(300,700,1))
photo |
Number of photoreceptor types. Model accepts any number of photoreceptor types ( |
type |
Whether the colour space should be built with a fixed vector length ( |
R |
Reflectance of observed objects. A data frame with first column corresponding to wavelength values and following columns with reflectance values. |
I |
Irradiance spectrum. A data frame with two columns only: first column corresponding to wavelength values and second column with irradiance values. Irradiance values must be in quantum flux units. |
Rb |
Background reflectance. A data frame with two columns only: first column corresponding to wavelength values and second column with reflectance values. |
C |
Photoreceptor sensitivity curves, from lowest to longest lambda-max. A data frame: first column corresponding to wavelength values and following columns with photoreceptor sensitivity values (see function |
interpolate |
Whether data files should be interpolated before further calculations. See |
nm |
A sequence of numeric values specifying where interpolation is to take place. See |
The original model is available for tetrachromatic animals only. In colourvision
, the model was extended to any number of photoreceptors types (see also Pike 2012 formula).
First, relative quantum catches are log-transformed:
where is the relative quantum catch of photoreceptor type i, given by
Qr
. The model uses only relative output values, so that photoreceptor outputs are given by:
For tetrachromatic vision (Endler and Mielke 2005):
Tetrachromatic chromaticity diagram (tetrahedron) in Endler and Mielke (2005) has a vector of length = 0.75 and and edge length = sqrt(3/2). The chromaticity coordinates for other colour spaces may preserve either the same vector length or edge length.
For instance, for dichromatic vision coordinate (X1) in the colour space preserving the same vector length is found by:
Whereas for trichromatic vision coordinates (X1 and X2) are found by:
Qri |
Photoreceptor photon catch values after the von Kries transformation (see function |
Ei |
Photoreceptor outputs after conversion to relative values. |
Xi |
Coordinates in the colour space. |
deltaS |
Euclidean distance to the origin of the colour space. It represents the conspicuousness of the stimulus ( |
Felipe M. Gawryszewski [email protected]
Endler, J. A., and P. Mielke. 2005. Comparing entire colour patterns as birds see them. Biol J Linn Soc 86:405-431.
Pike, T.W. 2012. Generalised chromaticity diagrams for animals with n-chromatic colour vision. Journal of Insect Behavior 255: 277-286.
EMline
, EMtriangle
, EMtetrahedron
, photor
, CTTKmodel
, RNLmodel
, GENmodel
##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ##Gray background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ##Reflectance data ## with a sigmoid spectrum and midpoint at 500nm and 550 nm R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1, R2[,2]) R[,2]<-R[,2]+10 R[,3]<-R[,3]+10 ## Run model model<-EMmodel(photo=3, type="edge", R=R, I=D65, Rb=Rb, C=C) plot(model)
##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ##Gray background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ##Reflectance data ## with a sigmoid spectrum and midpoint at 500nm and 550 nm R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1, R2[,2]) R[,2]<-R[,2]+10 R[,3]<-R[,3]+10 ## Run model model<-EMmodel(photo=3, type="edge", R=R, I=D65, Rb=Rb, C=C) plot(model)
Plots Endler and Mielke (2005) tetrahedron colour space for tetrachromatic animals.
EMtetrahedron(x, y, z, s.col = "red", f.col = "black", vnames = c("u","s","m","l"), type = "p", radius = 0.01, add = F, xlab = "", ylab = "", zlab = "", box = F, axes = F, ylim = c(-0.75, 0.75), xlim = c(-0.75, 0.75), zlim = c(-0.75, 0.75), aspect = T, vectors=FALSE, ...)
EMtetrahedron(x, y, z, s.col = "red", f.col = "black", vnames = c("u","s","m","l"), type = "p", radius = 0.01, add = F, xlab = "", ylab = "", zlab = "", box = F, axes = F, ylim = c(-0.75, 0.75), xlim = c(-0.75, 0.75), zlim = c(-0.75, 0.75), aspect = T, vectors=FALSE, ...)
x |
x coordinate of points to be plotted |
y |
y coordinate of points to be plotted |
z |
z coordinate of points to be plotted |
s.col |
Colour to be used for plotted items. See plot3d in the rgl package. |
f.col |
Colour of tetrahedron lines. See plot3d in the rgl package. |
vnames |
Vector names. |
type |
see plot3d function in the rgl package. |
radius |
see plot3d function in the rgl package. |
add |
see plot3d function in the rgl package. |
xlab |
see plot3d function in the rgl package. |
ylab |
see plot3d function in the rgl package. |
zlab |
see plot3d function in the rgl package. |
box |
see plot3d function in the rgl package. |
axes |
see plot3d function in the rgl package. |
ylim |
see plot3d function in the rgl package. |
xlim |
see plot3d function in the rgl package. |
zlim |
see plot3d function in the rgl package. |
aspect |
see plot3d function in the rgl package. |
vectors |
Whether vectors representing direction of photoreceptor outputs should be plotted. |
... |
Other arguments passed to function plot3d in the rgl package. |
Felipe M. Gawryszewski [email protected]
Endler, J. A., and P. Mielke. 2005. Comparing entire colour patterns as birds see them. Biol J Linn Soc 86:405-431.
Plots a triangle colour space for trichromatic Endler and Mielke (2005) colour vision model.
EMtriangle(x, y, type=c("length", "edge"), vnames=c("u","s","m"), ylim=c(-0.9,0.9), xlim=c(-0.9,0.9), pch=16, bty="n",yaxt="n",xaxt="n", col="black", asp=1, ann=FALSE, vectors=FALSE, ...)
EMtriangle(x, y, type=c("length", "edge"), vnames=c("u","s","m"), ylim=c(-0.9,0.9), xlim=c(-0.9,0.9), pch=16, bty="n",yaxt="n",xaxt="n", col="black", asp=1, ann=FALSE, vectors=FALSE, ...)
x |
x-coordinate |
y |
y-coordinate |
type |
Whether the colour space should be built with a fixed vector length, or a fixed edge length (distance between vertices). |
vnames |
Vector names |
ylim |
see |
xlim |
see |
pch |
see |
bty |
see |
yaxt |
see |
xaxt |
see |
col |
see |
asp |
see |
ann |
see |
vectors |
Whether vectors representing direction of photoreceptor outputs should be plotted. |
... |
Other arguments passed to |
The original model is available for tetrachromatic animals only. Trichromatic version is implemented in colourvision
based on Pike (2012) formula. The triangle is built either with a vector length = 0.75 or a edge length = sqrt(3/2), to match the tetrahedron proposed by Endler and Mielke (2005). Doris Gomez derived a trichromatic version which is available in software AVICOL (Gomez, 2006) and was previously implemented here (colouvision v0.1
).
Felipe M. Gawryszewski [email protected]
Endler, J. A., and P. Mielke. 2005. Comparing entire colour patterns as birds see them. Biol J Linn Soc 86:405-431.
Pike, T.W. 2012. Generalised chromaticity diagrams for animals with n-chromatic colour vision. Journal of Insect Behavior 255: 277-286.
Gomez, D. 2006. AVICOL, a program to analyse spectrometric data. Last update october 2011. Free executable available at:
http://sites.google.com/site/avicolprogram/ or from the author at [email protected]
EMtriangle(x=0,y=0, type="length", pch=16, col="red")
EMtriangle(x=0,y=0, type="length", pch=16, col="red")
Convert Irradiance datum from energy units (uW/cm2/nm) to quantum flux units (umol/m2/s)
energytoflux(datum)
energytoflux(datum)
datum |
A data frame with first column corresponding to wavelength values and second column with irradiance values. Irradiance values must be in energy units (uW/cm2/nm). |
A data frame with first column corresponding to wavelength values and second column with irradiance values in umol/m2/s.
Felipe M. Gawryszewski [email protected]
A flexible function to build colour vision models based on any number of photoreceptor types (Gawryszewski 2018).
GENmodel(photo=ncol(C)-1, type="length", length=NA, edge=NA, R, I, Rb=NA, C, vonKries = TRUE, func, unity=FALSE, recep.noise=FALSE, noise.given=TRUE, e=NA, v=NA, n=NA, interpolate=TRUE, nm=seq(300,700,1))
GENmodel(photo=ncol(C)-1, type="length", length=NA, edge=NA, R, I, Rb=NA, C, vonKries = TRUE, func, unity=FALSE, recep.noise=FALSE, noise.given=TRUE, e=NA, v=NA, n=NA, interpolate=TRUE, nm=seq(300,700,1))
photo |
Number of photoreceptor types. Model accepts any number of photoreceptor types ( |
type |
Whether the colour space should be built with a fixed vector length ( |
length |
Vector length used to construct the colour space. Used when |
edge |
Edge length used to construct the colour space. Used when |
R |
Reflectance of observed objects. A data frame with first column corresponding to wavelength values and following columns with reflectance values. |
I |
Irradiance spectrum. A data frame with two columns only: first column corresponding to wavelength values and second column with irradiance values. Irradiance values must be in quantum flux units. |
Rb |
Background reflectance. A data frame with two columns only: first column corresponding to wavelength values and second column with reflectance values. |
C |
Photoreceptor sensitivity curves, from lowest to longest lambda-max. A data frame: first column corresponding to wavelength values and following columns with photoreceptor sensitivity values (see function |
vonKries |
Whether the von Kries transformation should be applied to photoreceptor photon catches. Calculates the ratio between stimulus and background photoreceptor photon catches |
func |
Transformation of photoreceptors inputs. For instance, |
unity |
Whether sum of photoreceptor output should be normalized to 1, as in |
recep.noise |
Logical. Whether chromaticity distances should be calculated based on receptor noises. |
noise.given |
Logical. Whether receptor noise is provided ( |
e |
Receptor noise of each photoreceptor type. Used when |
n |
Relative number of each photoreceptor type in the retina. Used to calculate |
v |
Noise-to-signal ratio of a single photoreceptor. Used to calculate |
interpolate |
Whether data files should be interpolated before further calculations. See |
nm |
A sequence of numeric values specifying where interpolation is to take place. See |
ei |
Noise of photoreceptor channels. Calculated only when |
Qri |
Photoreceptor photon catch values from |
Ei |
Photoreceptor outputs. |
Xi |
Stimulus colour locus coordinates in the colour space |
deltaS |
Euclidean distance to the origin of the colour space. It represents the conspicuousness of the stimulus ( |
Felipe M. Gawryszewski [email protected]
Gawryszewski, F.M. 2018. Colour vision models: Some simulations, a general n-dimensional model, and the colourvision R package. Ecology and Evolution, 10.1002/ece3.4288.
Pike, T.W. 2012. Generalised chromaticity diagrams for animals with n-chromatic colour vision. Journal of Insect Behavior 255: 277-286.
Renoult, J. P., A. Kelber, and H. M. Schaefer. 2015. Colour spaces in ecology and evolutionary biology. Biol Rev Camb Philos Soc, doi: 10.1111/brv.12230.
Q
, Qr
, CTTKmodel
, EMmodel
, RNLmodel
, colour_space
#A trichromatic colour vision model based on Endler and Mielke (2005) ##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ##Gray background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ##Reflectance data ## with a sigmoid spectrum and midpoint at 500nm and 550 nm R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1, R2[,2]) R[,2]<-R[,2]+10 R[,3]<-R[,3]+10 ## Run model model<-GENmodel(length=0.75, R=R, I=D65, Rb=Rb, C=C, func=log, unity=TRUE) plot(model)
#A trichromatic colour vision model based on Endler and Mielke (2005) ##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ##Gray background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ##Reflectance data ## with a sigmoid spectrum and midpoint at 500nm and 550 nm R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1, R2[,2]) R[,2]<-R[,2]+10 R[,3]<-R[,3]+10 ## Run model model<-GENmodel(length=0.75, R=R, I=D65, Rb=Rb, C=C, func=log, unity=TRUE) plot(model)
Plots models based on the GENmodel( ) function for trichromatic and dichromatic animals.
GENplot(model, photo, col.names=c("X1","X2"), vectors=TRUE, vnames=TRUE, vsize="auto", ylab="y", xlab="x", xlim="auto", ylim="auto", asp=1, ...)
GENplot(model, photo, col.names=c("X1","X2"), vectors=TRUE, vnames=TRUE, vsize="auto", ylab="y", xlab="x", xlim="auto", ylim="auto", asp=1, ...)
model |
Output of a colour vision model. |
photo |
Number of photoreceptor types. |
col.names |
Column names to be plotted. |
vectors |
Whether vectors representing direction of photoreceptor outputs should be plotted. |
vnames |
Whether vector names should be plotted. |
vsize |
Length of vectors to be plotted. Default calculates length automatically. |
ylab |
y-axis range. Default calculates range automatically. See |
xlab |
x-axis range. Default calculates range automatically. See |
xlim |
see |
ylim |
see |
asp |
see |
... |
Other arguments passed to |
Felipe M. Gawryszewski [email protected]
CTTKhexagon
, CTTKhexagon3D
, EMtriangle
, EMtetrahedron
, RNLplot
, RNLplot3d
, GENplot3d
, plot.colourvision
, plot3d.colourvision
Plots models based on the GENmodel( ) function for tetrachromatic animals.
GENplot3d(model, col.names=c("X1","X2","X3"), vectors=TRUE, vnames=TRUE, vsize="auto", xlab="x", ylab="y", zlab="z", xlim="auto", ylim="auto", zlim="auto", asp=1, ...)
GENplot3d(model, col.names=c("X1","X2","X3"), vectors=TRUE, vnames=TRUE, vsize="auto", xlab="x", ylab="y", zlab="z", xlim="auto", ylim="auto", zlim="auto", asp=1, ...)
model |
Output of a colour vision model. |
col.names |
Column names to be plotted. |
vectors |
Whether vectors representing direction of photoreceptor outputs should be plotted. |
vnames |
Whether vector names should be plotted. |
vsize |
Length of vectors to be plotted. Default calculates length automatically. |
xlab |
see par3d function in the rgl package. |
ylab |
see par3d function in the rgl package. |
zlab |
see par3d function in the rgl package. |
xlim |
x-axis range. Default calculates range automatically. See par3d function in the rgl package. |
ylim |
y-axis range. Default calculates range automatically. See par3d function in the rgl package. |
zlim |
z-axis range. Default calculates range automatically. See par3d function in the rgl package. |
asp |
see plot3d function in the rgl package. |
... |
Other arguments passed to function plot3d in the rgl package. |
Felipe M. Gawryszewski [email protected]
CTTKhexagon
, CTTKhexagon3D
, EMtriangle
, EMtetrahedron
, RNLplot
, RNLplot3d
, GENplot
, plot.colourvision
, plot3d.colourvision
Generates a logistic curve.
logistic(x = seq(300, 700, 1), x0, L, k)
logistic(x = seq(300, 700, 1), x0, L, k)
x |
Range. |
x0 |
Midpoint value. |
L |
Maximum value. |
k |
Steepness of the curve |
Felipe M. Gawryszewski [email protected]
https://en.wikipedia.org/wiki/Logistic_function
l<-logistic(x=seq(300,700,1), x0=650, L=50, k=0.04) plot(l, type="l")
l<-logistic(x=seq(300,700,1), x0=650, L=50, k=0.04) plot(l, type="l")
Receptor noise either provided by the user or based on noise-to-signal ratio of a single photoreceptor and the relative abundance of photoreceptor types in the retina. This function is used internally in Receptor Noise Limited models.
noise_e(noise, e, v, n)
noise_e(noise, e, v, n)
noise |
Logical. Whether receptor noise is provided ( |
e |
Receptor noise of each photoreceptor type. It is used when |
v |
Noise-to-signal ratio of a single photoreceptor. Either a single value or a vector of same length as |
n |
Relative abundance of the photoreceptor in the retina. |
Felipe M. Gawryszewski [email protected]
Vorobyev, M., and D. Osorio. 1998. Receptor noise as a determinant of colour thresholds. Proceedings of the Royal Society B 265:351-358.
RNLmodel
, RNLthres
, GENmodel
, colour_space
Generates photoreceptor sensitivity spectra based on lambda-max values.
photor(lambda.max, lambda = seq(300, 700, 1), beta.band = FALSE)
photor(lambda.max, lambda = seq(300, 700, 1), beta.band = FALSE)
lambda.max |
Vector with photoreceptor wavelength at maximum sensitivity values, in increasing order. |
lambda |
Range and interval to calculate the sensitivity curves. |
beta.band |
Logical. Whether or not to include a beta-band in the sensitivity curve. |
A data frame with first column corresponding to wavelength values and following columns with photoreceptor sensitivity values
Felipe M. Gawryszewski [email protected]
Govardovskii, V. I., N. Fyhrquist, T. Reuter, D. G. Kuzmin, and K. Donner. 2000. In search of the visual pigment template. Vis. Neurosci. 17:509-528.
CTTKmodel
, EMmodel
, RNLmodel
, RNLthres
## Generates photoreceptor sensitivity ## values with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) plot(C[,2]~C[,1], type="l", col="violet") lines(C[,3]~C[,1], type="l", col="blue") lines(C[,4]~C[,1], type="l", col="green")
## Generates photoreceptor sensitivity ## values with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) plot(C[,2]~C[,1], type="l", col="violet") lines(C[,3]~C[,1], type="l", col="blue") lines(C[,4]~C[,1], type="l", col="green")
Plotting method for objects of class colourvision
. Plotting method for animals with two or three photoreceptor types.
## S3 method for class 'colourvision' plot(x, ...)
## S3 method for class 'colourvision' plot(x, ...)
x |
Object of class " |
... |
Additional arguments passed to the plot function. See |
Felipe M. Gawryszewski [email protected]
Chittka, L. 1992. The colour hexagon: a chromaticity diagram based on photoreceptor excitations as a generalized representation of colour opponency. J Comp Physiol A 170:533-543.
Endler, J. A., and P. Mielke. 2005. Comparing entire colour patterns as birds see them. Biol J Linn Soc 86:405-431.
plot3d.colourvision
, EMtriangle
, CTTKhexagon
, EMmodel
, CTTKmodel
, RNLmodel
, RNLthres
#trichromatic ##Photoreceptor sensitivity curves C<-photor(lambda.max=c(350,450,550)) ##Gray background Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ##Reflectance data R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1[,2]<-R1[,2]+10 ##Run models model<-EMmodel(photo=3, R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-CTTKmodel(photo=3, R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-RNLmodel(model="log", photo=3, R1=R1, I=D65, Rb=Rb, C=C, noise=TRUE, e=c(0.13, 0.06, 0.12)) plot(model) #colour threshold model<-RNLthres(photo=3, I=D65, Rb=Rb, C=C, noise=TRUE, e=c(0.13, 0.06, 0.12)) plot(model) #dichromatic ##Photoreceptor sensitivity curves C<-photor(lambda.max=c(400,550)) ##Run models model<-EMmodel(photo=2, R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-EMmodel(photo=2, type="edge", R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-CTTKmodel(photo=2, R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-RNLmodel(model="log", photo=2, R1=R1, I=D65, Rb=Rb, C=C, noise=TRUE, e=c(0.13, 0.06)) plot(model) #colour threshold model<-RNLthres(photo=2, I=D65, Rb=Rb, C=C, noise=TRUE, e=c(0.13, 0.06)) plot(model)
#trichromatic ##Photoreceptor sensitivity curves C<-photor(lambda.max=c(350,450,550)) ##Gray background Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ##Reflectance data R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1[,2]<-R1[,2]+10 ##Run models model<-EMmodel(photo=3, R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-CTTKmodel(photo=3, R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-RNLmodel(model="log", photo=3, R1=R1, I=D65, Rb=Rb, C=C, noise=TRUE, e=c(0.13, 0.06, 0.12)) plot(model) #colour threshold model<-RNLthres(photo=3, I=D65, Rb=Rb, C=C, noise=TRUE, e=c(0.13, 0.06, 0.12)) plot(model) #dichromatic ##Photoreceptor sensitivity curves C<-photor(lambda.max=c(400,550)) ##Run models model<-EMmodel(photo=2, R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-EMmodel(photo=2, type="edge", R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-CTTKmodel(photo=2, R=R1, I=D65, Rb=Rb, C=C) plot(model) model<-RNLmodel(model="log", photo=2, R1=R1, I=D65, Rb=Rb, C=C, noise=TRUE, e=c(0.13, 0.06)) plot(model) #colour threshold model<-RNLthres(photo=2, I=D65, Rb=Rb, C=C, noise=TRUE, e=c(0.13, 0.06)) plot(model)
'plot3d' method for objects of class colourvision
. Plotting method for animals with four photoreceptor types.
## S3 method for class 'colourvision' plot3d(x, ...)
## S3 method for class 'colourvision' plot3d(x, ...)
x |
Object of class " |
... |
Additional arguments passed to the plot3d function. See |
Felipe M. Gawryszewski [email protected]
Chittka, L. 1992. The colour hexagon: a chromaticity diagram based on photoreceptor excitations as a generalized representation of colour opponency. J Comp Physiol A 170:533-543.
Endler, J. A., and P. Mielke. 2005. Comparing entire colour patterns as birds see them. Biol J Linn Soc 86:405-431.
Thery, M., and J. Casas. 2002. Predator and prey views of spider camouflage. Nature 415:133-133.
plot.colourvision
, EMtetrahedron
, CTTKhexagon3D
, EMmodel
, CTTKmodel
, RNLmodel
Total photoreceptor photon capture for a given irradiance, reflectance and photoreceptor sensitivity curve. This function is used internally in colour vision models.
Q(R,I,C,interpolate,nm)
Q(R,I,C,interpolate,nm)
R |
Reflectance of observed object. A data frame with two columns only: first column corresponding to wavelength values and second column with reflectance values. |
I |
Irradiance spectrum. A data frame with two columns only: first column corresponding to wavelength values and second column with irradiance values. Irradiance values must be in quantum flux units. |
C |
Photoreceptor sensitivity curve. A data frame with two columns only: first column corresponding to wavelength values and second column with photoreceptor absorbance values. |
interpolate |
Whether data files should be interpolated before further calculations. See |
nm |
A sequence of numeric values specifying where interpolation is to take place. See |
Gives the total photoreceptor photon capture.
Felipe M. Gawryszewski [email protected]
Backhaus, W., and R. Menzel. 1987. Color distance derived from a receptor model of color vision in the honeybee. Biological Cybernetics 55:321-331.
Chittka, L. 1992. The colour hexagon: a chromaticity diagram based on photoreceptor excitations as a generalized representation of colour opponency. J Comp Physiol A 170:533-543.
Endler, J. A., and P. Mielke. 2005. Comparing entire colour patterns as birds see them. Biol J Linn Soc 86:405-431.
Vorobyev, M., and D. Osorio. 1998. Receptor noise as a determinant of colour thresholds. Proceedings of the Royal Society B 265:351-358.
Qr
, CTTKmodel
, EMmodel
, RNLmodel
, RNLthres
,GENmodel
von Kries transformation. Photoreceptors are assumed to be adapted to the background. This function is used internally in colour vision models.
Qr(R, I, Rb, C, interpolate, nm)
Qr(R, I, Rb, C, interpolate, nm)
R |
Reflectance of observed object. A data frame with two columns only: first column corresponding to wavelength values and second column with reflectance values. |
I |
Irradiance spectrum. A data frame with two columns only: first column corresponding to wavelength values and second column with irradiance values. Irradiance values must be in quantum flux units. |
Rb |
Background reflectance. A data frame with two columns only: first column corresponding to wavelength values and second column with reflectance values. Photoreceptors are assumed to be adapted to the background reflectance. |
C |
Photoreceptor sensitivity curve. A data frame with two columns only: first column corresponding to wavelength values and second column with photoreceptor absorbance values. |
interpolate |
Whether data files should be interpolated before further calculations. See |
nm |
A sequence of numeric values specifying where interpolation is to take place. See |
For the von Kries transformation, first the quantum catches of the observed reflectance and the environmental background are calculated (see Q
). Then:
where is the quantum catch arising from the observed object and
is the quantum catch from the background, for each one of the photoreceptor types (i).
Photoreceptor relative quantum catch.
Felipe M. Gawryszewski [email protected]
Backhaus, W. 1991. Color opponent coding in the visual system of the honeybee. Vision Res 31:1381-1397.
Chittka, L. 1992. The colour hexagon: a chromaticity diagram based on photoreceptor excitations as a generalized representation of colour opponency. J Comp Physiol A 170:533-543.
Endler, J. A., and P. Mielke. 2005. Comparing entire colour patterns as birds see them. Biol J Linn Soc 86:405-431.
Vorobyev, M., and D. Osorio. 1998. Receptor noise as a determinant of colour thresholds. Proceedings of the Royal Society B 265:351-358.
CTTKmodel
, EMmodel
, RNLmodel
, RNLthres
, GENmodel
Plots quantum catches or E-values (photoreceptor outputs) into a radar plot.
radarplot(model, item=c("Qr", "E"), item.labels=FALSE, item.lwd=1, border=NULL, radar.lwd=1, radar.col="grey", length="auto", xlim="auto", ylim="auto", xlab="", ylab="", asp=1, add = FALSE, ...)
radarplot(model, item=c("Qr", "E"), item.labels=FALSE, item.lwd=1, border=NULL, radar.lwd=1, radar.col="grey", length="auto", xlim="auto", ylim="auto", xlab="", ylab="", asp=1, add = FALSE, ...)
model |
Output of a colour vision model. |
item |
Whether photoreceptor inputs ( |
item.labels |
Logical. Whether vector names should be plotted. |
item.lwd |
Width of lines connecting item values. |
border |
Colour of lines connecting item values. See |
radar.lwd |
Width of lines representing item vectors. |
radar.col |
Colour of lines representing item vectors. |
length |
Length of |
xlim |
x-axis range. Default calculates range automatically. See |
ylim |
y-axis range. Default calculates range automatically. See |
xlab |
see |
ylab |
see |
asp |
see |
add |
Logical. Whether data should be added to an existing plot. |
... |
Other arguments passed to |
Felipe M. Gawryszewski [email protected]
##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ## Grey background ## with 10 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(10, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ## Reflectance data ## with a sigmoid spectrum and midpoint at 500nm R1<-logistic(x=seq(300,700,1), x0=450, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R3<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1,R2[,2],R3[,2]) ## Run model model<-CTTKmodel(photo=3, R=R, I=D65, Rb=Rb, C=C) #Radarplot radarplot(model, border=c("violet", "red", "blue"), item="E", item.labels=TRUE)
##Photoreceptor sensitivity curves ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ## Grey background ## with 10 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(10, length(300:700))) ## Read CIE D65 standard illuminant data("D65") ## Reflectance data ## with a sigmoid spectrum and midpoint at 500nm R1<-logistic(x=seq(300,700,1), x0=450, L=50, k=0.04) R2<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R3<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R<-cbind(R1,R2[,2],R3[,2]) ## Run model model<-CTTKmodel(photo=3, R=R, I=D65, Rb=Rb, C=C) #Radarplot radarplot(model, border=c("violet", "red", "blue"), item="E", item.labels=TRUE)
Brazilian savannah background reflectance spectrum calculated by the average reflectance of leaf, leaf litter, tree bark and twigs.
data("Rb")
data("Rb")
A data frame with 401 observations on the following 2 variables.
X300.700
a numeric vector
cerrado
a numeric vector
Gawryszewski, F. M., and P. C. Motta. 2012. Colouration of the orb-web spider Gasteracantha cancriformis does not increase its foraging success. Ethol Ecol Evol 24:23-38.
Weber achromatic contrast for the Receptor noise limited model (Vorobyev & Osorio 1998; Vorobyev et al. 1998).
RNLachrom(R1, R2=Rb, Rb, I, C, e, interpolate = TRUE, nm = seq(300, 700, 1))
RNLachrom(R1, R2=Rb, Rb, I, C, e, interpolate = TRUE, nm = seq(300, 700, 1))
R1 |
Reflectance of observed objects. A data frame with first column corresponding to wavelength values and following columns with reflectance values. |
R2 |
Reflectance to be compared against R1. |
Rb |
Background reflectance. A data frame with two columns only: first column corresponding to wavelength values and second column with reflectance values. |
I |
Irradiance spectrum. A data frame with two columns only: first column corresponding to wavelength values and second column with irradiance values. Irradiance values must be in quantum flux units. |
C |
Photoreceptor sensitivity curves, from lowest to longest lambda-max. A data frame: first column corresponding to wavelength values and following columns with photoreceptor sensitivity values (see function |
e |
Noise of the photoreceptor. |
interpolate |
Whether data files should be interpolated before further calculations. See |
nm |
A sequence of numeric values specifying where interpolation is to take place. See |
The Weber achromatic contrast for a single photoreceptor is calculated by:
where and
are the relative photoreceptor quantum catches from stimulus 1 (
R1
) and stimulus 2 (R2
).
Noise may be dependent of the intensity, but this possibility is not implement in colourvision
yet. Noise dependent of intensity usually holds for low light conditions only (Vorobyev et al. 1998).
e1 |
Photoreceptor noise. |
Qr1_R1 |
Photoreceptor photon catch value from |
Qr1_R2 |
Photoreceptor photon catch value from |
E1_R1 |
Photoreceptor output from the stimulus ( |
E1_R2 |
Photoreceptor output from R2 |
deltaS |
Euclidean distance from R1 to R2. It represents the achromatic contrast of the stimulus ( |
Felipe M. Gawryszewski [email protected]
Vorobyev, M., and D. Osorio. 1998. Receptor noise as a determinant of colour thresholds. Proceedings of the Royal Society B 265:351-358.
Vorobyev, M., D. Osorio, A. T. D. Bennett, N. J. Marshall, and I. C. Cuthill. 1998. Tetrachromacy, oil droplets and bird plumage colours. J Comp Physiol A 183:621-633.
RNLmodel
, photor
, RNLthres
, CTTKmodel
, EMmodel
, GENmodel
#1 ## Photoreceptor sensitivity spectra ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350)) ##Grey background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant: data("D65") ##Reflectance data of R1 and R2 R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R2[,2]<-R2[,2]+10 plot(R1[,c(1,2)],type="l", ylim=c(0,60)) lines(R1[,c(1,3)]) lines(R2[,c(1,2)],col="red") lines(Rb,col="green") ## Run model RNLachrom(R1=R1, R2=R2, Rb=Rb, I=D65, C=C, e = 0.16)
#1 ## Photoreceptor sensitivity spectra ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350)) ##Grey background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant: data("D65") ##Reflectance data of R1 and R2 R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R2[,2]<-R2[,2]+10 plot(R1[,c(1,2)],type="l", ylim=c(0,60)) lines(R1[,c(1,3)]) lines(R2[,c(1,2)],col="red") lines(Rb,col="green") ## Run model RNLachrom(R1=R1, R2=R2, Rb=Rb, I=D65, C=C, e = 0.16)
Receptor noise limited colour vision models (Vorobyev & Osorio 1998; Vorobyev et al. 1998) extended to any number of photoreceptor types.
RNLmodel(model = c("linear", "log"), photo=ncol(C)-1, R1, R2=Rb, Rb, I, C, noise = FALSE, v=NA, n=NA, e=NA, interpolate = TRUE, nm = seq(300, 700, 1), coord="colourvision")
RNLmodel(model = c("linear", "log"), photo=ncol(C)-1, R1, R2=Rb, Rb, I, C, noise = FALSE, v=NA, n=NA, e=NA, interpolate = TRUE, nm = seq(300, 700, 1), coord="colourvision")
model |
Linear (
|
photo |
Number of photoreceptor types. Model accepts any number of photoreceptor types ( |
R1 |
Reflectance of observed objects. A data frame with first column corresponding to wavelength values and following columns with reflectance values. |
R2 |
Reflectance to be compared against R1. |
Rb |
Background reflectance. A data frame with two columns only: first column corresponding to wavelength values and second column with reflectance values. |
I |
Irradiance spectrum. A data frame with two columns only: first column corresponding to wavelength values and second column with irradiance values. Irradiance values must be in quantum flux units. |
C |
Photoreceptor sensitivity curves, from lowest to longest lambda-max. A data frame: first column corresponding to wavelength values and following columns with photoreceptor sensitivity values (see function |
noise |
Logical. Whether receptor noise is provided ( |
e |
Receptor noise of each photoreceptor type. Used when |
n |
Relative number of each photoreceptor type in the retina. Usually increases with lambda-max. Used to calculate |
v |
Noise-to-signal ratio of a single photoreceptor. Either a single value or a vector of same length as |
interpolate |
Whether data files should be interpolated before further calculations. See |
nm |
A sequence of numeric values specifying where interpolation is to take place. See |
coord |
Whether colour locous coordinates should be calculated by the method ( |
The receptor noise limited model was originally developed to calculate between two reflectance curves directly, without finding colour locus coordinates (e.g.
x,y
; Vorobyev and Osorio 1998). This function uses later formulae to find colour loci in a chromaticity diagram (similarly to Hempel de Ibarra et al. 2001; Renoult et al. 2015).
In lack of a direct measurement, receptor noise () can be estimated by the relative abundance of photoreceptor types in the retina, and a measurement of a single photoreceptor noise-to-signal ratio:
where is the noise-to-signal ratio of a single photoreceptor, and
is the relative abundance of photoreceptor i in the retina. Alternatively, noise may be dependent of the intensity, but this possibility is not implement in
colourvision
yet. Noise dependent of intensity usually holds for low light conditions only (Vorobyev et al. 1998).
ei |
Noise of photoreceptor channels. |
Qri_R1 |
Photoreceptor photon catch values from |
Qri_R2 |
Photoreceptor photon catch values from |
Ei_R1 |
Photoreceptor outputs from the stimulus ( |
Ei_R2 |
Photoreceptor outputs from R2 |
Xi_R1 |
Coordinates in the colour space for R1 |
Xi_R2 |
Coordinates in the colour space for R2. Equals zero when |
deltaS |
Euclidean distance from R1 to R2. It represents the conspicuousness of the stimulus ( |
Felipe M. Gawryszewski [email protected]
Gawryszewski, F.M. 2018. Colour vision models: Some simulations, a general n-dimensional model, and the colourvision R package. Ecology and Evolution, 10.1002/ece3.4288.
Hempel de Ibarra, N., M. Giurfa, and M. Vorobyev. 2001. Detection of coloured patterns by honeybees through chromatic and achromatic cues. J Comp Physiol A 187:215-224.
Renoult, J. P., A. Kelber, and H. M. Schaefer. 2017. Colour spaces in ecology and evolutionary biology. Biol Rev Camb Philos Soc, doi: 10.1111/brv.12230
Vorobyev, M., and D. Osorio. 1998. Receptor noise as a determinant of colour thresholds. Proceedings of the Royal Society B 265:351-358.
Vorobyev, M., D. Osorio, A. T. D. Bennett, N. J. Marshall, and I. C. Cuthill. 1998. Tetrachromacy, oil droplets and bird plumage colours. J Comp Physiol A 183:621-633.
RNLachrom
, photor
, RNLthres
, CTTKmodel
, EMmodel
, GENmodel
#1 ## Photoreceptor sensitivity spectra ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ##Grey background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant: data("D65") ##Reflectance data of R1 and R2 R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R2[,2]<-R2[,2]+10 ## Run model model<-RNLmodel(photo=3, model="log", R1=R1, R2=R2, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06, 0.12)) #plot plot(model) #2 #Pentachromatic animal ## Photoreceptor sensitivity spectra ##with lambda max at 350,400,450,500,and 550nm: C<-photor(lambda.max=c(350,400,450,500,550)) ##Grey background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant: data("D65") ##Reflectance data of R1 R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1[,2]<-R1[,2]+10 #RNL model RNLmodel(photo=5, model="log", R1=R1, R2=Rb, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06, 0.12, 0.07, 0.08)) #3 ## Photoreceptor sensitivity spectra ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ##Grey background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant: data("D65") ##Reflectance data of R1 and R2 R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R2[,2]<-R2[,2]+10 ## Run model model<-RNLmodel(photo=3, model="log", R1=R1, R2=R2, Rb=Rb, I=D65, C=C, noise=FALSE, v = c(NA, 0.06, NA), n = c(1,2,2))
#1 ## Photoreceptor sensitivity spectra ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ##Grey background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant: data("D65") ##Reflectance data of R1 and R2 R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R2[,2]<-R2[,2]+10 ## Run model model<-RNLmodel(photo=3, model="log", R1=R1, R2=R2, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06, 0.12)) #plot plot(model) #2 #Pentachromatic animal ## Photoreceptor sensitivity spectra ##with lambda max at 350,400,450,500,and 550nm: C<-photor(lambda.max=c(350,400,450,500,550)) ##Grey background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant: data("D65") ##Reflectance data of R1 R1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1[,2]<-R1[,2]+10 #RNL model RNLmodel(photo=5, model="log", R1=R1, R2=Rb, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06, 0.12, 0.07, 0.08)) #3 ## Photoreceptor sensitivity spectra ##with lambda max at 350nm, 450nm and 550nm: C<-photor(lambda.max=c(350,450,550)) ##Grey background ##with 7 percent reflectance from 300 to 700nm: Rb <- data.frame(300:700, rep(7, length(300:700))) ## Read CIE D65 standard illuminant: data("D65") ##Reflectance data of R1 and R2 R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) R2<-logistic(x=seq(300,700,1), x0=550, L=50, k=0.04) R2[,2]<-R2[,2]+10 ## Run model model<-RNLmodel(photo=3, model="log", R1=R1, R2=R2, Rb=Rb, I=D65, C=C, noise=FALSE, v = c(NA, 0.06, NA), n = c(1,2,2))
Plots receptor noise limited model (RNL) for trichromatic and dichromatic animals.
RNLplot(model, photo, item="R1", vectors=TRUE, vnames=TRUE, vsize="auto", xlab="x", ylab="y", xlim="auto", ylim="auto", asp=1, ...)
RNLplot(model, photo, item="R1", vectors=TRUE, vnames=TRUE, vsize="auto", xlab="x", ylab="y", xlim="auto", ylim="auto", asp=1, ...)
model |
Output of a colour vision model. |
photo |
Number of photoreceptor types. |
item |
Model output item to be plotted. Default plots stimulus data. See |
vectors |
Whether vectors representing direction of photoreceptor outputs should be plotted. |
vnames |
Whether vector names should be plotted. |
vsize |
Length of vectors to be plotted. Default calculates length automatically. |
xlab |
x-axis range. Default calculates range automatically. See |
ylab |
y-axis range. Default calculates range automatically. See |
xlim |
see |
ylim |
see |
asp |
see |
... |
Other arguments passed to |
Felipe M. Gawryszewski [email protected]
CTTKhexagon
, CTTKhexagon3D
, EMtriangle
, EMtetrahedron
, RNLplot3d
, plot.colourvision
, plot3d.colourvision
#dichromat C<-photor(lambda.max=c(450,550)) Rb <- data.frame(300:700, rep(7, length(300:700))) data("D65") R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) model<-RNLmodel(model="log", R1=R1, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06)) plot(model) #trichromat C<-photor(lambda.max=c(350,450,550)) Rb <- data.frame(300:700, rep(7, length(300:700))) data("D65") R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) model<-RNLmodel(model="log", R1=R1, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06, 0.12)) plot(model)
#dichromat C<-photor(lambda.max=c(450,550)) Rb <- data.frame(300:700, rep(7, length(300:700))) data("D65") R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) model<-RNLmodel(model="log", R1=R1, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06)) plot(model) #trichromat C<-photor(lambda.max=c(350,450,550)) Rb <- data.frame(300:700, rep(7, length(300:700))) data("D65") R1.1<-logistic(x=seq(300,700,1), x0=500, L=50, k=0.04) R1.2<-logistic(x=seq(300,700,1), x0=400, L=50, k=0.04) w<-R1.1[,1] R1.1<-R1.1[,2]+10 R1.2<-R1.2[,2]+10 R1<-data.frame(w=w, R1.1=R1.1, R1.2=R1.2) model<-RNLmodel(model="log", R1=R1, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06, 0.12)) plot(model)
Plots receptor noise limited model (RNL) for tetrachromatic animals.
RNLplot3d(model, item="R1", vectors=TRUE, vnames=TRUE, vsize="auto", xlab="x", ylab="y", zlab="z", xlim="auto", ylim="auto", zlim="auto", asp=1, ...)
RNLplot3d(model, item="R1", vectors=TRUE, vnames=TRUE, vsize="auto", xlab="x", ylab="y", zlab="z", xlim="auto", ylim="auto", zlim="auto", asp=1, ...)
model |
Output of a colour vision model. |
item |
Model output item to be plotted. Default plots stimulus data. See |
vectors |
Whether vectors representing direction of photoreceptor outputs should be plotted. |
vnames |
Whether vector names should be plotted. |
vsize |
Length of vectors to be plotted. Default calculates length automatically. |
xlab |
see par3d function in the rgl package. |
ylab |
see par3d function in the rgl package. |
zlab |
see par3d function in the rgl package. |
xlim |
x-axis range. Default calculates range automatically. See par3d function in the rgl package. |
ylim |
y-axis range. Default calculates range automatically. See par3d function in the rgl package. |
zlim |
z-axis range. Default calculates range automatically. See par3d function in the rgl package. |
asp |
see plot3d function in the rgl package. |
... |
Other arguments passed to function plot3d in the rgl package. |
Felipe M. Gawryszewski [email protected]
CTTKhexagon
, CTTKhexagon3D
, EMtriangle
, EMtetrahedron
, RNLplot
, plot.colourvision
, plot3d.colourvision
Colour thresholds based on receptor noise for any number of photoreceptor types (Vorobyev & Osorio 1998).
RNLthres(photo=ncol(C)-1, Rb, I, C, noise=TRUE, v=NA, n=NA, e=NA, interpolate=TRUE, nm=seq(300,700,1))
RNLthres(photo=ncol(C)-1, Rb, I, C, noise=TRUE, v=NA, n=NA, e=NA, interpolate=TRUE, nm=seq(300,700,1))
photo |
Number of photoreceptor types. Model accepts any number of photoreceptor types ( |
Rb |
Background reflectance. A data frame with two columns only: first column corresponding to wavelength values and second column with reflectance values. |
I |
Irradiance spectrum. A data frame with two columns only: first column corresponding to wavelength values and second column with irradiance values. Irradiance values must be in quantum flux units. |
C |
Photoreceptor sensitivity curves, from lowest to longest lambda-max. A data frame: first column corresponding to wavelength values and following columns with photoreceptor sensitivity values (see function |
noise |
Logical. Whether receptor noise is provided ( |
e |
Receptor noise of each photoreceptor type. Used when |
n |
Relative number of each photoreceptor type in the retina. Usually increases with lambda-max. Used to calculate |
v |
Noise-to-signal ratio of a single photoreceptor. Used to calculate |
interpolate |
Whether data files should be interpolated before further calculations. See |
nm |
A sequence of numeric values specifying where interpolation is to take place. See |
Colour thresholds based on receptor noise limited model as in Vorobyev and Osorio (1998). In lack of a direct measurement, receptor noise () can be estimated by the relative abundance of photoreceptor types in the retina, and a measurement of a single photoreceptor noise-to-signal ratio:
where is the noise-to-signal ratio of a single photoreceptor, and
is the relative abundance of photoreceptor i in the retina. Alternatively, noise may be dependent of the intensity, but this possibility is not implement in
colourvision
yet. Noise dependent of intensity usually holds for low light conditions only (Vorobyev et al. 1998).
A data.frame with the following columns:
nm |
Wavelength in nm. |
T |
Colour threshold value. |
S |
Log of sensitivity value (inverse of threshold). |
Felipe M. Gawryszewski [email protected]
Vorobyev, M., and D. Osorio. 1998. Receptor noise as a determinant of colour thresholds. Proceedings of the Royal Society B 265:351-358.
###Bee photoreceptors normalized to max=1. data("bee") C<-bee C[,2]<-C[,2]/max(C[,2]) C[,3]<-C[,3]/max(C[,3]) C[,4]<-C[,4]/max(C[,4]) ##Grey background: Rb <- data.frame(300:700, rep(0.1, length(300:700))) ## CIE D65 illuminant: data("D65") #Thresholds thres<-RNLthres(photo=3, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06, 0.12)) plot(thres)
###Bee photoreceptors normalized to max=1. data("bee") C<-bee C[,2]<-C[,2]/max(C[,2]) C[,3]<-C[,3]/max(C[,3]) C[,4]<-C[,4]/max(C[,4]) ##Grey background: Rb <- data.frame(300:700, rep(0.1, length(300:700))) ## CIE D65 illuminant: data("D65") #Thresholds thres<-RNLthres(photo=3, Rb=Rb, I=D65, C=C, noise=TRUE, e = c(0.13, 0.06, 0.12)) plot(thres)
Applies a smooth.spline
for data frame containing spectrometric data.
spec.denoise(specfiles, spar = 0.7, ...)
spec.denoise(specfiles, spar = 0.7, ...)
specfiles |
A data frame with first column representing wavelength values and following columns with reflectance data. |
spar |
see |
... |
Other arguments passed to function |
A data frame with first column representing wavelength values and following columns with reflectance data.
Felipe M. Gawryszewski [email protected]