uavRst (version 0.5-2)

get_counts: counts pixel values according to their classes

Description

counts pixel values according to their classes

Usage

get_counts(ids = c(1, 2), position = NULL, imageFiles = NULL,
  buffersize = 1.5, outPrefix = "classified_index_", ext = ".tif",
  path = tempdir(), dropChars = 0)

Arguments

ids

numeric. the ids used for the training

position

sp. spatialpoint object containing the centre target positions

imageFiles

raster* image/classification file

buffersize

numeric. radius in meters around position

outPrefix

character. out prefix string

ext

character. extension

path

character. output path

dropChars

numeric. number of characters that should be dropped at the end of the filename

Examples

Run this code
# NOT RUN {
##- required packages
 require(uavRst)

##- project root folder
 setwd(tempdir())


##- get the rgb image, chm and training data
 utils::download.file("https://github.com/gisma/gismaData/raw/master/uavRst/data/tutorial.zip",
                      "tutorial_data.zip")
 unzip(zipfile = "tutorial_data.zip" ,
         exdir = ".")

# read data
 position <- raster::shapefile("position.shp")
 imageFiles <-Sys.glob(paths = paste0("rgb*","tif"))
 imageTrainStack<-lapply(imageFiles, FUN=raster::stack)

## get counts
 df1<-get_counts(position = position,
                      ids = c(100,200),
               imageFiles = imageFiles,
                outPrefix = "",
                      ext = ".tif",
                     path = tempdir())
head(df1)
##+
# }

Run the code above in your browser using DataLab