fftshift将零频率移到中心,R语言imagefx包,时序图像特征识别

fftshift将零频率移到中心,R语言imagefx包,时序图像特征识别

# Tue Oct 12 14:20:32 2021 edit
# 字符编码:UTF-8
# R 版本:R 4.1.1 x64 for window 11
# [email protected]
# 个人笔记不负责任,拎了个梨
#.rs.restartR()
require(imagefx )
rm(list = ls());gc()

?   fftshift    #       将零频率移到中心


## build the four components of a matrix with four values (i.e. 1:4)
x1 <- matrix(1,nrow=1,ncol=1)
x2 <- x1+1
x3 <- x2+1
x4 <- x3+1

## combine all components together
x <- rbind(cbind(x1,x2),cbind(x3,x4))

## shift the matrix
x.shift <- fftshift(x)

## note the difference of the shifted and original
print(x)
print(x.shift)

##以图形方式记录移位和原始的差异
close.screen(all.screens=TRUE)
split.screen(c(1,2))
screen(1)
image(x,main='Original',col=rainbow(4))
screen(2)
image(x.shift,main='FFT Shifted', col=rainbow(4))

## close screens
close.screen(all.screens=TRUE)


fftshift将零频率移到中心.png

你可能感兴趣的:(fftshift将零频率移到中心,R语言imagefx包,时序图像特征识别)