最近,我正在使用图像进行云运动跟踪,但在视频实现中使用的许多示例中,显示了根据跟踪的对象移动的颤动图。
\n\nQuiver 文档主要采用四个参数([X, Y], U, V),何时X和Y是起点和 U方向V。另一方面,基于该示例的p1光流以形状为(200,200)的图像的形状(m,n,l)返回(位移)。我的困惑在于如何对参数进行排序,因为也goodFeaturesToTrack返回与p1
\xc2\xbf如何连接两个组件来绘制云运动的颤动?
\n我想使用 de Fast Fourier Transform 计算互相关,按照下图的步骤进行云运动跟踪。
def roi_image(image):
image = cv.imread(image, 0)
roi = image[700:900, 1900:2100]
return roi
def FouTransf(image):
img_f32 = np.float32(image)
d_ft = cv.dft(img_f32, flags = cv.DFT_COMPLEX_OUTPUT)
d_ft_shift = np.fft.fftshift(d_ft)
rows, cols = image.shape
opt_rows = cv.getOptimalDFTSize(rows)
opt_cols = cv.getOptimalDFTSize(cols)
opt_img = np.zeros((opt_rows, opt_cols))
opt_img[:rows, :cols] = image
crow, ccol = opt_rows / 2 , opt_cols / 2
mask = np.zeros((opt_rows, opt_cols, 2), np.uint8)
mask[int(crow-50):int(crow+50), int(ccol-50):int(ccol+50)] = 1
f_mask = d_ft_shift*mask
return f_mask
def inv_FouTransf(image):
f_ishift = np.fft.ifftshift(image) …Run Code Online (Sandbox Code Playgroud)