binarize_fisheye {hemispheR} | R Documentation |
Compute the threshold of a single-channel fisheye image, and return a binary fisheye image of canopy (0) and gap (1) pixels
Description
The function calculates a single threshold of a single-channel raster image using the autothresholdr::auto_thresh()
functionality.
The single thresholding is also applied at sub-image level if zonal=TRUE.
The available methods are described at https://imagej.net/plugins/auto-threshold.
The thresholding value is then used to make a binary raster image of canopy (0) and gap (1) pixels.
Usage
binarize_fisheye(
img,
method = "Otsu",
zonal = FALSE,
manual = NULL,
display = FALSE,
export = FALSE
)
Arguments
img |
SpatRaster. A single layer fisheye image imported by |
method |
Character. The method used to threshold the image, using the |
zonal |
Logical. If is set to TRUE, it divides the images in four (N, W, S, E) regions and classify each region separately. Useful in case of uneven illumination condition in the image. |
manual |
Numeric. It uses a manual thresholding instead of automatic one. If selected, it overrides automatic thresholding. |
display |
Logical. If is set to TRUE, it plots the classified binary image. Default to FALSE. |
export |
Logical. If is set to TRUE, it saves the binary fisheye image as tif file. Default to FALSE. |
Value
A binary single-layer image (SpatRaster)
See Also
https://imagej.net/plugins/auto-threshold
Examples
c.im<-system.file('extdata/circular_coolpix4500+FC-E8_chestnut.jpg',package='hemispheR')
c.im |>
import_fisheye(circ.mask=camera_fisheye('Coolpix4500+FC-E8')) |>
binarize_fisheye(display=TRUE)
#zonal thresholding:
c.im |>
import_fisheye(circ.mask=camera_fisheye('Coolpix4500+FC-E8')) |>
binarize_fisheye(zonal=TRUE,display=TRUE)
#manual thresholding:
c.im |>
import_fisheye(circ.mask=camera_fisheye('Coolpix4500+FC-E8')) |>
binarize_fisheye(manual=55,display=TRUE)