The image (for the moment) is rather small, as it is a sample of 512x512
pixels. I have to compare the effect of a segmentation method over raw
data for various unsupervised techniques.
My idea was to do the classification in R, because it handles many more
methods then GIS/RS software I have available.
I will investigate some of the points raised and in case I will come
back with more clear ideas and questions.
Thank you very much to everybody for the support.
Laura
2008/6/12 Agustin Lobo <Agustin.Lobo at ija.csic.es
<mailto:Agustin.Lobo at ija.csic.es>>:
If your images are large (and images typically are large because
pixel size
has to be small compared to the extent of the image for the image to
be of acceptable quality for our vision system), I do not advice you
to get them into R for processing as R has severe memory limits
and many classification techniques are not precisely memory-efficient
(but see clara() in package cluster, actually read
http://cran.r-project.org/web/views/Cluster.html).
I think that you should sample your image in a RS/GIS environment
making sure you cover all
the radiometric space and import only a table pixels x bands into R,
the actual nb. of pixels depending on your HW/SW configuration (but
10000 would be a good start). Then use the numerous R classification
tools to define the centroids and once you have them use again your
RS/GIS program to actually assign each pixel in the image to a
centroid according to a given rule (i.e. maximum likelihood). There
might be
ways of writing an efficient assignation step within R itself also,
I think that mclust package does it.
Another way of reducing the number of individuals to classify is
performing a segmentation of the image first and then classify segments
instead of pixels (i.e.
# Lobo, A. 1997. Image segmentation and discriminant analysis for
the identification of land cover units in Ecology. IEEE Transactions
on Geoscience and Remote Sensing, 35(5): 1- 11.
http://wija.ija.csic.es/gt/obster/ABSTRACTS/alobo_ieee97.pdf
perhaps other articles in
http://wija.ija.csic.es/gt/obster/alobo_publis.html
might be of help)
In any case, note that img in your code should be converted into
a multivariate table pixels x bands for most classification
functions in R to work. Note that this fact makes obvious
that classification approaches to image processing do not make
use of the spatial information of the image, which is actually
a fundamental part of the information of any image.
Agus
Laura Poggio escribi?:
Dear list,
I am trying to do some clustering on images. And I have two main
problems:
1) Clustering multiband images.
I managed to be successful with a single band image, but when
trying to
apply to a 3 band I get the following warning message:
In as.matrix.SpatialGridDataFrame(x) :
as.matrix.SpatialPixelsDataFrame uses first column;
pass subset or [] for other columns
2) saving clustering results as grid or image.
I get a vector of clusters, but without both coordinates. How it
is possible
to transform it in a grid?
Here the code I use to read the image itself and to do the
clustering:
library(rgdal)
fld <- system.file("E:/data/IMG/fr/", package="rgdal")
img <- readGDAL("123_rawR.tif")
kl <- kmeans(img, 5)
I am quite new to image processing, especially within R, and any
help is
greatly appreciated.
Thank you in advance
LP
[[alternative HTML version deleted]]