Jump to content


Inactive Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About emani

  • Rank

Profile Information

  • Gender
  • Location
  1. Is it wise to convert 16 into 8 bit as it would increase ur processing speed.....does any one know some advantages regarding the conversion? Any research paper would also be helpful in this topic
  2. Hi, Thanks for the reply....I actually stretched the image in R using this code which was given to me by my friend and now I see that my DN values have changed as I checked them on ERDAS. As digital number should be an Integer but all the values I got after running this code were fractions. I am posting the code which I used below. rm(list=ls(all=TRUE)) require(rgdal) require(rgl) require(maptools) StartPath <- getwd() #Defining the root directory Root <- "E:/Programming/Emani" Path_in <- paste(Root, "/Input",sep="") Path_out <- paste(Root, "/Output",sep="") dir.create(Path_out,showWarnings=FALSE, recursive=TRUE) hist.strecth <- function(x) { n <- dim(x)[2] for(k in 1:n) { data <- x[,k] cur.lim <- quantile(data,c(0.025,0.975),na.rm=TRUE) data <- pmax(cur.lim[1],pmin(cur.lim[2],data)) data <- floor(255*(data-cur.lim[1])/(cur.lim[2]-cur.lim[1])) data[is.na(data)]<-0 x[,k] <- data } return(x) } #====================================================================================== # Read image #====================================================================================== image.fn <- "LAUW_20130327" A <- readGDAL(paste(Path_in,"/",image.fn,".tif",sep="")) Nb <- dim([email protected])[2] #summary([email protected]) # Read vector file, for subsetting vector.fn <- "extent" V <- readOGR(paste(Path_in,"/",vector.fn, sep=""), layer=vector.fn) i<-1 j<-1 polxy <- coordinates([email protected][[i]]@Polygons[[j]]) xy <- coordinates(A) tmp <- point.in.polygon(xy[,1],xy[,2],polxy[,1],polxy[,2]) ind <- which(tmp==1) indout<- which(tmp!=1) minDN <- array(0,Nb) maxDN <- array(0,Nb) for(k in 1:Nb) { x <- [email protected][ind,] minDN[k] <- min(x[,k]) data <- x[,k] maxDN[k] <- quantile(data,0.99,na.rm=TRUE) } Acalibrated <- A for(k in 1:Nb) { x <- [email protected][ind,k] x <- x-minDN[k] x <- x*255/(maxDN[k]-minDN[k]) x[x<0] <- 0 x[x>255]<-255 [email protected][ind,k] <- x } [email protected][indout,] <- 0 hist([email protected]$band4) # output MRF solution to a .tif file OUT <- Acalibrated setwd(Path_out) imagefn.out <- paste(image.fn,"_calibrated.tif",sep="") OUT.tif<-create2GDAL(OUT,drivername="GTiff",type="Float32",mvFlag=-1) saveDataset(OUT.tif,imagefn.out) GDAL.close(OUT.tif) setwd(StartPath) # The End thanks emani
  3. Does the value of digital number change after linear stretching? And is it fine to obtain vegetation indices from linerly stretched images? Thanks Emani
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.