read_caim {rcaiman} | R Documentation |
Read a canopy image from a file
Description
Wrapper function for terra::rast()
.
Usage
read_caim(path = NULL, upper_left = NULL, width = NULL, height = NULL)
Arguments
path |
Character vector of length one. Path to an image, including file extension. The function will return a data example if no arguments are provided. |
upper_left |
An integer vector of length two. The pixels coordinates of the upper left corner of a region of interest (ROI). These coordinates should be in the raster coordinates system. This system works like a spreadsheet, i.e, when going down through the vertical axis, the row number increases (IMPORTANT: column and row must be provided instead of row and column, as is the norm for objects from the class data.frame and others alike) |
width , height |
An integer vector of length one. The size of the boxy ROI
whose upper left corner is the |
Details
Run read_caim()
to obtain an example of a hemispherical photo taken in
non-diffuse light conditions in a Nothofagus pumilio forest with a FC-E9
auxiliary lens attached to a Nikon Coolpix 5700.
Since this function aims to read born-digital color photographs, RGB-JPEG and
RGB-TIFF are the expected input. However, since this function is a wrapper
for terra::rast()
, format compatibility is heritages from it.
Use upper_left
, width
, and height
to read a particular region from the
file. Although any image editor can be used to obtain those parameters, this
function was tested with ‘ImageJ’, so it might
be wise to use it.
TIP: For obtaining upper_left
, width
, and
height
, open the image on the Fiji distro of ImageJ, draw a rectangular
selection, and go to Edit>Selection>Specify. The same workflow may work with
other distros.
Value
An object from class SpatRaster with its layers named Red, Green, and Blue when a born-digital color photographs is provided as input.
Note
The example image was obtained with this code:
zenith_colrow <- c(1290, 988) z <- zenith_image(745*2, lens("Nikon_FCE9")) a <- azimuth_image(z) r <- read_caim_raw("DSCN4606.NEF", z, a, zenith_colrow, radius = 300) z <- zenith_image(ncol(r), lens()) r <- correct_vignetting(r, z, c(0.0638, -0.101)) r <- c(mean(r$Y, r$M), r$G, r$C) r <- normalize(r, -1) write_caim(r*2^16-2, "example.tif", 16)
See Also
Other Tool Functions:
colorfulness()
,
correct_vignetting()
,
defuzzify()
,
extract_dn()
,
extract_feature()
,
extract_rl()
,
extract_sky_points_simple()
,
extract_sky_points()
,
extract_sun_coord()
,
find_sky_pixels_nonnull()
,
find_sky_pixels()
,
masking()
,
optim_normalize()
,
percentage_of_clipped_highlights()
,
read_bin()
,
read_caim_raw()
,
write_bin()
,
write_caim()
Examples
path <- system.file("external/DSCN4500.JPG", package = "rcaiman")
zenith_colrow <- c(1250, 1020)
diameter <- 745*2
caim <- read_caim(path, zenith_colrow - diameter/2, diameter, diameter)
plot(caim$Blue)