Created
February 16, 2020 23:51
-
-
Save HiCraigChen/aea8765162db5c61da30df1f0d19d16a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def distance(point1,point2): | |
return sqrt((point1[0]-point2[0])**2 + (point1[1]-point2[1])**2) | |
def butterworthLP(D0,imgShape,n): | |
base = np.zeros(imgShape[:2]) | |
rows, cols = imgShape[:2] | |
center = (rows/2,cols/2) | |
for x in range(cols): | |
for y in range(rows): | |
base[y,x] = 1/(1+(distance((y,x),center)/D0)**(2*n)) | |
return base | |
def butterworthHP(D0,imgShape,n): | |
base = np.zeros(imgShape[:2]) | |
rows, cols = imgShape[:2] | |
center = (rows/2,cols/2) | |
for x in range(cols): | |
for y in range(rows): | |
base[y,x] = 1-1/(1+(distance((y,x),center)/D0)**(2*n)) | |
return base |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment