dfourier | R Documentation |
Calculates discrete cosine transforms, as introduced by Dommergues and colleagues, on a shape (mainly open outlines).
dfourier(coo, nb.h)
## Default S3 method:
dfourier(coo, nb.h)
## S3 method for class 'Opn'
dfourier(coo, nb.h)
## S3 method for class 'list'
dfourier(coo, nb.h)
## S3 method for class 'Coo'
dfourier(coo, nb.h)
coo |
a matrix (or a list) of (x; y) coordinates |
nb.h |
numeric the number of harmonics to calculate |
a list with the following components:
an the A harmonic coefficients
bn the B harmonic coefficients
mod the modules of the points
arg the arguments of the points
This method has been only poorly tested in Momocs and should be considered as experimental. Yet improved by a factor 10, this method is still long to execute. It will be improved in further releases but it should not be so painful right now. It also explains the progress bar. Shapes should be aligned before performing the dct transform.
Silent message and progress bars (if any) with options("verbose"=FALSE)
.
Dommergues, C. H., Dommergues, J.-L., & Verrecchia, E. P. (2007). The Discrete Cosine Transform, a Fourier-related Method for Morphometric Analysis of Open Contours. Mathematical Geology, 39(8), 749-763. doi:10.1007/s11004-007-9124-6
Many thanks to Remi Laffont for the translation in R).
Other dfourier:
dfourier_i()
,
dfourier_shape()
o <- olea %>% slice(1:5) # for the sake of speed
od <- dfourier(o)
od
op <- PCA(od)
plot(op, 1)
# dfourier and inverse dfourier
o <- olea[1]
o <- coo_bookstein(o)
coo_plot(o)
o.dfourier <- dfourier(o, nb.h=12)
o.dfourier
o.i <- dfourier_i(o.dfourier)
o.i <- coo_bookstein(o.i)
coo_draw(o.i, border='red')
#future calibrate_reconstructions
o <- olea[1]
h.range <- 2:13
coo <- list()
for (i in seq(along=h.range)){
coo[[i]] <- dfourier_i(dfourier(o, nb.h=h.range[i]))}
names(coo) <- paste0('h', h.range)
panel(Opn(coo), borders=col_india(12), names=TRUE)
title('Discrete Cosine Transforms')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.