Jelajahi Sumber

[fix] Labels hopefully no longer off screen

Clemens-Alexander Brust 9 tahun lalu
induk
melakukan
14935829b5
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 2 1
      src/AnnotatedImageView.cpp

+ 2 - 1
src/AnnotatedImageView.cpp

@@ -57,6 +57,7 @@ void AnnotatedImageView::DisplayImage(std::string filename, std::vector<Conv::Bo
     if(box.x < x1) x1 = box.x;
     if(box.x + box.w > x2) x2 = box.x + box.w;
     if(box.y < y1) y1 = box.y;
+    if(box.y + box.h > y2) y2 = box.y + box.h;
 
     // Print class label
     QString class_name = QString::fromStdString(class_manager->GetClassInfoById(box.c).first);
@@ -81,7 +82,7 @@ void AnnotatedImageView::DisplayImage(std::string filename, std::vector<Conv::Bo
   }
 
   if(image_->width() >= 800) {
-    const qreal border = 35;
+    const qreal border = 85;
     QRectF bounding_rect(x1 - border, y1 - border, (2.0 * border) + x2 - x1, (2.0 * border) + y2 - y1);
     rect_ = bounding_rect;
     RefitDisplay();