import cv2
import numpy as np
# 回调函数,x表示滑块的位置,本例暂不使用
def nothing(x):
pass
def ColorDetector(img, lower=np.array([20, 50, 46]), upper=np.array([60, 255, 255])):
"""
提取颜色图像
:param img:
:param lower:
:param upper:
:return:
"""
Hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
# mask -> 1 channel
mask_green = cv2