'what is mean of x1=w/2, y1=h/2, cx=x+x1, cy=y+y1 to count the value of bounding box?

for cnt in contours:`

for cnt in contours: # area = cv2.contourArea(cnt) (x,y,w,h) = cv2.boundingRect(cnt)

            if w > 20 and h > 20:
#                 cv2.drawContours(img, [cnt], -1, (255, 0, 0), -1)
                cv2.rectangle(img, (x,y), (x+w,y+h), (0,255,0), 2)
#                 (x,y,w,h) = cv2.boundingRect(cnt)
                       
                x1=w/2
                y1=h/2
                cx=x+x1
                cy=y+y1
                a.append([cx,cy])


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source