Created
May 18, 2021 07:38
-
-
Save JustinSDK/e4627b8f943390cf9d390c0f2e78d98e to your computer and use it in GitHub Desktop.
Sin 灰階變化
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
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from matplotlib import cm | |
| freq = 5 | |
| stop = .25 | |
| sample_rate = 800 | |
| x = np.linspace(0, stop, int(stop * sample_rate), endpoint = False) | |
| gray = 125 + np.sin(freq * 2 * np.pi * x) + 125 | |
| plt.imshow(gray.reshape(1, 200).repeat(200, axis = 0), cmap = cm.gray) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment