Dear listers,
I have a collection of tif images that I would like to convert, in R, to a
matrix containing the values of the 8bit colour. Ideally, I would like a matrix
for each of the colour channels (red, blue and green). I have 'googled' and
searched the help list but have yet to find a
This requires the rgdal and sp packages to be installed, and assumes a
3-bandfile called image.tif
## (untested)
library(rgdal)
x - readGDAL(image.tif)
## first band
red - as.image.SpatialGridDataFrame(x[1])$z
## second
green - as.image.SpatialGridDataFrame(x[2])$z
## third
blue -
: Tuesday, October 19, 2010 6:00 AM
To: r-help@r-project.org
Subject: [R] Tif image to 8bit colour matrix.
Dear listers,
I have a collection of tif images that I would like to convert, in R,
to a
matrix containing the values of the 8bit colour. Ideally, I would like
a matrix
for each
3 matches
Mail list logo