If you import the bands/images as integers [0-255], then you can visualize
them using e.g.:

library(colorspace)
library(rgdal)

vismaps = readGDAL("band_R.tif")
vismaps$red = vismaps$band1
vismaps$green = readGDAL("band_G.tif")$band1
vismaps$blue = readGDAL("band_B.tif")$band1

# Display as a RGB image:

RGBimg = SGDF2PCT(vismaps[c("red", "green", "blue")], ncolors=256,
adjust.bands=FALSE)

vismaps$idx <- RGBimg$idx
image(vismaps, "idx", col=RGBimg$ct)

see also http://spatial-analyst.net/VMM/R_whitening.zip


> On Mon, 25 Feb 2008, PUJAN RAJ REGMI wrote:
>
>> Dear Madam/ Sir I am New user of R. I am looking for the way to plot
>> true color image from matrix data of of order (m,n,3) as in MAT LAB
>> where 3 represent the three column matrix where red, green and blue
>> values of pixels are stored. I hope you understand my question. Looking
>> for your help for the same. Thanking you in advance Yours,
>
> Please look at the help page and example for RGB2PCT() in the rgdal
> package. That should get you most of the way, using other functions in the
> package if need be to convert your input matrix to a three-band
> GDALReadOnlyDataset.
>
> Hope this helps,
>
> Roger
>
>>
>> Pujan Raj Regmi.Abroad Address: Studentenwijk Arenberg 22/408, 3001
>> Heverlee, Belgium.
>> Cell Number: 0032-0486-530-340
>> Home Address: Prabachan Marg-182/15, Baneshwor, Kathmandu, Nepal.
>> Home Telephone Number: +977-1-4470900Alternative e-mail:
>> [EMAIL PROTECTED]
>>
>>                                    [EMAIL PROTECTED]
>>
>> _________________________________________________________________
>> Helping your favorite cause is as easy as instant messaging. You IM, we
>> give.
>>
>>      [[alternative HTML version deleted]]
>>
>>
>
> --
> Roger Bivand
> Economic Geography Section, Department of Economics, Norwegian School of
> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: [EMAIL PROTECTED]
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to