Description Usage Arguments Details Value Methods (by class) References See Also Examples
This algorithm uses the color perceptual attributes to enhance the contrast between the sky and plants through fuzzy classification. Color has three different perceptual attributes: hue, lightness, and chroma. The algorithm was developed using the following premise: the color of the sky is different from the color of plants. It performs the next classification rules, here expressed in natural language: clear sky is blue and clouds decrease its chroma; if clouds are highly dense, then the sky is achromatic, and, in such cases, it can be light or dark; everything that does not match this description is not sky. These linguistic rules were translated to math language by means of fuzzy logic.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | enhanceHP(x, ...)
enhanceHemiPhoto(x, ...)
## S4 method for signature 'matrix'
enhanceHP(
x,
thr = NULL,
fuzziness = NULL,
wR = 0.5,
wB = 1.5,
skyBlue = colorspace::sRGB(matrix(normalize(c(135, 206, 235), 0, 255), ncol = 3)),
...
)
## S4 method for signature 'CanopyPhoto'
enhanceHP(
x,
mask = NULL,
wR = 0.5,
wB = 1.5,
sharpen = FALSE,
skyBlue = colorspace::sRGB(matrix(normalize(c(135, 206, 235), 0, 255), ncol = 3)),
...
)
|
x |
|
... |
Additional arguments as for |
thr |
numeric. By default, the algorithm will try to estimate it. |
fuzziness |
numeric. By default, the algorithm will try to estimate it. |
wR |
numeric. Weight of red layer. See details. |
wB |
numeric. Weight of blue layer. See details. |
skyBlue |
color. See details. |
mask |
|
sharpen |
logical. The default is TRUE, see details. |
This is a pixelwise algorithm that evaluates if pixels are sky blue
colored. High score means high membership to Sky Blue. When a pixel are
achromatic, then it uses pixel brightness. The algorithm internally uses
membership2color
and fuzzyLightness
. The
argument skyBlue is the targetColor
of the former function, which
output is the argument m
of the latter function. To evaluate the
brightness of an achromatic pixel, the algorithm uses Relative
Brightness (see references).
Argument mask
can be used to affect the estimation of two arguments
of fuzzyLightness
. Affected arguments are thr
and
fuzziness
. The function autoThr
is used to estimate
thr
. To compute fuzziness
, the algorithm takes the maximum
and the minimum values of the Relative Brightness and calculate its mean.
If sharpen is set as TRUE
, a sharpen filter is applied to
the raster with the membership values. This kernel is used:
matrix(c(rep(-1, 3), -1, 12, -1, rep(-1, 3)), ncol = 3)
.
numeric or RasterLayer.
matrix
: The output is a numeric vector.
CanopyPhoto
: The output is a RasterLayer.
Diaz, G.M., Lencinas, J.D., 2015. Enhanced Gap Fraction Extraction From Hemispherical Photography. IEEE Geosci. Remote Sens. Lett. 12, 1784-1789.
membership2color
, fuzzyLightness
.
1 2 3 4 5 6 7 8 9 10 11 | # for circular hemispherical photos
x <- loadPhoto()
x <- normalize(x, 0, 255)
xe <- enhanceHP(x)
plot(xe)
z <- makeZimage(ncol(x), lensPolyCoef(c(0.6427, 0.0346, -0.024491)))
m <- doMask(z, zlim = asAngle(c(30,60)), alim = asAngle(c(0, 45)))
# mask affects the result but does not crop it (see Details).
plot(enhanceHP(x, mask = m))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.