Fourier transforms for multitemporal analysis: Difference between revisions
(beautified) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
'''GRASS GIS and R code used in:''' | '''GRASS GIS and R code used in:''' | ||
Rocchini, D., Metz, M., Ricotta, C., Landa, M., Frigeri, A., Neteler, M. (2013). Fourier transforms for | Rocchini, D., Metz, M., Ricotta, C., Landa, M., Frigeri, A., Neteler, M. (2013). Fourier transforms for detecting multitemporal landscape fragmentation by remote sensing. International Journal of Remote Sensing, 34: 8907-8916. ([http://dx.doi.org/10.1080/01431161.2013.853896 DOI]) (IF: 1.138) | ||
GRASS GIS: Fourier transform calculation | GRASS GIS: Fourier transform calculation | ||
Line 18: | Line 18: | ||
''1987'' | ''1987'' | ||
<source lang="bash"> | <source lang="bash"> | ||
i.pca input=lsat5_1987_10,lsat5_1987_20,lsat5_1987_30,lsat5_1987_40,lsat5_1987_50,lsat5_1987_70 output=lsat5_1987_pca | i.pca input=lsat5_1987_10,lsat5_1987_20,lsat5_1987_30,lsat5_1987_40,lsat5_1987_50,lsat5_1987_70 \ | ||
output=lsat5_1987_pca | |||
</source> | </source> | ||
''2002'' | ''2002'' | ||
<source lang="bash"> | <source lang="bash"> | ||
i.pca input=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70 output=lsat7_2002_pca | i.pca input=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70 \ | ||
output=lsat7_2002_pca | |||
</source> | </source> | ||
Line 44: | Line 46: | ||
''1987'' | ''1987'' | ||
<source lang="bash"> | <source lang="bash"> | ||
i.fft lsat5_1987_pca.1 real=lsat5_1987_pca1.real imaginary=lsat5_1987_pca1.imag | i.fft input=lsat5_1987_pca.1 real=lsat5_1987_pca1.real imaginary=lsat5_1987_pca1.imag | ||
</source> | </source> | ||
''2002'' | ''2002'' | ||
<source lang="bash"> | <source lang="bash"> | ||
i.fft lsat7_2002_pca.1 real=lsat7_2002_pca1.real imaginary=lsat7_2002_pca1.imag | i.fft input=lsat7_2002_pca.1 real=lsat7_2002_pca1.real imaginary=lsat7_2002_pca1.imag | ||
</source> | </source> | ||
Line 70: | Line 72: | ||
''Import data: image covering a temporal period from 2005-02-02 to 2005-03-05 (band 2 being used)''<br /> | ''Import data: image covering a temporal period from 2005-02-02 to 2005-03-05 (band 2 being used)''<br /> | ||
<source lang="bash"> | <source lang="bash"> | ||
r.in.gdal input=Goodes.EUAS.2005033.band2.tif | r.in.gdal input=Goodes.EUAS.2005033.band2.tif output=Goodes.EUAS.2005033.band2 | ||
</source> | </source> | ||
''Import data: image covering a temporal period from 2005-07-12 to 2005-08-12 (band 2 being used)''<br /> | ''Import data: image covering a temporal period from 2005-07-12 to 2005-08-12 (band 2 being used)''<br /> | ||
<source lang="bash"> | <source lang="bash"> | ||
r.in.gdal input=Goodes.EUAS.2005193.band2.tif | r.in.gdal input=Goodes.EUAS.2005193.band2.tif output=Goodes.EUAS.2005193.band2 | ||
</source> | </source> | ||
Line 93: | Line 95: | ||
<source lang="bash"> | <source lang="bash"> | ||
library(spgrass6) | library(spgrass6) | ||
fft.images<-readRAST6(c('lsat5_1987_pca1.real','lsat7_2002_pca1.real'), cat=c(F,F), ignore.stderr=TRUE, plugin=NULL) | fft.images<-readRAST6(c('lsat5_1987_pca1.real','lsat7_2002_pca1.real'), | ||
cat=c(F,F), ignore.stderr=TRUE, plugin=NULL) | |||
</source> | </source> | ||
''where lsat5_1987_pca1.real and lsat7_2002_pca1.real are the Fourier transform images derived from GRASS GIS'' | ''where lsat5_1987_pca1.real and lsat7_2002_pca1.real are the Fourier transform images derived from GRASS GIS'' | ||
Line 101: | Line 104: | ||
<source lang="bash"> | <source lang="bash"> | ||
library(sm) | library(sm) | ||
sm.density(fft.images$lsat5_1987_pca1.real, lty=1, lwd=2, ann=T, xlim=c(0,255), ylim=c(0,0.013), xlab='Fourier transform value', col='blue', cex.label=4) | sm.density(fft.images$lsat5_1987_pca1.real, lty=1, lwd=2, ann=T, | ||
xlim=c(0,255), ylim=c(0,0.013), xlab='Fourier transform value', col='blue', cex.label=4) | |||
par(new=T) | par(new=T) | ||
sm.density(fft.images$lsat7_2002_pca1.real,lty=1, lwd=2, ann=F, xlim=c(0,255), ylim=c(0,0.013), xlab=' ', col='red', cex.label=4) | sm.density(fft.images$lsat7_2002_pca1.real,lty=1, lwd=2, ann=F, | ||
legend(110, 0.012, c('Density function 1987', 'Density function 2002'), fill = c('blue', 'red'), cex=1.2, box.lty=0) | xlim=c(0,255), ylim=c(0,0.013), xlab=' ', col='red', cex.label=4) | ||
legend(110, 0.012, c('Density function 1987', 'Density function 2002'), | |||
fill = c('blue', 'red'), cex=1.2, box.lty=0) | |||
</source> | </source> | ||
Line 112: | Line 118: | ||
library(hexbin) | library(hexbin) | ||
hbin <- hexbin(fft.images$lsat5_1987_pca1.real, fft.images$lsat7_2002_pca1.real, xbins = 50) | hbin <- hexbin(fft.images$lsat5_1987_pca1.real, fft.images$lsat7_2002_pca1.real, xbins = 50) | ||
plot.bin<-plot(hbin, style = 'nested.lattice', legend=F, xlab='Fourier transform value 1987', ylab='Fourier transform value 2002') | plot.bin<-plot(hbin, style = 'nested.lattice', legend=F, | ||
xlab='Fourier transform value 1987', ylab='Fourier transform value 2002') | |||
hexVP.abline(plot.bin$plot.vp, 0, 1) | hexVP.abline(plot.bin$plot.vp, 0, 1) | ||
</source> | </source> | ||
Line 118: | Line 125: | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Image processing]] | [[Category:Image processing]] | ||
[[Category:Temporal]] |
Latest revision as of 15:59, 26 August 2014
Fourier transforms for detecting multitemporal landscape fragmentation by remote sensing GRASS GIS and R code used in:
Rocchini, D., Metz, M., Ricotta, C., Landa, M., Frigeri, A., Neteler, M. (2013). Fourier transforms for detecting multitemporal landscape fragmentation by remote sensing. International Journal of Remote Sensing, 34: 8907-8916. (DOI) (IF: 1.138)
GRASS GIS: Fourier transform calculation
The used data are from the North Carolina set available for free at: http://grass.osgeo.org/download/sample-data/
# Setting the region of interest based on a Landsat image
g.region rast=lsat7_2002_10 -p
Performing PCA on a multitemporal set of images (Landsat images in this case)
1987
i.pca input=lsat5_1987_10,lsat5_1987_20,lsat5_1987_30,lsat5_1987_40,lsat5_1987_50,lsat5_1987_70 \
output=lsat5_1987_pca
2002
i.pca input=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70 \
output=lsat7_2002_pca
Showing the first principal component
1987
d.mon x0
d.rast lsat5_1987_pca.1
2002
d.mon x1
d.rast lsat7_2002_pca.1
Fourier transform
1987
i.fft input=lsat5_1987_pca.1 real=lsat5_1987_pca1.real imaginary=lsat5_1987_pca1.imag
2002
i.fft input=lsat7_2002_pca.1 real=lsat7_2002_pca1.real imaginary=lsat7_2002_pca1.imag
Creating Fig. 2 in Rocchini et al. (2013)
1987
d.mon x2
d.rast lsat5_1987_pca1.real
2002
d.mon x3
d.rast lsat7_2002_pca1.real
Additional example with MODIS data: Fig. 6 in Rocchini et al. (2013)
Import data: image covering a temporal period from 2005-02-02 to 2005-03-05 (band 2 being used)
r.in.gdal input=Goodes.EUAS.2005033.band2.tif output=Goodes.EUAS.2005033.band2
Import data: image covering a temporal period from 2005-07-12 to 2005-08-12 (band 2 being used)
r.in.gdal input=Goodes.EUAS.2005193.band2.tif output=Goodes.EUAS.2005193.band2
Fourier transforms
i.fft input=Goodes.EUAS.2005033.band2 real=Goodes.EUAS.2005033.band2.real imaginary=Goodes.EUAS.2005033.band2.imag
i.fft input=Goodes.EUAS.2005193.band2 real=Goodes.EUAS.2005193.band2.real imaginary=Goodes.EUAS.2005193.band2.imag
R: statistical analysis
Importing the Fourier image from GRASS GIS by the spgrass6 library
library(spgrass6)
fft.images<-readRAST6(c('lsat5_1987_pca1.real','lsat7_2002_pca1.real'),
cat=c(F,F), ignore.stderr=TRUE, plugin=NULL)
where lsat5_1987_pca1.real and lsat7_2002_pca1.real are the Fourier transform images derived from GRASS GIS
Kernel Density Plot: Fig. 4 in Rocchini et al. (2013)
library(sm)
sm.density(fft.images$lsat5_1987_pca1.real, lty=1, lwd=2, ann=T,
xlim=c(0,255), ylim=c(0,0.013), xlab='Fourier transform value', col='blue', cex.label=4)
par(new=T)
sm.density(fft.images$lsat7_2002_pca1.real,lty=1, lwd=2, ann=F,
xlim=c(0,255), ylim=c(0,0.013), xlab=' ', col='red', cex.label=4)
legend(110, 0.012, c('Density function 1987', 'Density function 2002'),
fill = c('blue', 'red'), cex=1.2, box.lty=0)
Hexagon binning: Fig. 5 in Rocchini et al. (2013)
library(hexbin)
hbin <- hexbin(fft.images$lsat5_1987_pca1.real, fft.images$lsat7_2002_pca1.real, xbins = 50)
plot.bin<-plot(hbin, style = 'nested.lattice', legend=F,
xlab='Fourier transform value 1987', ylab='Fourier transform value 2002')
hexVP.abline(plot.bin$plot.vp, 0, 1)