4 Commits

Author SHA1 Message Date
520e6f8815 command yolo-label 2022-08-29 22:52:31 +09:00
160a8cc3e8 Merge pull request #51 from kir19890817/fix-compile-for-ubuntu-20
fix: compile
2022-02-17 19:29:16 +09:00
e642436651 fix: compile 2022-01-29 08:10:48 +01:00
4606381495 Update download link v1.1.1 2021-11-30 01:00:41 +09:00
5 changed files with 64 additions and 6 deletions

View File

@ -54,7 +54,7 @@ But... I've reinvented one...
### For Windows
2. Download [YOLOLabel_20211126_v1.0](https://github.com/developer0hye/Yolo_Label/releases/download/v1.0.0/YoloLabel_v1.0.0.zip)
2. Download [YOLOLabel_20211130_v1.1.1](https://github.com/developer0hye/Yolo_Label/releases/download/v1.1.1/YoloLabel_v1.1.1.zip)
3. Unzip

View File

@ -20,7 +20,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11
CONFIG += c++1z
SOURCES += \
main.cpp \

View File

@ -4,7 +4,7 @@
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
MainWindow w(nullptr, argc, argv);
w.show();
return a.exec();
}

View File

@ -8,6 +8,7 @@
#include <QShortcut>
#include <QCollator>
#include <iomanip>
#include <cmath>
using std::cout;
using std::endl;
@ -15,7 +16,7 @@ using std::ofstream;
using std::ifstream;
using std::string;
MainWindow::MainWindow(QWidget *parent) :
MainWindow::MainWindow(QWidget *parent, int argc, char *argv[]) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
@ -33,6 +34,15 @@ MainWindow::MainWindow(QWidget *parent) :
connect(new QShortcut(QKeySequence(Qt::Key_Delete), this), SIGNAL(activated()), this, SLOT(remove_img()));
init_table_widget();
if(argc == 3)
{
std::cout << "Dataset Path: " << argv[1] << std::endl;
std::cout << "Label List File Path: " << argv[2] << std::endl;
open_img_dir(argv[1]);
open_obj_file(argv[2]);
init();
}
}
MainWindow::~MainWindow()
@ -333,6 +343,33 @@ void MainWindow::open_img_dir(bool& ret)
}
}
void MainWindow::open_img_dir(char* img_dir)
{
QString imgDir(img_dir);
QDir dir(imgDir);
QCollator collator;
collator.setNumericMode(true);
QStringList fileList = dir.entryList(
QStringList() << "*.jpg" << "*.JPG" << "*.png" << "*.bmp",
QDir::Files);
std::sort(fileList.begin(), fileList.end(), collator);
if(fileList.empty())
{
pjreddie_style_msgBox(QMessageBox::Critical,"Error", "This folder is empty");
}
else
{
m_imgDir = imgDir;
m_imgList = fileList;
for(QString& str: m_imgList)
str = m_imgDir + "/" + str;
}
}
void MainWindow::open_obj_file(bool& ret)
{
pjreddie_style_msgBox(QMessageBox::Information,"Help", "Step 2. Open Your Label List File(*.txt or *.names)");
@ -359,6 +396,24 @@ void MainWindow::open_obj_file(bool& ret)
}
}
void MainWindow::open_obj_file(char* file)
{
QString opened_dir;
if(m_imgDir.size() > 0) opened_dir = m_imgDir;
else opened_dir = QDir::currentPath();
QString fileLabelList(file);
if(fileLabelList.size() == 0)
{
pjreddie_style_msgBox(QMessageBox::Critical,"Error", "LabelList file is not opened()");
}
else
{
load_label_list_data(fileLabelList);
}
}
void MainWindow::reupdate_img_list()
{
@ -473,7 +528,7 @@ void MainWindow::init_table_widget()
void MainWindow::on_horizontalSlider_contrast_sliderMoved(int value)
{
float valueToPercentage = float(value)/ui->horizontalSlider_contrast->maximum(); //[0, 1.0]
float percentageToGamma = pow(1/(valueToPercentage + 0.5), 7.);
float percentageToGamma = std::pow(1/(valueToPercentage + 0.5), 7.);
ui->label_image->setContrastGamma(percentageToGamma);
ui->label_contrast->setText(QString("Contrast(%) ") + QString::number(int(valueToPercentage * 100.)));

View File

@ -18,7 +18,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
explicit MainWindow(QWidget *parent = nullptr, int argc=0, char *argv[]=nullptr);
~MainWindow();
private slots:
@ -71,6 +71,9 @@ private:
void open_img_dir(bool&);
void open_obj_file(bool&);
void open_img_dir(char *);
void open_obj_file(char *);
void reupdate_img_list();
Ui::MainWindow *ui;