HOG特征:https://zhuanlan.zhihu.com/p/40960756,
计算梯度:水平方向[1,0,-1],
LBP特征: https://www.jianshu.com/p/8d96ceb45f74
与周围数字比大小,用0/1表示周围的数字,然后拼接为2进制后转化为十进制
具有一定程度的旋转不变性
Haar-like特征:https://zhuanlan.zhihu.com/p/38056144
本节有课程ppt,百度网盘
知识点记录
反色变换:图像取反,即255-image
#反色变换
reverse_c=img.copy()
rows=img.shape[0]
cols=img.shape[1]
deeps=img.shape[2]
for i in range(rows):
for j in range(cols):
for d in range(deeps):
reverse_c[i][j][d]=255-reverse_c[i][j][d]
cv2.imwrite("tangsan_img_reverse.jpg",cv2.hconcat([img,reverse_c]))
plt.imshow(trans2show(cv2.hconcat([img,reverse_c])))
plt.show()
伽马变换
#img = cv2.cvtColor(img,cv2.COLOR_RGB2BRG)
gamma_c=dog.copy()
rows=dog.shape[0]
cols=dog.shape[1]
deeps=dog.shape[2]
for i in range(rows):
for j in range(cols):
for d in range(deeps):
gamma_c[i][j][d]=3*pow(gamma_c[i][j][d],0.9)
cv2.imwrite("tangsan_img_gamma_c.jpg",cv2.hconcat([dog,gamma_c]))
os.system("open tangsan_img_gamma_c.jpg")
plt.imshow(trans2show(cv2.hconcat([dog,gamma_c])))
plt.show()
直方图与直方图均衡化
trans = hist/(rows*cols)*255
for i in range(1,len(trans)):
trans[i]=trans[i-1]+trans[i]
#
# 0 -> trans[0]
# 1 -> trans[1]
# ...
# 254 -> trans[254]
# 255 -> trans[255]
gray_h = gray.copy()
for i in range(rows):
for j in range(cols):
gray_h[i][j] = int(trans[gray[i][j]])
plt.figure(figsize=(10,10))
plt.imshow(cv2.hconcat([gray,gray_h]),cmap='gray')
plt.title("scr and Histogram Equalization")
plt.show()
hist_h=np.zeros(256)
for i in range(rows):
for j in range(cols):
tmp = gray_h[i][j]
hist_h[tmp]=hist_h[tmp]+1
plt.plot(hist_h)
plt.show()
直方图均衡化拓展:
理论:https://zhuanlan.zhihu.com/p/44918476
计算过程:https://blog.csdn.net/zaishuiyifangxym/article/details/89813977