aoiMaker {nnDiag}R Documentation

Create Random Areas of Interest (AOI) From a Larger Image

Description

The purpose of this function is to create Areas of Interest (AOI) from a larger image that include a minimum number of reference set elements. The object created can then be used in kNN diagnostic tests.

Usage

aoiMaker(ref.coords, num.aoi, image, mask = NULL, aoi.size = 1000, min.points = 25, seed = NULL, verbose = TRUE)

Arguments

ref.coords matrix of reference point coordinates
num.aoi a single integer, number of AOIs desired
image the image to make AOIs from, as an object of class GDALReadOnlyDataset
mask optional mask image, as an object of class GDALReadOnlyDataset
aoi.size a single integer, size of the AOI in pixels
min.points a single integer, minimum number of reference points in each AOI desired
seed a single value, interpreted as an integer
verbose logical indicating whether to display a progress bar

Details

The ref.coords must be a two column matrix with an X and Y location.

Both the image and mask have to be in the class "GDALReadOnlyDataset". This can be achieved by using the command GDAL.open from the package rgdal.

Each AOI created by this function is a square with the length of each side being the aoi.size in number of pixels. For example, if the desired AOI size was 300 meters on a side and the image had 30 meter pixels the aoi.size should be 100.

The minimum number of reference points within each AOI cannot be less than 10. An error will display if min.points is set less than that.

The seed option is available so identical AOIs can be made from different images. See set.seed for more information.

Value

Returns an object of class "nnDaoi", which is a list containing the following components:

AOI.spatial a list of the AOIs. Each element in the list is an object of class SpatialGridDataFrame
AOI.data a list of the pixel values contained in each AOI. Each element in the list is a matrix.
refPoint.index a list with the index of reference points contained in each AOI. Each element in the list is a vector.
ref.coordinates a matrix of the reference point coordinates

Note

Plotting an "nnDaoi" object will display the set of reference points and outlines of each AOI.

Author(s)

Brian Walters walte137@msu.edu

References

McRoberts, R.E. (2009) Diagnostic tools for nearest neighbors techniques when used with satellite imagery, Remote Sensing of Environment. 113, 489–499.

See Also

Functions that use "nnDaoi" objects: arealBias, extrap.

Examples

data(LuceVolume_subset)
LuceVolImg <- GDAL.open(system.file("data/LuceSubset_Volume.tif", package = "nnDiag"))
LuceTasscap <- GDAL.open(system.file("data/LuceSubset_Tcap.tif", package = "nnDiag"))
LuceMask <- GDAL.open(system.file("data/LuceSubset_Mask.tif", package = "nnDiag"))

coords <- as.matrix(LuceVolume_subset[,10:11])

vol.aoi <- aoiMaker(coords, 3, LuceVolImg, aoi.size = 20, min.points = 4, seed = 89)
plot(vol.aoi)

tcap.aoi <- aoiMaker(coords, 3, LuceTasscap, LuceMask, aoi.size = 20, min.points = 4, seed = 89)
plot(tcap.aoi)

[Package nnDiag version 0.0-5 Index]