doPolarQtree: Quad-tree segmentation in a polar space.

Description Usage Arguments Details Value References See Also Examples

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 then 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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
doPolarQtree(
  x,
  z,
  a = makeAimage(z),
  scaleParameter,
  divisions = 1,
  mnSize = 1000,
  parallel = FALSE,
  freeThreads = 2
)

## S4 method for signature 'Raster'
doPolarQtree(
  x,
  z,
  a = makeAimage(z),
  scaleParameter,
  divisions = 1,
  mnSize = 1000,
  parallel = FALSE,
  freeThreads = 2
)

Arguments

x

Raster. The raster to be processed. Single or multi-layer.

z

ZenithImage. Should match the lens geometry of the picture linked with x.

a

AzimuthImage.

scaleParameter

one-length numeric. It is part of the stopping condition (see Detalis).

divisions

numeric. See details

mnSize

numeric. This is an additional stopping criterion to avoid errors in segments closed to zenith.

parallel

logical. Go parallel.

freeThreads

numeric. The number of threads that remain free for other tasks. Defaul 2 avoid the computer comes to a standstill until the R task has finished. Using 1 could be a good idea. Use 0 at your own risk. If you run out of memory, increase freeThreads.

memoryUseFactor

numeric. Increase to use less memory when parallel is set to TRUE.

Details

Argument division could be 1, 2, 3 or 4 and it controls segment resolution.

value / resolution (degrees)

1 / 30, 15, 7.5, 3.75 or 1.875.

2 / 15, 7.5, 3.75 or 1.875.

3 / 15, 7.5 or 3.75.

4 / 7.5 or 3.75.

The algorithm starts with segments of a given resolution depending on divisions. Next, it selects one segment and splits it into four segments of equal angular resolution. Then, it uses the standard deviation of x as homogeneous criterion. To that end, it calculates the standard deviation for the entire segment and for each four segments. To stop the process locally, the algorithm evaluates if the sum of the standard deviation of the subsegments minus the standard deviation of the segment (delta) is less or equal than the scaleParameter. If x is multilayer delta is calculated separately and delta mean is used to evaluate the stopping condition.

Value

PolarSegmentation.

References

Diaz, G.M., Lencinas, J.D., 2015. Enhanced Gap Fraction Extraction From Hemispherical Photography. IEEE Geosci. Remote Sens. Lett. 12, 1784-1789.

See Also

makeZimage, makeAimage.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
x <- loadPhoto()
z <- makeZimage(ncol(x), lensPolyCoef(c(0.6427, 0.0346, -0.024491)))
a <- makeAimage(z)
x <- normalize(x, 0, 255)

seg <- doPolarQtree(x, z, a, scaleParameter = 0.1, parallel = TRUE)
seg
plot(seg)

# Next lines open a result obtained using scaleParameter = 0.1, which takes
# too long for an example.
seg <- raster(system.file("external/seg.tif", package="caiman"))
seg <- as(seg, "PolarSegmentation")
plot(seg)

GastonMauroDiaz/caiman documentation built on Jan. 22, 2022, 4:43 a.m.