Fix bug: label index initialize
This commit is contained in:
parent
5207955be6
commit
8f1e2f327f
@ -82,7 +82,6 @@ void label_img::mouseReleaseEvent(QMouseEvent *ev)
|
|||||||
void label_img::init()
|
void label_img::init()
|
||||||
{
|
{
|
||||||
m_objBoundingBoxes.clear();
|
m_objBoundingBoxes.clear();
|
||||||
|
|
||||||
m_bLabelingStarted = false;
|
m_bLabelingStarted = false;
|
||||||
m_focusedObjectLabel = 0;
|
m_focusedObjectLabel = 0;
|
||||||
|
|
||||||
@ -115,7 +114,20 @@ void label_img::openImage(const QString &qstrImg)
|
|||||||
m_inputImg = QImage(qstrImg);
|
m_inputImg = QImage(qstrImg);
|
||||||
m_inputImg = m_inputImg.convertToFormat(QImage::Format_RGB888);
|
m_inputImg = m_inputImg.convertToFormat(QImage::Format_RGB888);
|
||||||
|
|
||||||
init();
|
m_objBoundingBoxes.clear();
|
||||||
|
m_bLabelingStarted = false;
|
||||||
|
|
||||||
|
QPoint mousePosInUi = this->mapFromGlobal(QCursor::pos());
|
||||||
|
bool mouse_is_in_image = QRect(0, 0, this->width(), this->height()).contains(mousePosInUi);
|
||||||
|
|
||||||
|
if (mouse_is_in_image)
|
||||||
|
{
|
||||||
|
setMousePosition(mousePosInUi.x(), mousePosInUi.y());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setMousePosition(0., 0.);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void label_img::showImage()
|
void label_img::showImage()
|
||||||
|
3
main.cpp
3
main.cpp
@ -6,6 +6,7 @@ int main(int argc, char *argv[])
|
|||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ void MainWindow::on_pushButton_open_files_clicked()
|
|||||||
|
|
||||||
load_label_list_data(fileLabelList);
|
load_label_list_data(fileLabelList);
|
||||||
|
|
||||||
|
ui->label_image->init();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,6 +278,7 @@ void MainWindow::set_label(int labelIndex)
|
|||||||
|
|
||||||
if(!indexIsOutOfRange)
|
if(!indexIsOutOfRange)
|
||||||
{
|
{
|
||||||
|
std::cout << "m_labelIndex = "<< m_labelIndex << std::endl;
|
||||||
m_labelIndex = labelIndex;
|
m_labelIndex = labelIndex;
|
||||||
ui->label_image->setFocusObjectLabel(m_labelIndex);
|
ui->label_image->setFocusObjectLabel(m_labelIndex);
|
||||||
ui->label_image->setFocusObjectName(m_labelNameList.at(m_labelIndex));
|
ui->label_image->setFocusObjectName(m_labelNameList.at(m_labelIndex));
|
||||||
|
Loading…
Reference in New Issue
Block a user