【发布时间】:2017-01-22 18:02:20
【问题描述】:
我有一个图像,我从中提取颜色到掩码中,如下面的代码所示。蒙版提供黑白图像。白色是我检测到的颜色。白色的像素值为255,黑色为0。
我想获取蒙版白色部分最底部的 x 和 Y 像素。我该怎么做呢? 我的代码如下:
image = cv2.imread(FILENAME)
# THE COLOURS ARE IN RGB
lower_blue = np.array([50, 0, 0])
upper_blue = np.array([255, 50, 50])
# loop over the boundaries
# for (lower, upper) in boundaries:
# create NumPy arrays from the boundaries
lower = np.array(lower_blue, dtype = "uint8")
upper = np.array(upper_blue, dtype = "uint8")
# find the colors within the specified boundaries and apply
# the mask
mask = cv2.inRange(image, lower, upper)
【问题讨论】:
标签: python-2.7 opencv