From f442f88d064dd2e7a474b53e69eb508f590000d5 Mon Sep 17 00:00:00 2001 From: yonghye Date: Tue, 6 Nov 2018 20:31:30 +0900 Subject: [PATCH] Change Coordinate system: Absolute to Relative --- label_img.cpp | 13 ------------- label_img.h | 3 +-- mainwindow.cpp | 1 - 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/label_img.cpp b/label_img.cpp index 86e2f2b..27e98d7 100644 --- a/label_img.cpp +++ b/label_img.cpp @@ -264,19 +264,6 @@ void label_img::removeFocusedObjectBox(QPointF point) } } -QRect label_img::getAbsoluteRectFromTwoPoints(QPoint p1, QPoint p2) -{ - int midX = (p1.x() + p2.x()) / 2; - int midY = (p1.y() + p2.y()) / 2; - int width = abs(p1.x() - p2.x()); - int height = abs(p1.y() - p2.y()); - - QPoint topLeftPoint(midX - width/2, midY - height/2); - QPoint bottomRightPoint(midX + width/2, midY + height/2); - - return QRect(topLeftPoint, bottomRightPoint); -} - QRectF label_img::getRelativeRectFromTwoPoints(QPointF p1, QPointF p2) { double midX = (p1.x() + p2.x()) / 2.; diff --git a/label_img.h b/label_img.h index a587617..6c6c34b 100644 --- a/label_img.h +++ b/label_img.h @@ -48,13 +48,12 @@ public: QImage crop(QRect); - QRect getAbsoluteRectFromTwoPoints(QPoint , QPoint); QRectF getRelativeRectFromTwoPoints(QPointF , QPointF); QRect cvtRelativeToAbsoluteRectInUi(QRectF); QRect cvtRelativeToAbsoluteRectInImage(QRectF); - QPoint cvtRelativeToAbsolutePoint(QPointF); + QPoint cvtRelativeToAbsolutePoint(QPointF); QPointF cvtAbsoluteToRelativePoint(QPoint); signals: diff --git a/mainwindow.cpp b/mainwindow.cpp index abde9b8..3a66293 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -81,7 +81,6 @@ void MainWindow::on_pushButton_open_files_clicked() m_fileList = fileList; for(QString& str: m_fileList) str = m_fileDir + "/" + str; - load_label_list_data(fileLabelList); init();