 Salá programɛ moko ya ordinatɛrɛ oyo ekoki koluka boule ya motane oyo ezali zingazinga na yango.
Tala ndakisa ya programme ya Python oyo ekoki koluka boule rouge na image na kosalelaka bibliothèque ya vision ordinateur OpenCV: ```python import cv2 import numpy as np # Charger image na variable image = cv2.imread('image .jpg') # Bobongola elilingi uta na BGR na HSV esika ya langi hsv = cv2.cvtColor(elilingi, cv2.COLOR_BGR2HSV) # Limbola molongo ya langi ya motane na HSV lower_red = np.array([0, 120, 70]) upper_red = np.array([10, 255, 255]) # Salelá masque mpo na kopona kaka ba pixels ya langi ya motane mask = cv2.inRange(hsv, lower_rouge, upper_rouge) # Salelá masque mpo na kopona ba pixels ya langi ya motane na elilingi ya ebandeli result = cv2.bitwise_and(image, image, mask=mask) # Bobongola image ya résultat na échelle ya gris result_gray = cv2.cvtColor(résultat, cv2.COLOR_BGR2GRAY) # Détecter ba cercles na image ya échelle grise na nzela ya méthode HoughCircles cercles = cv2.HoughCircles( result_gray, cv2.HOUGH_GRADIENT, 1, 20, param1=50, param2=30, minRadius=0, maxRadius=0) # Tala soki ba cercles moko ezwami soki ba cercles ezali te Eloko moko te: # Bobongola ba coordonnées (x, y) mpe rayon ya ba cercles na ba nombres entiers cercles = np.round(cercles[0, :]).astype("int") # Boucle likolo ya ba coordonnées (x, y) na rayon ya ba cercles pona (x, y, r) na ba cercles : # Bosala cercle na image ya sortie cv2.circle(image, (x, y), r, (0, 255, 0), 4) # Tia texte pona kolakisa que boule rouge ezwami cv2.putText(image, "Bole rouge ezwami", (x - 50, y - 50), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2) else: # Tia makomi mpo na kolakisa ete boule rouge ezwami te cv2.putText( image, "Boule rouge ezwami te", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2) # Lakisa elilingi ya kobima cv2.imshow('