Ich habe ein Bild, aus dem ich eine Farbe in eine Maske extrahieren, wie im folgenden Code gezeigt. Die Maske liefert ein Schwarz-Weiß-Bild. Weiß ist die Farbe, die ich erkenne. Der Pixelwert von Weiß ist 255 und Schwarz ist 0.Python OpenCV erhalten unteren Wert der Maske
Ich möchte das unterste x und Y Pixel des weißen Teils der Maske erhalten. Wie mache ich das? Mein Code ist wie folgt:
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)