read_data {deforestable} | R Documentation |
Import a jpeg image
Description
All these functions are made to read jpeg images, the difference is in the class of objects they return
Usage
read_data(filename, dir)
read_data_matrix(filename, dir)
read_data_raster(filename, dir)
Arguments
filename |
name of the jpeg file to import |
dir |
the directory where the image is located |
Value
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
.
Functions
-
read_data_matrix()
: returns three matrices -
read_data_raster()
: returns a SpatRaster object
Examples
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)
[Package deforestable version 3.1.1 Index]