[R] how to read individual values from a pixmap object

From: Tony Gill <t.gill1_at_uq.edu.au>
Date: Thu 04 Aug 2005 - 18:02:55 EST


Hi All,  

I have a greyscale image that I am reading in through RGDAL and placing in a pixmap object.  

As an example use the logo.jpg file that comes with the RGDAL package:  

#Read the file

logo <- system.file("pictures/logo.jpg", package="rgdal")[1] x <- new("GDALReadOnlyDataset", logo)  

#Create the pixmap object

xGrey <- getPixmapGDAL(x)  

Now I would like to read individual pixel values and store them in a separate vector. However I have not found a straight-forward way to do this.  

I thought that something like:  

x <- xGrey[1,1]  

would return the pixel value, but it seems to return a pixmap object with dimension 1x1 (i.e. only one pixel in size)  

xGrey[1,1]
Pixmap image

  Type          : pixmapGrey 
  Size          : 1x1 
  Resolution    : 1x1 
  Bounding box  : 1 0 2 1
 

Any ideas on how to get the actual pixel value from a pixmap? (Note I could output to an ascii file and then read the file back in as text - but not nice!)  

Thanks in advance  

Tony  



Tony Gill - PhD Candidate
Centre for Remote Sensing & Spatial Information Science School of Geography, Planning & Architecture University of Queensland
Brisbane, Queensland, AUSTRALIA, 4072
Ph: 61-7-3365-7027
email: t.gill1@uq.edu.au

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Aug 04 18:07:28 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:40 EST