Extract a numerical skyline from a transparent-sky panorama and attach the calibrated photograph.
importPanorama(
file,
loc,
az.lim = c(0, 360),
alt.lim = c(-90, 90),
name = tools::file_path_sans_ext(basename(file)),
calibrate = FALSE,
points = NULL,
alpha.threshold = 0.5,
alt.unc = 0.5
)
file |
PNG with sky removed to transparency. Keep this file alongside saved horizon objects. |
loc |
WGS84 latitude, longitude and optional elevation in metres. |
az.lim |
True bearings of the left and right edges, increasing clockwise. A sector may cross north, e.g. c(330,30). |
alt.lim |
Altitudes of the bottom and top edges in degrees. Set these explicitly for a cropped panorama. |
name |
Site name. |
calibrate |
Open the interactive graphics picker. Choose Zoom and click two corners to enlarge a region. Add a control by clicking a landmark and entering its true azimuth, altitude or both. Finish to apply the fit. |
points |
Optional data frame with numeric x, y, az and alt. Pixel coordinates start at the upper-left image edge. Use NA for an unknown angle. |
alpha.threshold |
Minimum opacity counted as terrain, from above zero to one. |
alt.unc |
Assumed skyline altitude uncertainty in degrees. |
Choose controls according to what you know:
If the image limits are already calibrated, leave calibrate = FALSE and omit points.
To rotate an already level panorama to true north, click one landmark, enter its true azimuth, leave altitude blank and choose Finish. This changes only the azimuth origin.
One altitude alone shifts the altitude origin. One landmark with both coordinates shifts both origins. Neither case estimates tilt.
Two altitude controls at different bearings can raise one side and lower the other. For tilt around a full turn, use at least three well-spaced bearings. These fits retain the supplied vertical scale. Two altitude controls at the same bearing but different pixel heights can instead calibrate vertical scale.
Multiple known azimuths at distinct horizontal positions can calibrate the horizontal scale of a partial panorama. A full turn keeps its 360-degree span.
The picker samples the overview. Choose Zoom and click two corners to display the selected region at native pixel detail, then choose Add control point. Full-turn plots cut the calibrated view at north. In scripted controls use NA_real_ for each unknown angle. Levelling adjusts the near-horizon band. If an altitude shift takes image rows beyond the poles, only whole rows within the physical altitude range are kept. A one-point adjustment records the calibrated bounds and uses the original PNG. Keep it with the saved object. A tilt adjustment writes a levelled PNG in the working directory. Use a panorama with nominally linear angular axes and transparent sky above terrain in every column. A partial panorama supports altitude lookup within its photographed sector. Stellarium export requires a full turn.
A skyscapeR.horizon object with a numerical profile, external PNG reference, angular bounds and control points. Use saveRDS() to save the object. Copy the displayed panorama PNG with the RDS and use relinkHor to reconnect a moved horizon or list.
H07 verified lookup inside the photographed sector, including across north. Seasonal and event searches requiring a complete skyline reject partial photographs. See the H07 check in the technical manual.
Sky detection uses the PNG alpha channel. In each image column the first pixel
whose opacity reaches alpha.threshold defines the terrain edge. The
function does not segment an ordinary opaque photograph by sky colour. Remove
the sky to transparency beforehand and retain sky above terrain in every column.
Trees, buildings and mask errors become part of the extracted skyline.
Calibration uses linear angular axes, origin shifts and, where supported by
the controls, fitted scale or sinusoidal near-horizon tilt corrections.
This is not a general camera/lens model or a full spherical photogrammetric
adjustment. Wide-angle distortion, stitched-image parallax and inaccurate
control measurements are not removed automatically. The supplied
alt.unc is an assumed error, not an uncertainty estimated from the fit.
Inspect independent field controls after calibration.
A partial panorama only supplies the photographed sector; it is unsuitable for
functions requiring a closed full horizon. Supplying only latitude and longitude
leaves observer elevation unknown. Add a finite measured elevation before
using functions, such as sketchSky, that require it.
H05 examines bearing and altitude errors at withheld synthetic landmarks. H05 scientific validation.
At eight withheld landmarks in a tilted synthetic panorama, both bearing and skyline altitude were recovered to within one image pixel. H05 study.
A partial photographic horizon returned missing altitudes outside its sector. Full-sky event searches rejected it and accepted the complete profile. H07 study.
hor2alt, exportPanorama
## Not run:
# Known bearing at pixel (1240, 380) in a level, cropped panorama
anchor <- data.frame(x = 1240, y = 380, az = 96.4, alt = NA_real_)
h <- importPanorama("ridge.png", c(51.75, -9.37, 150),
az.lim = c(70, 120), alt.lim = c(-5, 12), points = anchor)
plot(h, show.skyline = TRUE)
## End(Not run)