HOG特征:https://zhuanlan.zhihu.com/p/40960756
计算梯度:水平方向[1,0,-1],
image.png
LBP特征: https://www.jianshu.com/p/8d96ceb45f74
与周围数字比大小,用0/1表示周围的数字,然后拼接为2进制后转化为十进制
image.png
具有一定程度的旋转不变性
Haar-like特征:https://zhuanlan.zhihu.com/p/38056144

本节有课程ppt,百度网盘

image.pngimage.png

知识点记录

反色变换:图像取反,即255-image

  1. #反色变换
  2. reverse_c=img.copy()
  3. rows=img.shape[0]
  4. cols=img.shape[1]
  5. deeps=img.shape[2]
  6. for i in range(rows):
  7. for j in range(cols):
  8. for d in range(deeps):
  9. reverse_c[i][j][d]=255-reverse_c[i][j][d]
  10. cv2.imwrite("tangsan_img_reverse.jpg",cv2.hconcat([img,reverse_c]))
  11. plt.imshow(trans2show(cv2.hconcat([img,reverse_c])))
  12. plt.show()

image.png

伽马变换

  1. #img = cv2.cvtColor(img,cv2.COLOR_RGB2BRG)
  2. gamma_c=dog.copy()
  3. rows=dog.shape[0]
  4. cols=dog.shape[1]
  5. deeps=dog.shape[2]
  6. for i in range(rows):
  7. for j in range(cols):
  8. for d in range(deeps):
  9. gamma_c[i][j][d]=3*pow(gamma_c[i][j][d],0.9)
  10. cv2.imwrite("tangsan_img_gamma_c.jpg",cv2.hconcat([dog,gamma_c]))
  11. os.system("open tangsan_img_gamma_c.jpg")
  12. plt.imshow(trans2show(cv2.hconcat([dog,gamma_c])))
  13. plt.show()

image.png

直方图与直方图均衡化

  1. trans = hist/(rows*cols)*255
  2. for i in range(1,len(trans)):
  3. trans[i]=trans[i-1]+trans[i]
  4. #
  5. # 0 -> trans[0]
  6. # 1 -> trans[1]
  7. # ...
  8. # 254 -> trans[254]
  9. # 255 -> trans[255]
  10. gray_h = gray.copy()
  11. for i in range(rows):
  12. for j in range(cols):
  13. gray_h[i][j] = int(trans[gray[i][j]])
  14. plt.figure(figsize=(10,10))
  15. plt.imshow(cv2.hconcat([gray,gray_h]),cmap='gray')
  16. plt.title("scr and Histogram Equalization")
  17. plt.show()

image.png

  1. hist_h=np.zeros(256)
  2. for i in range(rows):
  3. for j in range(cols):
  4. tmp = gray_h[i][j]
  5. hist_h[tmp]=hist_h[tmp]+1
  6. plt.plot(hist_h)
  7. plt.show()

image.png
直方图均衡化拓展:
理论:https://zhuanlan.zhihu.com/p/44918476
计算过程:https://blog.csdn.net/zaishuiyifangxym/article/details/89813977