View source: R/rem_nearby_points.R
rem_nearby_points | R Documentation |
Select a subset of points so that no retained pair is closer than min_dist
in planar or spherical space.
rem_nearby_points(
sky_points,
r = NULL,
z = NULL,
a = NULL,
min_dist = 3,
space = "planar",
use_window = TRUE
)
sky_points |
|
r |
single-layer terra::SpatRaster or |
z |
terra::SpatRaster generated with |
a |
terra::SpatRaster generated with |
min_dist |
numeric vector of length one. Minimum allowed distance
between retained points. Units: pixels for |
space |
character vector of length one. Coordinate system for distances:
|
use_window |
logical of length one. If |
When space = "planar"
, distances are computed in image coordinates and z
and a
are ignored. When space = "spherical"
, distances are angular (deg)
in hemispherical coordinates. If r
is provided, points are ranked by the
extracted raster values and retained in descending order.
A data.frame
with columns row
and col
for retained points.
It is assumed that sky_points
were extracted from an image with the same
dimensions as the r
, z
, and a
rasters. No checks are performed.
## Not run:
caim <- read_caim()
r <- caim$Blue
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
bin <- binarize_by_region(r, ring_segmentation(z, 30),
method = "thr_isodata")
bin <- bin & select_sky_region(z, 0, 80)
g <- sky_grid_segmentation(z, a, 10, first_ring_different = TRUE)
sky_points <- extract_sky_points(r, bin, g, dist_to_black = 3)
# planar
sky_points_p <- rem_nearby_points(sky_points, r, min_dist = 100,
space = "planar")
plot(r)
points(sky_points$col, nrow(caim) - sky_points$row, col = 2, pch = 10)
points(sky_points_p$col, nrow(caim) - sky_points_p$row, col = 3, pch = 0)
# spherical
sky_points_s <- rem_nearby_points(sky_points, r, z, a, min_dist = 30,
space = "spherical")
plot(r)
points(sky_points$col, nrow(caim) - sky_points$row, col = 2, pch = 10)
points(sky_points_s$col, nrow(caim) - sky_points_s$row, col = 3, pch = 0)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.