准备条件:python环境(必要库,python-opencv,numpy,matplotlib)
import cv2
import numpy as np
import matplotlib.pyplot as plt
print('start')
image = cv2.imread(r'C:\software\Fashion_Landmark_Detection_and_Category_Classification-master\images\CTU\3.jpg')# 使用cv2.imread()函数读取图像
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) #BGR格式转换成RGB格式
image = cv2.resize(image, (28,28)) #图像缩放
# print(image.shape[0:2])
# define constants 定义常量
img_height, img_width = image.shape[:2] #获取图像的高度和宽度
alpha = 60 #均匀分布参数α = 600
sigma = 4 #高斯滤波器方差参数 σ = 40
kernel_size = 2*int(4*sigma)+1 #内核尺寸
# define random generator 定义随机生成器
random_state = np.random.RandomState(17)
for k in range(1):
dx = np.zeros((img_height, img_width)