how do you find the coordinates of the center of each rectangle
vector<vector> contours;
vector hierarchy;
findContours(canny, contours, hierarchy, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);
vector<Rect> bounders;
for (int i = 0; i < contours.size(); i++) {
int area = contourArea(contours[i]);
if (area < max_area && area > min_area) {
bounders.push_back(boundingRect(contours[i]));
}
}
Mat imgBox = imgRgb.clone();
for (int i = 0; i < bounders.size(); i++) {
Rect r1 = bounders[i];
rectangle(imgBox, bounders[i], Scalar(0, 0, 255), 2);
circle(imgBox, Point(bounders[i].x + bounders[i].width / 2, bounders[i].y + bounders[i].height / 2), 10, Scalar(0, 0, 255), 2);
}