diff options
author | melissawm <melissawm@gmail.com> | 2020-02-21 11:39:18 -0300 |
---|---|---|
committer | melissawm <melissawm@gmail.com> | 2020-02-21 11:39:18 -0300 |
commit | cc6537b2281a088448df73bfc3d7aec5ab80f1dc (patch) | |
tree | 2312608ba6a382d64702a308bdb3c3e70ea775f5 /doc/source/user/plot_gray_svd.py | |
parent | 6b81184f6ca54ea5c45fcb00ce1158fdcbb4db42 (diff) | |
download | numpy-cc6537b2281a088448df73bfc3d7aec5ab80f1dc.tar.gz |
Added plot scripts and reworded to respond to PR comments.
Diffstat (limited to 'doc/source/user/plot_gray_svd.py')
-rw-r--r-- | doc/source/user/plot_gray_svd.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/source/user/plot_gray_svd.py b/doc/source/user/plot_gray_svd.py new file mode 100644 index 000000000..95439939d --- /dev/null +++ b/doc/source/user/plot_gray_svd.py @@ -0,0 +1,16 @@ +from scipy import misc +import matplotlib.pyplot as plt +import numpy as np +from numpy import linalg + +img = misc.face() +img_array = img / 255 +img_gray = img_array @ [0.2126, 0.7152, 0.0722] + +U, s, Vt = linalg.svd(img_gray) + +Sigma = np.zeros((768, 1024)) +for i in range(768): + Sigma[i, i] = s[i] + +plt.plot(s) |