So I need coordinates of centers (blue dots in the bounding box) of each orange squares. It would be good to put them into the list of tuples. Here is the code I used to get this image:
import cv2 as cv
import numpy as np
from cvzone.ColorModule import ColorFinder
import cvzone
img = cv.imread("image_path")
myColorFinder = ColorFinder(False)
hsvValsOrange = {'hmin': 0, 'smin': 164, 'vmin': 0, 'hmax': 179, 'smax': 255, 'vmax': 255}
imgColor,mask = myColorFinder.update(img,hsvValsOrange)
imgContour, contours = cvzone.findContours(img,mask, minArea=1000)
if len(contours):
data = contours[0]["center"][0],h-contours[0]["center"][1],int(contours[0]["area"])
print(data)
imgStack = cvzone.stackImages([img,imgColor,mask,imgContour],2,0.5)
cv.imshow("Image", imgStack)
cv.waitKey(0)
cv.destroyAllWindows()