Ask Your Question

Revision history [back]

How to find the color at a coordinate?

I need to find the colour at a particular coordinate. How could I do this?

For example, I load the image as follows:

import cv2
import math

img = cv2.imread("image.png")

x_ccordinate = math.floor(img.shape[0] / 2)
y_coordinate = math.floor(img.shape[1] / 2)

I need to know the color represented by x_coordinate and y_coordinate. How could I do this?