RGB2PCT: Convert RGB three band to single band colour table

Description Usage Arguments Value Author(s) References Examples

View source: R/gdal.R

Description

This function converts a three-band GDALReadOnlyDataset into a single band of colour indices as a GDALTransientDataset.

Usage

1
RGB2PCT(x, band, driver.name = 'MEM', ncolors = 256, set.ctab = TRUE)

Arguments

x

a three-band GDALReadOnlyDataset object

band

a vector of numbers, recycled up to 3 in length

driver.name

default MEM

ncolors

a number of colours between 2 and 256

set.ctab

default TRUE, when the dithered dataset handle is returned, otherwise a list of the dataset and the PCT colour table

Value

The value returned is a either GDALTransientDataset or a list of a GDALTransientDataset and a colour table.

Author(s)

Tim Keitt

References

http://www.gdal.org/

Examples

1
2
3
4
5
6
7
8
logo <- system.file("pictures/Rlogo.jpg", package="rgdal")[1]
x <- GDAL.open(logo)
dim(x)
dx <- RGB2PCT(x, band=1:3)
displayDataset(dx)
dim(dx)
GDAL.close(x)
GDAL.close(dx)

Example output

Loading required package: sp
rgdal: version: 1.2-7, (SVN revision 660)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
 Path to GDAL shared files: /usr/share/gdal/1.10
 Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
 Path to PROJ.4 shared files: (autodetected)
WARNING: no proj_defs.dat in PROJ.4 shared files
 Linking to sp version: 1.2-3 
[1] 175 200   3
[1] 175 200

rgdal documentation built on Nov. 22, 2017, 1:03 a.m.