For example, in the defect detection, the detection target generally will be sorted, in order to better operating side;
related code and paste renderings following:
void sort_box(vector<Rect> &boxes)
{
int size = boxes.size();
for(int t = 0; t < size - 1; t++)
{
for(int j = i; j < size; j++)
{
int x = boxes[j].x;
int y = boxes[j].y;
if(y < boxes[i].y)
{
Rect temp = boxes[i];
boxes[i] = boxes[j];
boxes[j] = temp;
}
}
}
}