OpenCV_ of sort_box

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;
			}
		}
	}
}
Published 18 original articles · won praise 12 · views 409

Guess you like

Origin blog.csdn.net/qq_41408585/article/details/104465174