add shortcut to remove image
This commit is contained in:
parent
e002e18a16
commit
c78ca56787
@ -102,6 +102,7 @@ To minimize wrist strain when labeling, I adopted the method **"twice left butto
|
|||||||
| `W` | Prev Label <br> ![ezgif-5-ee915c66dad8](https://user-images.githubusercontent.com/35001605/47703191-d39d3080-dc62-11e8-800b-986ec214b80c.gif) |
|
| `W` | Prev Label <br> ![ezgif-5-ee915c66dad8](https://user-images.githubusercontent.com/35001605/47703191-d39d3080-dc62-11e8-800b-986ec214b80c.gif) |
|
||||||
| `Ctrl + S` | Save |
|
| `Ctrl + S` | Save |
|
||||||
| `Ctrl + C` | Delete all existing bounding boxes in the image |
|
| `Ctrl + C` | Delete all existing bounding boxes in the image |
|
||||||
|
| `Ctrl + D` | Delete current image |
|
||||||
|
|
||||||
| Mouse | Action |
|
| Mouse | Action |
|
||||||
|---|:---:|
|
|---|:---:|
|
||||||
|
@ -29,6 +29,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(new QShortcut(QKeySequence(Qt::Key_A), this), SIGNAL(activated()), this, SLOT(prev_img()));
|
connect(new QShortcut(QKeySequence(Qt::Key_A), this), SIGNAL(activated()), this, SLOT(prev_img()));
|
||||||
connect(new QShortcut(QKeySequence(Qt::Key_D), this), SIGNAL(activated()), this, SLOT(next_img()));
|
connect(new QShortcut(QKeySequence(Qt::Key_D), this), SIGNAL(activated()), this, SLOT(next_img()));
|
||||||
connect(new QShortcut(QKeySequence(Qt::Key_Space), this), SIGNAL(activated()), this, SLOT(next_img()));
|
connect(new QShortcut(QKeySequence(Qt::Key_Space), this), SIGNAL(activated()), this, SLOT(next_img()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_D), this), SIGNAL(activated()), this, SLOT(remove_img()));
|
||||||
|
|
||||||
init_table_widget();
|
init_table_widget();
|
||||||
}
|
}
|
||||||
@ -182,6 +183,32 @@ void MainWindow::clear_label_data()
|
|||||||
ui->label_image->showImage();
|
ui->label_image->showImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::remove_img()
|
||||||
|
{
|
||||||
|
if(m_imgList.size() > 0) {
|
||||||
|
//remove a image
|
||||||
|
QFile::remove(m_imgList.at(m_imgIndex));
|
||||||
|
|
||||||
|
//remove a txt file
|
||||||
|
QString qstrOutputLabelData = get_labeling_data(m_imgList.at(m_imgIndex));
|
||||||
|
QFile::remove(qstrOutputLabelData);
|
||||||
|
|
||||||
|
m_imgList.removeAt(m_imgIndex);
|
||||||
|
|
||||||
|
if(m_imgList.size() == 0)
|
||||||
|
{
|
||||||
|
pjreddie_style_msgBox(QMessageBox::Information,"End", "In directory, there are not any image. program quit.");
|
||||||
|
QCoreApplication::quit();
|
||||||
|
}
|
||||||
|
else if( m_imgIndex == m_imgList.size())
|
||||||
|
{
|
||||||
|
m_imgIndex --;
|
||||||
|
}
|
||||||
|
|
||||||
|
goto_img(m_imgIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::next_label()
|
void MainWindow::next_label()
|
||||||
{
|
{
|
||||||
set_label(m_objIndex + 1);
|
set_label(m_objIndex + 1);
|
||||||
@ -377,26 +404,7 @@ void MainWindow::on_pushButton_save_clicked()
|
|||||||
|
|
||||||
void MainWindow::on_pushButton_remove_clicked()
|
void MainWindow::on_pushButton_remove_clicked()
|
||||||
{
|
{
|
||||||
//remove a image
|
remove_img();
|
||||||
QFile::remove(m_imgList.at(m_imgIndex));
|
|
||||||
|
|
||||||
//remove a txt file
|
|
||||||
QString qstrOutputLabelData = get_labeling_data(m_imgList.at(m_imgIndex));
|
|
||||||
QFile::remove(qstrOutputLabelData);
|
|
||||||
|
|
||||||
m_imgList.removeAt(m_imgIndex);
|
|
||||||
|
|
||||||
if(m_imgList.size() == 0)
|
|
||||||
{
|
|
||||||
pjreddie_style_msgBox(QMessageBox::Information,"End", "In directory, there are not any image. program quit.");
|
|
||||||
QCoreApplication::quit();
|
|
||||||
}
|
|
||||||
else if( m_imgIndex == m_imgList.size())
|
|
||||||
{
|
|
||||||
m_imgIndex --;
|
|
||||||
}
|
|
||||||
|
|
||||||
goto_img(m_imgIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_tableWidget_label_cellDoubleClicked(int row, int column)
|
void MainWindow::on_tableWidget_label_cellDoubleClicked(int row, int column)
|
||||||
|
@ -36,6 +36,7 @@ private slots:
|
|||||||
void prev_img(bool bSavePrev = true);
|
void prev_img(bool bSavePrev = true);
|
||||||
void save_label_data() const;
|
void save_label_data() const;
|
||||||
void clear_label_data();
|
void clear_label_data();
|
||||||
|
void remove_img();
|
||||||
|
|
||||||
void next_label();
|
void next_label();
|
||||||
void prev_label();
|
void prev_label();
|
||||||
|
Loading…
Reference in New Issue
Block a user