sor_filter | R Documentation |
Statistical outlier removal (SOR) filter
sor_filter(
sky_points,
r,
z,
a,
k = 20,
rmax = 20,
thr = 2,
cutoff_side = "both",
use_window = TRUE
)
sky_points |
The output of |
r |
SpatRaster. The image from which the argument |
z |
SpatRaster built with |
a |
SpatRaster built with |
k |
Numeric vector of length one. Number of k-nearest neighbors. |
rmax |
Numeric vector of length one. The maximum radius for searching
k-nearest neighbors (knn). Points are projected onto a unit-radius sphere,
similar to the use of relative radius in image mapping. The spherical
distance is then calculated and used to filter out points farther than
|
thr |
Numeric vector of length one. See \insertCiteLeys2013;textualrcaiman. |
cutoff_side |
Character vector of length one. See \insertCiteLeys2013;textualrcaiman. |
use_window |
Logical vector of length one. If |
This algorithm is based on the homonymous filter from the PCL library. Distances are computed on a spherical
surface and expressed in degrees to avoid distortions due to projection. The
number of neighbors used for evaluation is controlled by the k
argument, while
the rmax
argument sets the maximum search radius for finding these neighbors.
Points are projected onto a unit-radius sphere, similar to the use of relative
radius in image mapping. The spherical distance is then calculated, and points
farther than rmax are excluded from the neighbor set. If an insufficient
number of neighbors are found within rmax, the point is retained due to a
lack of evidence for removal. The decision criterion follows
\insertCiteLeys2013;textualrcaiman:
M - thr \times MAD < x_i < M + thr \times MAD
where x_i
is the value associated with a given sky point, M
and
MAD
are the median and median absolute deviation, respectively,
computed from the values associated with the neighbors of x_i
, and
thr
is the user-defined threshold.
The argument cutoff_side
controls which side of the inequality is
tested—either one side or both.
The argument sky_points
with fewer rows due to outlier removal.
Other Tool Functions:
calc_oor_index()
,
calc_spherical_distance()
,
colorfulness()
,
correct_vignetting()
,
defuzzify()
,
display_caim()
,
extract_dn()
,
extract_feature()
,
extract_rel_radiance()
,
extract_sky_points()
,
extract_sun_coord()
,
find_sky_pixels()
,
masking()
,
optim_dist_to_black()
,
optim_normalize()
,
percentage_of_clipped_highlights()
,
read_bin()
,
read_caim()
,
read_caim_raw()
,
read_ootb_sky_model()
,
vicinity_filter()
,
write_bin()
,
write_caim()
,
write_ootb_sky_model()
## Not run:
caim <- read_caim()
r <- caim$Blue
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
m <- !is.na(z)
bin <- regional_thresholding(r, rings_segmentation(z, 30),
method = "thr_isodata")
bin <- bin & select_sky_vault_region(z, 0, 80)
g <- sky_grid_segmentation(z, a, 5, first_ring_different = TRUE)
sky_points <- extract_sky_points(r, bin, g,
dist_to_black = 3)
plot(r)
points(sky_points$col, nrow(caim) - sky_points$row, col = 2, pch = 10)
sky_points <- sor_filter(sky_points, r, z, a, k = 10, rmax = 20, thr = 2,
cutoff_side = "left")
points(sky_points$col, nrow(caim) - sky_points$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.