swap.quad: Swapping Quadrants

Description Usage Arguments Value See Also Examples

Description

A function maybe useful to generates power spectrum from fft output.

Usage

1
swap.quad(x, disp=FALSE, reverse=FALSE)

Arguments

x

output of Mod(fft(imagefile))

disp

TRUE requests to draw power spectrum

reverse

TRUE should be used when power spectrum of N x M, where one of them is odd number.

Value

a matrix of power spectrum

See Also

fft, Mod

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(camphora)
data(cryptomeria)
img1 <-camphora
img2 <- rgb2gray(cryptomeria)
par(mfrow=c(2,2))

image(rot90c(img1),col=gray(c(0:255)/255), main="Camphora", asp=1, 
useRaster=TRUE, axes=FALSE)
o.fft <-Mod(fft(img1))
ps <- swap.quad(o.fft)
image(rot90c(log(ps)),col=gray(c(0:255)/255), main="power spectrum", asp=1, 
useRaster=TRUE, axes=FALSE)

image(rot90c(img2),col=gray(c(0:255)/255), main="Cryptomeria", asp=1, 
useRaster=TRUE, axes=FALSE)
image(rot90c(log(swap.quad(Mod(fft(img2))))),col=gray(c(0:255)/255), 
main="power spectrum", asp=1, useRaster=TRUE, axes=FALSE)

wvtool documentation built on May 1, 2019, 10:27 p.m.

Related to swap.quad in wvtool...