Small updates.

This commit is contained in:
Daniel
2025-02-11 11:26:58 +01:00
parent 2c994eca44
commit 651b806a3a
2 changed files with 12 additions and 13 deletions

View File

@ -486,16 +486,16 @@ namespace utils_2d_pose
float new_end_yf = center_y + 0.5f * adjusted_h;
// Round the box coordinates
int start_x_i = static_cast<int>(std::floor(new_start_xf));
int start_y_i = static_cast<int>(std::floor(new_start_yf));
int end_x_i = static_cast<int>(std::ceil(new_end_xf));
int end_y_i = static_cast<int>(std::ceil(new_end_yf));
int start_xi = static_cast<int>(std::floor(new_start_xf));
int start_yi = static_cast<int>(std::floor(new_start_yf));
int end_xi = static_cast<int>(std::ceil(new_end_xf));
int end_yi = static_cast<int>(std::ceil(new_end_yf));
// Define the new box coordinates
int new_start_x = std::max(0, start_x_i);
int new_start_y = std::max(0, start_y_i);
int new_end_x = std::min(img_w - 1, end_x_i);
int new_end_y = std::min(img_h - 1, end_y_i);
int new_start_x = std::max(0, start_xi);
int new_start_y = std::max(0, start_yi);
int new_end_x = std::min(img_w - 1, end_xi);
int new_end_y = std::min(img_h - 1, end_yi);
std::array<int, 4> new_box{new_start_x, new_start_y, new_end_x, new_end_y};
// Calculate resized crop size
@ -516,12 +516,12 @@ namespace utils_2d_pose
int pad_bottom = 0;
if (pad_w > 0)
{
if (start_x_i < 0)
if (start_xi < 0)
{
pad_left = pad_w;
pad_right = 0;
}
else if (end_x_i > img_w)
else if (end_xi > img_w)
{
pad_left = 0;
pad_right = pad_w;
@ -535,12 +535,12 @@ namespace utils_2d_pose
}
if (pad_h > 0)
{
if (start_y_i < 0)
if (start_yi < 0)
{
pad_top = pad_h;
pad_bottom = 0;
}
else if (end_y_i > img_h)
else if (end_yi > img_h)
{
pad_top = 0;
pad_bottom = pad_h;