Learn R Programming

fasteraster (version 1.1.1)

raster2vector: Converts raster image matrix into list of polygons.

Description

Takes a raster matrix and vectorize it by polygons. Typically the nature of artefact images is linear and can be vectorized in much more efficient way than draw a series of 90 degrees lines.

Usage

raster2vector(raster, from = 0, to = 1, step = 0.1, precision = 1L,
  exclave = TRUE)

Arguments

raster
input matrix of numeric values.
from
lower (greater than) margin for recognizable polygon values.
to
upper (less than or equal) margin.
step
values gradient.
precision
linearization precision in matrix cells.
exclave
polygons may have other inside.

Value

list of integer matrixes that represent polygon coordinates in two columns.

Examples

Run this code
library(datasets)
raster2vector(volcano, 100, 200, 60, 1, FALSE)
raster2vector(volcano, 120, 200, 20)

Run the code above in your browser using DataLab