Python OpenCV获得最大的掩码值

时间:2016-09-14 20:03:31

标签: python-2.7 opencv

我有一张图片,我从中提取颜色到面具中,如下面的代码所示。面具提供黑白图像。白色是我发现的颜色。白色的像素值为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)

1 个答案:

答案 0 :(得分:0)

你可以使用numpy的docker-compose stop -t 1 worker docker-compose build worker docker-compose create worker docker-compose start worker 来搜索你的面具中的特定值:

<Binding RelativeSource="{RelativeSource Self}"/>