pcorr3d图像的相位相关,R语言imagefx包,时序图像特征识别

pcorr3d图像的相位相关,R语言imagefx包,时序图像特征识别

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

?   pcorr3d #       图像的相位相关

data(tux1,tux2)
# 现在用相位相关函数求移位向量
shifts <- pcorr3d(tux1,tux2)

## ---- Plotting Example 1  ----- ##

split.screen(c(1,2))
screen(1)
image(1:nrow(tux1),1:ncol(tux1),tux1,col=gray.colors(200))

##根据找到的移位定义示例箭头起点和终点
x0 = nrow(tux1)/2
y0 = ncol(tux1)/2
x1 = x0 + shifts$max.shifts[1]
y1 = y0 + shifts$max.shifts[2]

## add arrows indicating how the image shifted
arrows(x0,y0,x1,y1)

## add a point where the arrow is
points(nrow(tux1)/2+shifts$max.shifts[1],ncol(tux1)/2+shifts$max.shifts[2],pch=21,bg='green')

screen(2)
image(1:nrow(tux2),1:ncol(tux2),tux2,col=gray.colors(200))
points(nrow(tux1)/2+shifts$max.shifts[1],ncol(tux1)/2+shifts$max.shifts[2],pch=21,bg='green')

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

dev.copy(png, "pcorr3d图像的相位相关.png");dev.off()

pcorr3d图像的相位相关.png

你可能感兴趣的:(pcorr3d图像的相位相关,R语言imagefx包,时序图像特征识别)