Bug fix: Ui resize
This commit is contained in:
parent
6f593bba38
commit
b411e35ccb
@ -86,6 +86,9 @@ void label_img::setMousePosition(int x, int y)
|
|||||||
if(x > this->width()) x = this->width() - 1;
|
if(x > this->width()) x = this->width() - 1;
|
||||||
if(y > this->height()) y = this->height() - 1;
|
if(y > this->height()) y = this->height() - 1;
|
||||||
|
|
||||||
|
m_aspectRatioWidth = static_cast<double>(m_inputImg.width()) / this->width();
|
||||||
|
m_aspectRatioHeight = static_cast<double>(m_inputImg.height()) / this->height();
|
||||||
|
|
||||||
m_mouse_pos_in_image_coordinate = QPoint(static_cast<int>(x * m_aspectRatioWidth + 0.5),
|
m_mouse_pos_in_image_coordinate = QPoint(static_cast<int>(x * m_aspectRatioWidth + 0.5),
|
||||||
static_cast<int>(y * m_aspectRatioHeight + 0.5));
|
static_cast<int>(y * m_aspectRatioHeight + 0.5));
|
||||||
}
|
}
|
||||||
@ -96,9 +99,6 @@ void label_img::openImage(const QString &qstrImg)
|
|||||||
m_inputImg = m_inputImg.convertToFormat(QImage::Format_RGB888);
|
m_inputImg = m_inputImg.convertToFormat(QImage::Format_RGB888);
|
||||||
m_inputImgCopy = m_inputImg;
|
m_inputImgCopy = m_inputImg;
|
||||||
|
|
||||||
m_aspectRatioWidth = static_cast<double>(m_inputImg.width()) / this->width();
|
|
||||||
m_aspectRatioHeight = static_cast<double>(m_inputImg.height()) / this->height();
|
|
||||||
|
|
||||||
m_objBoundingBoxes.clear();
|
m_objBoundingBoxes.clear();
|
||||||
|
|
||||||
m_leftButtonClickedPoint = QPoint();
|
m_leftButtonClickedPoint = QPoint();
|
||||||
@ -155,10 +155,10 @@ void label_img::loadLabelData(const QString& labelFilePath)
|
|||||||
ObjectLabelingBox objBox;
|
ObjectLabelingBox objBox;
|
||||||
objBox.label = static_cast<int>(inputFileValues.at(i));
|
objBox.label = static_cast<int>(inputFileValues.at(i));
|
||||||
|
|
||||||
double midX = inputFileValues.at(i + 1) * m_inputImg.width();
|
double midX = inputFileValues.at(i + 1) * m_inputImg.width();
|
||||||
double midY = inputFileValues.at(i + 2) * m_inputImg.height();
|
double midY = inputFileValues.at(i + 2) * m_inputImg.height();
|
||||||
double width = inputFileValues.at(i + 3) * m_inputImg.width();
|
double width = inputFileValues.at(i + 3) * m_inputImg.width();
|
||||||
double height = inputFileValues.at(i + 4) * m_inputImg.height();
|
double height = inputFileValues.at(i + 4) * m_inputImg.height();
|
||||||
|
|
||||||
|
|
||||||
std::cout << "midX: " << midX << std::endl;
|
std::cout << "midX: " << midX << std::endl;
|
||||||
|
@ -24,7 +24,6 @@ public:
|
|||||||
void mousePressEvent(QMouseEvent *ev);
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
void mouseReleaseEvent(QMouseEvent *ev);
|
void mouseReleaseEvent(QMouseEvent *ev);
|
||||||
|
|
||||||
|
|
||||||
QImage m_inputImg;
|
QImage m_inputImg;
|
||||||
QImage m_inputImgCopy;//for drawing
|
QImage m_inputImgCopy;//for drawing
|
||||||
|
|
||||||
|
@ -21,8 +21,6 @@ public:
|
|||||||
explicit MainWindow(QWidget *parent = nullptr);
|
explicit MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButton_open_files_clicked();
|
void on_pushButton_open_files_clicked();
|
||||||
void on_pushButton_save_clicked();
|
void on_pushButton_save_clicked();
|
||||||
|
Loading…
Reference in New Issue
Block a user