I'm trying to get the pixel's values and their x and y coordinate inside the bounding box of objects.
here's my part of the code :
vector<Detector::Object> detected_objects;
for (int i = 0; i < detected_objects.size(); ++i) {
int xmin = detected_objects[i].rect.x;
int ymin = detected_objects[i].rect.y;
int width = detected_objects[i].rect.width;
int height = detected_objects[i].rect.height;
Rect rect(xmin, ymin, width, height); //The upper left coordinates (x, y) and the length (x) and width (y) of the rectangle
cv::rectangle(osrc, rect, Scalar(200, 200, 10), 1, LINE_8, 0); // set rectangle color
// std::cout << "\n coord: \n" << rect;
//std::cout << "# of contour points: " << rect.size() << std::endl;
int xmax = xmin + width;
int ymax = ymin + height;
for (size_t x = xmin; x < xmax; x++)
{
for (size_t y = ymin; y < ymax; y++)
{
}
}
}
Any help is appreciated!