read_data {deforestable} | R Documentation |
All these functions are made to read jpeg images, the difference is in the objects they return
read_data(filename, dir)
read_data_matrix(filename, dir)
read_data_raster(filename, dir)
filename |
name of the jpeg file to import |
dir |
the directory where the image is located |
read_data returns a 3-column data.frame with pixels in rows and
red, green, blue intensities in columns. read_data_matrix reads jpeg images and returns 3 matrices for
each of red, green and blue colors. read_data_raster imports jpeg as a raster object
rast
.
read_data_matrix
: returns three matrices
read_data_raster
: returns a SpatRaster object
dir <- system.file('extdata/Forest/', package = "deforestable")
dd <- read_data(filename='_6_33_.jpeg', dir=dir)
hist(dd[,1])
dir <- system.file('extdata/Forest/', package = "deforestable")
dd <- read_data_matrix(filename='_6_33_.jpeg', dir=dir)
dir <- system.file('extdata/Forest/', package = "deforestable")
dd<-read_data_raster(filename='_8_46_.jpeg', dir=dir)