借鉴和摘抄了一些博客,贴出来:
阿里云官方知乎号文章(ps:根据我的印象,这也是翻译的歪果仁博客的)
1.无OpenCV库:
#读图
# Image Loading Code used for these examples
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
img = Image.open('./NIKE.png')
img = np.array(img)
plt.imshow(img)
plt.show()
#左右镜像翻转
# Flipping images with Numpy
flipped_img = np.fliplr(img)
plt.imshow(flipped_img)
plt.show()
#左平移
# Shifting Left
for i in range(HEIGHT, 1, -1):
for j in range(WIDTH):
if (i < HEIGHT-20):
img[j][i] = img[j][i-20]
elif (i < HEIGHT-1):
img[j][i] = 0
plt.imshow(img)
plt.show()
#右平移
# Shifting Right
for j in range(WIDTH):
for i in range(HEIGHT):
if (i < HEIGHT-20):
img[j][i] = img[j][i+20]
plt.imshow(img)
plt.show()
#上平移
# Shifting Up
for j in range(WIDTH):
for i in range(HEIGHT):
if (j < WIDTH - 20 and j > 20):
img[j][i] = img[j+20][i]
else:
img[j][i] = 0
plt.imshow(img)
plt.show()
#下平移
#Shifting Down
for j in range(WIDTH, 1, -1):
for i in range(278):
if (j < 144 and j > 20):
img[j][i] = img[j-20][i]
plt.imshow(img)
plt.show()
#加噪声
# ADDING NOISE
noise = np.random.randint(5, size = (164, 278, 4), dtype = 'uint8')
for i in range(WIDTH):
for j in range(HEIGHT):
for k in range(DEPTH):
if (img[i][j][k] != 255):
img[i][j][k] += noise[i][j][k]
plt.imshow(img)
plt.show()
另外包括一些GAN方法,比较麻烦,属于高级数据增强方法。
2.神经网络中的图像增强方法
3.脚本之家的一些图像增强方法
4.imgaug的增强方式
仅用于查找,如有侵权,立马删,不侵权后面继续更...