Learn R Programming

rcaiman (version 2.0.1)

lens: Access the lens database

Description

Retrieve projection coefficients and field-of-view (FOV, deg) for known lenses. Coefficients expect zenith angle in radians and return relative radius.

Usage

lens(type = "equidistant", return = "coef")

Value

Numeric vector. Depends on return:

"coef"

Polynomial coefficients of the projection function (relative radius as a function of theta, radians).

"fov"

numeric vector of length one. Maximum field of view (deg).

Arguments

type

Character vector of length one. Lens identifier. See Details.

return

Character vector of length one. Either "coef"(default) or "fov". Controls whether to return projection coefficients or maximum FOV.

Details

In upward-looking leveled hemispherical photography, the zenith corresponds to the center of a circular image whose perimeter represents the horizon, assuming a lens with a 180° field of view. The relative radius is the radial distance to a given point, expressed as a fraction of the maximum radius (i.e., the horizon). The equidistant projection model, also called polar projection, is the standard reference model, characterized by a linear relationship between zenith angle and relative radius.

Real lenses deviate from ideal projections. Following Hemisfer software, this package models deviations with polynomial functions. All angular values are in radians.

Currently available lenses:

"equidistant"

Ideal equidistant projection Schneider2009rcaiman.

"Nikkor_10.5mm"

AF DX Fisheye Nikkor 10.5mm f/2.8G ED Pekin2009rcaiman.

"Nikon_FCE9"

Nikon FC-E9 converter Diaz2024rcaiman.

"Olloclip"

Auxiliary lens for mobile devices manufactured by Olloclip Diaz2024rcaiman.

"Nikkor_8mm"

AF–S Fisheye Nikkor 8–15mm f/3.5–4.5E ED Diaz2024rcaiman.

See calibrate_lens() for fitting new projection functions.

References

Examples

Run this code
lens("Nikon_FCE9")
lens("Nikon_FCE9", return = "fov")

.fp <- function(theta, lens_coef) {
  x <- lens_coef[1:5]
  x[is.na(x)] <- 0
  for (i in 1:5) assign(letters[i], x[i])
  a * theta + b * theta^2 + c * theta^3 + d * theta^4 + e * theta^5
}

theta <- seq(0, pi/2, pi/180)
plot(theta, .fp(theta, lens()), type = "l", lty = 2,
      ylab = "relative radius")
lines(theta, .fp(theta, lens("Nikon_FCE9")))

Run the code above in your browser using DataLab