1

I am using Ubuntu 12.04 and want to do image classification in SAGA. SAGA has numerous classification algorithms which is not present in GRASS and QGIS. I am new to SAGA, but more accustomed to work on R or python. I installed RSAGA package in R, but could not find any command to do image classification. Please let me know how to do image classification in SAGA through an R/python/shell scripts.

Thanks, Karthik K.

1

It's looks like you can´t use those SAGA modules with RSAGA, but if you are trying to do cluster analysis (unsupervised classification) you can do it directly in R:

library(raster)
files <- list.files()
EVI <- stack(files)
plot (EVI)

EVI.df <- as.data.frame(EVI)  
wss <- (nrow(EVI.df)-1)*sum(apply(EVI.df,2,var))
for (i in 2:12) {wss[i] <- sum(kmeans(EVI.df, centers=i)$withinss)} ## to choose numer of clusters...
plot(1:12, wss, type="b", xlab="Number of Clusters", ylab="Within groups sum of squares")

kmeans.EVI <- kmeans(EVI.df, 12) ### kmeans, with 12 clusters

clusters <- setValues(EVI, kmeans.EVI$cluster)  
plot(clusters)
1
  • 1
    Thanks for the unsupervised classification code in R script. But I am specifically looking to use the supervised classification algorithms written in SAGA through script. – Karthik K Jun 20 '14 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.