### SVD(奇异值分解)的通俗理解和实际应用

2019-06-30

1196

0

1.1 特征值

1.2 奇异值

r是一个远小于mn的数，这样矩阵的乘法看起来像是下面的样子：

2.1 女神图片压缩

130项的效果：

2.2 图像去噪

1 https://www.cnblogs.com/LeftNotEasy/archive/2011/01/19/svd-and-applications.html

2 https://www.zhihu.com/question/22237507 3 We Recommend a Singular Value DecompositionFeature Column from the AMS

————

1 文中生成ueno.juri图像的各项SVD合成图的python代码（参考自https://www.cnblogs.com/baby-lily/p/10758904.html）：

``````import numpy as np
import matplotlib.image as mping
import matplotlib.pyplot as plt
import matplotlib as mpl

def image_svd(n, pic):
a, b, c = np.linalg.svd(pic)
svd = np.zeros((a.shape[0],c.shape[1]))
for i in range(0, n):
svd[i, i] = b[i]
img = np.matmul(a, svd)
img = np.matmul(img, c)
img[ img >= 255] = 255
img[  0 >= img ] = 0
img = img.astype(np.uint8)
return img

if __name__ == '__main__':
mpl.rcParams['font.sans-serif'] = ['SimHei']
mpl.rcParams['axes.unicode_minus'] = False

path = 'ueno.juri.jpg'
print(img.shape)

r = img[:, :, 0]
g = img[:, :, 1]
b = img[:, :, 2]
plt.figure(figsize=(50, 100))
for i in range(1, 31):
r_img = image_svd(i, r)
g_img = image_svd(i, g)
b_img = image_svd(i, b)
pic = np.stack([r_img, g_img, b_img], axis=2)
print(i)
plt.subplot(5, 6, i)
plt.title("特征值个数：%d" %(i))
plt.axis('off')
plt.imshow(pic)
plt.suptitle("图像的SVD分解")
plt.show()``````

### 推荐文章

LIDAR ODOMETRY

2016-11-23 19:53:47

2019-08-18 17:33:32

Deep Learning with OpenCV

2017-09-03 15:23:27

2016-09-13 22:21:25

2017-03-24 14:20:50