View source: R/zenith_azimuth_from_row_col.R
zenith_azimuth_from_row_col | R Documentation |
Bidirectional helpers to convert between angular coordinates on the
hemispherical image (zenith
, azimuth
) and raster
coordinates (row
, col
).
zenith_azimuth_from_row_col(z, a, row, col)
row_col_from_zenith_azimuth(z, a, zenith, azimuth)
z |
terra::SpatRaster generated with |
a |
terra::SpatRaster generated with |
row , col |
numeric vectors. raster coodinates. Must have equal length. |
zenith , azimuth |
numeric vectors. Angles in degrees. Must have equal length. |
zenith, azimuth
→ row, col
.
A sparse set of valid sky points is sampled over the image and enriched with
their angular coordinates. Two local least-squares surfaces
(spatial::surf.ls
, np = 6
) are fitted to predict row
and col
as
smooth functions of (azimuth
, zenith
). Predictions are rounded to the
nearest integer index. Out-of-bounds indices are not produced under normal
conditions; clamp externally if needed.
row, col
→ zenith, azimuth
.
Angles are obtained by direct lookup on z
and a
using
terra::cellFromRowCol
. If any queried cell is NA
(e.g., outside the
calibrated lens footprint), a synthetic z
is reconstructed from the lens
model attached to z
(attribute lens_coef
), and a
is rebuilt with
azimuth_image()
using the stored orientation attribute in a
. This yields
robust angle retrieval near borders.
See Functions
row_col_from_zenith_azimuth
Return image indices for given angles.
zenith_azimuth_from_row_col
Return angles in degrees for given image indices.
z <- zenith_image(1000, lens())
a <- azimuth_image(z)
rc <- row_col_from_zenith_azimuth(z, a, zenith = c(30, 60), azimuth = c(90, 270))
rc
ang <- zenith_azimuth_from_row_col(z, a, row = rc$row, col = rc$col)
ang
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.