Change Coordinate system: Absolute to Relative

This commit is contained in:
yonghye 2018-11-06 20:31:30 +09:00
parent 25bc781e66
commit f442f88d06
3 changed files with 1 additions and 16 deletions

View File

@ -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.;

View File

@ -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:

View File

@ -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();