Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import numpy as np
- image = cv2.imread("big_img.png") #https://prnt.sc/pw2ltm
- # ищет первый пиксель данного цвета и возвращает его координаты
- def find_first_pix(img, pix):
- x, y = None, None
- if pix in img:
- x = np.where(img == pix)[1][0]
- y = np.where(img == pix)[0][0]
- return (x, y)
- pix = [85, 60, 52]
- print(find_first_pix(image, pix)) # (0, 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement