一:改变颜色
cv2.cvtColor(),cv2.inRange()
一般BGR转Gray,BGR转HSV
cv2.cvtColor(input_image,flag) flag: cv2.COLOR_BGR2GRAY cv2.COLOR_BGR2HSV
(1) 追踪颜色:颜色
HSV: 色调(H),饱和度(S),明度(V).
Hue range is [0,179], Saturation range is [0,255] and Value range is [0,255].
(2) 从BGR得到HSV的值
二:图像的几何变换
cv2.getPerspectiveTransform
(1)转换:cv2.warpAffine :2x3 transformation matrix
cv2.warpPerspective:3x3 transformation matrix
(2)缩放 cv2.resize(). 差值方法:cv2.INTER_AREA,cv2.INTER_CUBIC,cv2.INTER_LINEAR
(3)移动 : 移动tx,ty
(4)旋转:旋转90度
三:Image Thresholding
(1)简单的阈值
cv2.THRESH_BINARY
cv2.THRESH_BINARY_INV
cv2.THRESH_TRUNC
cv2.THRESH_TOZERO
cv2.THRESH_TOZERO_INV
Result:
(2)可适应的阈值
cv2.ADAPTIVE_THRESH_MEAN_C : threshold value is the mean of neighbourhood area.
cv2.ADAPTIVE_THRESH_GAUSSIAN_C : threshold value is the weighted sum of neighbourhood values where weights are a gaussian window.
Results: