[R] readGDAL or raster for reading bit map files
mdsumner at gmail.com
Thu Nov 24 14:25:31 CET 2011
m <- as.matrix(store)
m <- as.image.SpatialGridDataFrame(store)$z
They give the same result with different orientations. Note that both
assume a single-band raster, e.g. you only have a "greyscale" bitmap
The details behind all this is given in the documentation for the sp
package. See ?image for the basic image plot for a matrix.
On Thu, Nov 24, 2011 at 11:50 PM, Alaios <alaios at yahoo.com> wrote:
> Dear all,
> I have asked yesterday of how I can read a simple bitmap file in R cran.
> I was suggest to use either readGDAL or raster for loading my bitmap
> a. I have done it with readGDAL like
> and it works,... but it converts my matrix-like notion of a bitmap to a large vector
> b. Raster also returns a class that I can not understand.
> So 1, I want to load it and keep the image as a matrix (so every cell in the matrix will correspond to a pixel)
> 2. I want to be able to plot the image based on that matrix that I have loaded too.
> Could you please explain me how I can do those?
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Institute for Marine and Antarctic Studies, University of Tasmania
e-mail: mdsumner at gmail.com
More information about the R-help