【发布时间】:2017-01-16 18:49:52
【问题描述】:
img = cv2.imread('/home/user/Documents/workspace/ImageProcessing/img.JPG');
image = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
#red, blue, yellow, and gray
boundaries = [
([17, 15, 100], [50, 56, 200]),
([86, 31, 4], [220, 88, 50]),
([25, 146, 190], [62, 174, 250]),
([103, 86, 65], [145, 133, 128])]
for i, (lower, upper) in enumerate(boundaries):
lower = np.array(lower, dtype="uint8")
upper = np.array(upper, dtype="uint8")
mask = cv2.inRange(image, lower, upper)
output = cv2.bitwise_and(image, image, mask=mask)
cv2.imwrite(str(i) + 'image.jpg', output)
我正在尝试从图像中分离出红色、蓝色、黄色和灰色(分别)。 到目前为止它正在工作,但是“灵敏度”很低。 该算法缺少一些较小的色点。 有没有办法校准这个? 谢谢!
【问题讨论】:
-
如果您还可以添加输入/输出图像,这将有助于我们更好地理解问题。
标签: python opencv image-processing color-detection