fixed value initialize bug

This commit is contained in:
yonghye 2018-10-30 12:28:13 +09:00
parent d15a1d3ed5
commit d77ac01b76
5 changed files with 13 additions and 20 deletions

View File

@ -96,12 +96,14 @@ void label_img::setMousePosition(int x, int y)
void label_img::openImage(const QString &qstrImg) void label_img::openImage(const QString &qstrImg)
{ {
m_inputImg = QImage(qstrImg); m_inputImg = QImage(qstrImg);
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_aspectRatioWidth = static_cast<double>(m_inputImg.width()) / this->width();
m_aspectRatioHeight = static_cast<double>(m_inputImg.height()) / this->height(); m_aspectRatioHeight = static_cast<double>(m_inputImg.height()) / this->height();
m_objBoundingBoxes.clear(); m_objBoundingBoxes.clear();
m_drawObjectBoxColor.clear();
m_objStartPoint = QPoint(); m_objStartPoint = QPoint();

View File

@ -73,9 +73,9 @@ private:
void drawFocusedObjectBox(QPainter& , Qt::GlobalColor , int thickWidth = 3); void drawFocusedObjectBox(QPainter& , Qt::GlobalColor , int thickWidth = 3);
void drawObjectBoxes(QPainter& , int thickWidth = 3); void drawObjectBoxes(QPainter& , int thickWidth = 3);
void removeFocusedObjectBox(QPoint point); void removeFocusedObjectBox(QPoint);
QRect getRectFromTwoPoints(QPoint p1, QPoint p2); QRect getRectFromTwoPoints(QPoint , QPoint);
}; };

View File

@ -212,6 +212,10 @@ void MainWindow::load_label_list_data(QString qstrLabelListFile)
if(inputLabelListFile.is_open()) if(inputLabelListFile.is_open())
{ {
for(int i = 0 ; i <= ui->tableWidget_label->rowCount(); i++)
ui->tableWidget_label->removeRow(ui->tableWidget_label->currentRow());
m_labelNameList.clear(); m_labelNameList.clear();
string strLabel; string strLabel;
@ -221,7 +225,7 @@ void MainWindow::load_label_list_data(QString qstrLabelListFile)
while(inputLabelListFile >> strLabel) while(inputLabelListFile >> strLabel)
{ {
int nRow = ui->tableWidget_label->rowCount(); int nRow = ui->tableWidget_label->rowCount();
std::cout << nRow << endl;
QString qstrLabel = QString().fromStdString(strLabel); QString qstrLabel = QString().fromStdString(strLabel);
QColor labelColor = label_img::BOX_COLORS[(fileIndex++)%10]; QColor labelColor = label_img::BOX_COLORS[(fileIndex++)%10];
m_labelNameList << qstrLabel; m_labelNameList << qstrLabel;
@ -339,14 +343,6 @@ void MainWindow::mouseReleased()
} }
void MainWindow::on_horizontalSlider_images_valueChanged(int value)
{
// cout<<"kiff"<<endl;
// save_label_data(); //prev data save
// goto_img(value);
}
void MainWindow::on_pushButton_save_clicked() void MainWindow::on_pushButton_save_clicked()
{ {
save_label_data(); save_label_data();
@ -379,5 +375,4 @@ void MainWindow::on_horizontalSlider_images_sliderMoved(int position)
void MainWindow::on_horizontalSlider_images_sliderPressed() void MainWindow::on_horizontalSlider_images_sliderPressed()
{ {
//save_label_data(); //prev data save
} }

View File

@ -27,12 +27,9 @@ private slots:
void on_pushButton_open_files_clicked(); void on_pushButton_open_files_clicked();
void on_pushButton_save_clicked(); void on_pushButton_save_clicked();
void on_pushButton_prev_clicked(); void on_pushButton_prev_clicked();
void on_pushButton_next_clicked(); void on_pushButton_next_clicked();
void on_horizontalSlider_images_valueChanged(int value);
void keyPressEvent(QKeyEvent *); void keyPressEvent(QKeyEvent *);
void mouseCurrentPos(); void mouseCurrentPos();
@ -51,7 +48,6 @@ private slots:
void on_tableWidget_label_cellClicked(int row, int column); void on_tableWidget_label_cellClicked(int row, int column);
void on_horizontalSlider_images_sliderMoved(int position); void on_horizontalSlider_images_sliderMoved(int position);
void on_horizontalSlider_images_sliderPressed(); void on_horizontalSlider_images_sliderPressed();
private: private:

View File

@ -32,7 +32,7 @@
<enum>Qt::StrongFocus</enum> <enum>Qt::StrongFocus</enum>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Image Labeling Tool</string> <string>YoloLabel</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color : rgb(0, 0, 17);</string> <string notr="true">background-color : rgb(0, 0, 17);</string>
@ -284,10 +284,10 @@ QSlider::handle:horizontal {
<number>0</number> <number>0</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>10</number> <number>0</number>
</property> </property>
<property name="tracking"> <property name="tracking">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -635,7 +635,7 @@ QTableView {
<bool>true</bool> <bool>true</bool>
</attribute> </attribute>
<attribute name="horizontalHeaderHighlightSections"> <attribute name="horizontalHeaderHighlightSections">
<bool>true</bool> <bool>false</bool>
</attribute> </attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0"> <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>true</bool> <bool>true</bool>