polar_qtree: Do quad-tree segmentation in the polar space

View source: R/polar_qtree.R

polar_qtreeR Documentation

Do quad-tree segmentation in the polar space

Description

The quad-tree segmentation algorithm is a top-down process that makes recursive divisions in four equal parts until a condition is satisfied and stops locally. The usual implementation of the quad-tree algorithm is based on the raster structure and this is why the result are squares of different sizes. This method implements the quad-tree segmentation in a polar space, so the segments are shaped like windshields, though some of them will look elongated in height. The pattern is two opposite and converging straight sides and two opposite and parallel curvy sides.

Usage

polar_qtree(r, z, a, scale_parameter = 0.2)

Arguments

r

SpatRaster.

z

SpatRaster built with zenith_image().

a

SpatRaster built with azimuth_image().

scale_parameter

Numeric vector of length one. Quad-tree is a top-down method. This parameter controls the stopping condition. Therefore, it allows controlling the size of the resulting segments. Ultimately, segments sizes will depend on both this parameter and the heterogeneity of r.

Details

The algorithm splits segments of 30 degrees resolution into four sub-segments and calculates the standard deviation of the pixels from r delimited by each of those segments. The splitting process stops locally if the sum of the standard deviation of the sub-segments minus the standard deviation of the parent segment (named delta) is less or equal than the scale_parameter. If r has more than one layer, delta is calculated separately and delta mean is used to evaluate the stopping condition.

Value

A single layer image of the class SpatRaster with integer values.

See Also

Other Segmentation Functions: chessboard(), mask_hs(), mask_sunlit_canopy(), qtree(), rings_segmentation(), sectors_segmentation(), sky_grid_segmentation()

Examples

## Not run: 
caim <- read_caim() %>% normalize()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
seg <- polar_qtree(caim, z, a)
plot(seg)
plot(extract_feature(caim$Blue, seg))

## End(Not run)

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