Fourier transforms for multitemporal analysis: Difference between revisions
(Fourier transforms for multitemporal analysis) |
|||
(5 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 9: | Line 9: | ||
http://grass.osgeo.org/download/sample-data/ | http://grass.osgeo.org/download/sample-data/ | ||
Setting the region of interest based on a Landsat image | <source lang="bash"> | ||
# Setting the region of interest based on a Landsat image | |||
g.region rast=lsat7_2002_10 -p | g.region rast=lsat7_2002_10 -p | ||
</source> | |||
'' | '''Performing PCA on a multitemporal set of images (Landsat images in this case)''' | ||
'' | ''1987'' | ||
i.pca | <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 | |||
</source> | |||
''2002'' | |||
<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 | |||
</source> | |||
''1987''< | '''Showing the first principal component''' | ||
''1987'' | |||
<source lang="bash"> | |||
d.mon x0 | d.mon x0 | ||
d.rast lsat5_1987_pca.1 | d.rast lsat5_1987_pca.1 | ||
</source> | |||
''2002''< | ''2002'' | ||
<source lang="bash"> | |||
d.mon x1 | d.mon x1 | ||
d.rast lsat7_2002_pca.1 | d.rast lsat7_2002_pca.1 | ||
</source> | |||
'' | '''Fourier transform''' | ||
'' | ''1987'' | ||
i.fft | <source lang="bash"> | ||
i.fft input=lsat5_1987_pca.1 real=lsat5_1987_pca1.real imaginary=lsat5_1987_pca1.imag | |||
</source> | |||
''' | ''2002'' | ||
<source lang="bash"> | |||
i.fft input=lsat7_2002_pca.1 real=lsat7_2002_pca1.real imaginary=lsat7_2002_pca1.imag | |||
</source> | |||
''1987''< | '''Creating Fig. 2 in Rocchini et al. (2013)''' | ||
''1987'' | |||
<source lang="bash"> | |||
d.mon x2 | d.mon x2 | ||
d.rast lsat5_1987_pca1.real | d.rast lsat5_1987_pca1.real | ||
</source> | |||
''2002''< | ''2002'' | ||
<source lang="bash"> | |||
d.mon x3 | d.mon x3 | ||
d.rast lsat7_2002_pca1.real | d.rast lsat7_2002_pca1.real | ||
</source> | |||
'''Additional example with MODIS data: Fig. 6 in Rocchini et al. (2013)'''<br /> | '''Additional example with MODIS data: Fig. 6 in Rocchini et al. (2013)'''<br /> | ||
''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 /> | ||
r.in.gdal input=Goodes.EUAS.2005033.band2.tif | <source lang="bash"> | ||
r.in.gdal input=Goodes.EUAS.2005033.band2.tif output=Goodes.EUAS.2005033.band2 | |||
</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 /> | ||
r.in.gdal input=Goodes.EUAS.2005193.band2.tif | <source lang="bash"> | ||
r.in.gdal input=Goodes.EUAS.2005193.band2.tif output=Goodes.EUAS.2005193.band2 | |||
</source> | |||
''Fourier transforms'' <br /> | ''Fourier transforms'' <br /> | ||
<source lang="bash"> | |||
i.fft input=Goodes.EUAS.2005033.band2 real=Goodes.EUAS.2005033.band2.real imaginary=Goodes.EUAS.2005033.band2.imag | i.fft input=Goodes.EUAS.2005033.band2 real=Goodes.EUAS.2005033.band2.real imaginary=Goodes.EUAS.2005033.band2.imag | ||
</source> | |||
<source lang="bash"> | |||
i.fft input=Goodes.EUAS.2005193.band2 real=Goodes.EUAS.2005193.band2.real imaginary=Goodes.EUAS.2005193.band2.imag | i.fft input=Goodes.EUAS.2005193.band2 real=Goodes.EUAS.2005193.band2.real imaginary=Goodes.EUAS.2005193.band2.imag | ||
</source> | |||
'''R: statistical analysis'''<br /> | '''R: statistical analysis'''<br /> | ||
Line 67: | Line 93: | ||
'''Importing the Fourier image from GRASS GIS by the spgrass6 library<br /> | '''Importing the Fourier image from GRASS GIS by the spgrass6 library<br /> | ||
<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'), | ||
''where lsat5_1987_pca1.real and lsat7_2002_pca1.real are the Fourier transform images derived from GRASS GIS | cat=c(F,F), ignore.stderr=TRUE, plugin=NULL) | ||
'' | </source> | ||
''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)''<br /> | ''Kernel Density Plot: Fig. 4 in Rocchini et al. (2013)''<br /> | ||
<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> | |||
''Hexagon binning: Fig. 5 in Rocchini et al. (2013)''<br /> | ''Hexagon binning: Fig. 5 in Rocchini et al. (2013)''<br /> | ||
<source lang="bash"> | |||
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> | |||
[[Category:Documentation]] | |||
[[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)