Demo entry 6362226

The first code

   

Submitted by anonymous on May 07, 2017 at 19:33
Language: Python. Code size: 727 Bytes.

Created on Fri May 05 22:31:43 2017

@author: Ruimeng Wang
"""
import cv2 ###This is the package openCV
import numpy as np
import matplotlib.pyplot as plt

#f = np.fft.fft2(img)
imgread=cv2.imread('C:\Users\H Dou\Desktop\zemin.jpg',0)
###0 means read picture as grayscale picture directly
fftimgread=np.fft.fft2(imgread)
fftimgreadshift=np.fft.fftshift(fftimgread)
###Using the embedded fft to obtain the fft picture
s1=np.log(np.abs(fftimgread))
s2=np.log(np.abs(fftimgreadshift))
s3=imgread
plt.subplot(331),plt.imshow(s1,'gray'),plt.title('woutshift')
plt.subplot(332),plt.imshow(s2,'gray'),plt.title('center')
plt.subplot(333),plt.imshow(s3,'gray'),plt.title('original')
###Draw three different pictures

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).