78 return std::pair<int, int>(centerX, centerY);
93 outbox.
xmin = center.first - newW / 2;
94 outbox.
xmax = center.first + newW / 2;
95 outbox.
ymin = center.second - newH / 2;
96 outbox.
ymax = center.second + newH / 2;
115 throw std::range_error(
"Invalid bounding box generated\n");
117 float scaleW =
static_cast<float>(std::max(w, h)) / w;
118 float scaleH =
static_cast<float>(std::max(w, h)) / h;
119 BBox scaledBBox = clampedBox1.
scale(scaleW, scaleH);
120 BBox clampedBox2 = scaledBBox.
clamp(clampBox);
123 throw std::range_error(
"Invalid bounding box generated\n");
125 size_t newW = clampedBox2.
getWidth();
127 size_t minW = std::min(newH, newW);
128 clampedBox2.
ymax = clampedBox2.
ymin + minW;
129 clampedBox2.
xmax = clampedBox2.
xmin + minW;
135 #endif // CVCORE_BBOX_H