DFT(离散傅里叶变换)的计算时间不是一个随着数组大小增大而增大的单调函数,而是与数组大小密切相关。当数组的大小是2的级数(2,4,8,16......)和 N = 2 p * 3 q * 5 r 时,计算的速率明显提高。所以首先需要变换一下数组大小,或者为图片填充一些数据,使图片的尺寸满足上面要求。
int getOptimalDFTSize(int vecsize)//获取最佳尺寸。
oid copyMakeBorder(InputArray src, OutputArray dst, int top, int bottom, int left,
int right, int borderType, const Scalar&value=Scalar() )//图像加宽和变高。
src – Source image.
dst – Destination image of the same type as src and the
size Size(src.cols+left+right, src.rows+top+bottom) .