Learn R Programming

rcaiman (version 1.2.2)

lens: Access the lens database

Description

Database of lens projection functions and field of views.

Usage

lens(type = "equidistant", max_fov = FALSE)

Value

If max_fov is set to TRUE, it returns a numeric vector of length one, which is the lens maximum field of view in degrees. Otherwise, it returns a numeric vector with the coefficients of the lens function.

Arguments

type

Character vector of length one. The name of the lens.

max_fov

Logical vector of length one. Use TRUE to return the maximum field of view in degrees.

Details

In upward-looking leveled hemispherical photography, the zenith is the center of a circle whose perimeter is the horizon. This is true only if the lens field of view is 180º. The relative radius is the radius of concentric circles expressed as a fraction of the radius that belongs to the circle that has the horizon as perimeter. The equidistant model, also called polar, is the most widely used as a standard reference. Real lenses can approximate the projection models, but they always have some kind of distortion. In the equidistant model, the relation between zenith angle and relative radius is modeled with a straight line. Following Hemisfer software, this package uses a polynomial curve to model lens distortion. A third-order polynomial is sufficient in most cases Frazer2001rcaiman. Equations should be fitted with angles in radians.

Eventually, this will be a large database, but only the following lenses are available at the moment:

  • equidistant: standard 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 made by Olloclip Diaz2024rcaiman

  • Nikkor_8mm: AF–S Fisheye Nikkor 8–15mm f/3.5–4.5E ED Diaz2024rcaiman

References

See Also

Other Lens Functions: azimuth_image(), calc_diameter(), calc_relative_radius(), calc_zenith_colrow(), calibrate_lens(), crosscalibrate_lens(), expand_noncircular(), extract_radiometry(), fisheye_to_equidistant(), fisheye_to_pano(), test_lens_coef(), zenith_image()

Examples

Run this code
lens("Nikon_FCE9")
lens("Nikon_FCE9", max_fov = TRUE)

.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