BaseFFTProcessor.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:NGImageProcessor 作者: artzers 项目源码 文件源码
def FFTDemo(self):
        img = cv2.imread("lena.jpg")
        baseTransfer = BasePixelTransfer.BasePixelTransfer()
        img = baseTransfer.RGB2Gray(img)
        fimg = img.copy()
        fimg = np.float32(fimg)
        # for i in xrange(0, img.shape[0]):
        #     for j in xrange(0, img.shape[1]):
        #         fimg[i, j] *= (-1) ** (i + j)

        fftimg = np.fft.fftshift(np.fft.fft2(fimg))
        ifft = np.real(np.fft.ifft2(fftimg))
        for i in xrange(0, ifft.shape[0]):
            for j in xrange(0, ifft.shape[1]):
                ifft[i, j] *= (-1) ** (i + j)
        cv2.namedWindow("lena")
        cv2.imshow("lena", img)
        cv2.namedWindow("fft")
        cv2.imshow("fft", np.real(fftimg))
        cv2.imshow("ifft", np.uint8(ifft))
        cv2.waitKey(0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号