turn on or off visualization function with a check box

This commit is contained in:
Yonghye Kwon 2023-01-10 21:32:09 +09:00
parent 7796b8606d
commit cc3a188275
4 changed files with 14 additions and 14 deletions

View File

@ -80,6 +80,7 @@ void label_img::init()
{
m_objBoundingBoxes.clear();
m_bLabelingStarted = false;
m_bVisualizeClassName = false;
m_focusedObjectLabel = 0;
QPoint mousePosInUi = this->mapFromGlobal(QCursor::pos());
@ -159,7 +160,7 @@ void label_img::showImage()
QPainter painter(&img);
QFont font = painter.font();
int fontSize = 14, xMargin = 5, yMargin = 2;
int fontSize = 16, xMargin = 5, yMargin = 2;
font.setPixelSize(fontSize);
font.setBold(true);
painter.setFont(font);
@ -171,6 +172,7 @@ void label_img::showImage()
drawCrossLine(painter, crossLineColor, penThick);
drawFocusedObjectBox(painter, Qt::magenta, penThick);
drawObjectBoxes(painter, penThick);
if(m_bVisualizeClassName)
drawObjectLabels(painter, penThick, fontSize, xMargin, yMargin);
this->setPixmap(QPixmap::fromImage(img));

View File

@ -34,6 +34,7 @@ public:
int m_imgY;
bool m_bLabelingStarted;
bool m_bVisualizeClassName;
static QColor BOX_COLORS[10];

View File

@ -198,7 +198,7 @@ void MainWindow::remove_img()
}
else if( m_imgIndex == m_imgList.size())
{
m_imgIndex --;
m_imgIndex--;
}
goto_img(m_imgIndex);
@ -361,11 +361,6 @@ void MainWindow::open_obj_file(bool& ret)
}
}
void MainWindow::reupdate_img_list()
{
}
void MainWindow::wheelEvent(QWheelEvent *ev)
{
if(ev->angleDelta().y() > 0) // up Wheel
@ -480,3 +475,9 @@ void MainWindow::on_horizontalSlider_contrast_sliderMoved(int value)
ui->label_image->setContrastGamma(percentageToGamma);
ui->label_contrast->setText(QString("Contrast(%) ") + QString::number(int(valueToPercentage * 100.)));
}
void MainWindow::on_checkBox_visualize_class_name_clicked(bool checked)
{
ui->label_image->m_bVisualizeClassName = checked;
ui->label_image->showImage();
}

View File

@ -23,10 +23,6 @@ public:
private slots:
void on_pushButton_open_files_clicked();
// void on_pushButton_change_dir_clicked();
// void on_pushButton_save_clicked();
// void on_pushButton_remove_clicked();
void on_pushButton_prev_clicked();
void on_pushButton_next_clicked();
@ -48,6 +44,8 @@ private slots:
void on_horizontalSlider_contrast_sliderMoved(int value);
void on_checkBox_visualize_class_name_clicked(bool checked);
private:
void init();
void init_table_widget();
@ -71,8 +69,6 @@ private:
void open_img_dir(bool&);
void open_obj_file(bool&);
void reupdate_img_list();
Ui::MainWindow *ui;
QString m_imgDir;