lens: Access the lens database

View source: R/lens.R

lensR Documentation

Access the lens database

Description

Database of lens projection functions and field of views.

Usage

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

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 \insertCiteFrazer2001rcaiman. 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 \insertCiteSchneider2009rcaiman.

  • Nikkor_10.5mm: AF DX Fisheye Nikkor 10.5mm f/2.8G ED \insertCitePekin2009rcaiman

  • Nikon_FCE9: Nikon FC-E9 converter \insertCiteDiaz2024rcaiman

  • Olloclip: Auxiliary lens for mobile devices made by Olloclip \insertCiteDiaz2024rcaiman

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

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.

References

\insertAllCited

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

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")))


rcaiman documentation built on Nov. 15, 2023, 1:08 a.m.