Add generate_vignetting.py
This commit is contained in:
parent
92026d7134
commit
6a2b6386c9
28
datasets/raise/fft/generate_vignetting.py
Normal file
28
datasets/raise/fft/generate_vignetting.py
Normal file
@ -0,0 +1,28 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
A = -1.076923838846692e-06
|
||||
B = 0.0010539307456559996
|
||||
C = 31.8
|
||||
|
||||
SHAPE = (2_000, 3_000)
|
||||
CENTER = np.array(SHAPE) // 2
|
||||
|
||||
# `dtype` by default is `float64` as wanted.
|
||||
image = np.empty(SHAPE)
|
||||
|
||||
def getDistance(y, x):
|
||||
d = ((y - (SHAPE[0] / 2)) ** 2 + (x - (SHAPE[1] / 2)) ** 2) ** 0.5
|
||||
return d
|
||||
|
||||
def vignetting(y, x):
|
||||
d = getDistance(y, x)
|
||||
return A * (d ** 2) + B * (d ** 2) + C
|
||||
|
||||
for y in range(SHAPE[0]):
|
||||
for x in range(SHAPE[1]):
|
||||
image[y, x] = vignetting(y, x)
|
||||
|
||||
print(image[np.array(SHAPE) / 2])
|
||||
plt.imshow(image)
|
||||
plt.show()
|
Loading…
x
Reference in New Issue
Block a user