68 lines
1.8 KiB
C++
68 lines
1.8 KiB
C++
#include <qwidget.h>
|
|||
|
|
#include <qlayout.h>
|
||
|
|
#include <qlineedit.h>
|
||
|
|
#include <opencv.hpp>
|
||
|
|
#include <qlabel.h>
|
||
|
|
#include <fileManager.h>
|
||
|
|
static class fileReadSys
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
QWidget* widget;
|
||
|
|
QVBoxLayout* layout;
|
||
|
|
std::vector<int> indexVec;
|
||
|
|
fileReadSys(int count)
|
||
|
|
{
|
||
|
|
widget = new QWidget();
|
||
|
|
layout = new QVBoxLayout();
|
||
|
|
widget->setLayout(layout);
|
||
|
|
for (auto i = 0; i < count; i++)
|
||
|
|
{
|
||
|
|
QLabel* label1 = new QLabel(u8"Îļþ¶ÁÈ¡"+QString::number(i));
|
||
|
|
label1->setStyleSheet("font-size: 16px;");
|
||
|
|
QLineEdit *lineEdit = new QLineEdit();
|
||
|
|
QLabel* label2 = new QLabel(u8"µØÖ·");
|
||
|
|
layout->addWidget(label1);
|
||
|
|
QHBoxLayout*layout2 = new QHBoxLayout();
|
||
|
|
layout2->addWidget(label2);
|
||
|
|
layout2->addWidget(lineEdit);
|
||
|
|
layout->addLayout(layout2);
|
||
|
|
indexVec.push_back(0);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
fileReadSys(std::vector<QString>names)
|
||
|
|
{
|
||
|
|
widget = new QWidget();
|
||
|
|
layout = new QVBoxLayout();
|
||
|
|
widget->setLayout(layout);
|
||
|
|
for (auto i = 0; i < names.size(); i++)
|
||
|
|
{
|
||
|
|
QLabel* label1 = new QLabel(names[i]);
|
||
|
|
label1->setStyleSheet("font-size: 16px;");
|
||
|
|
QLineEdit* lineEdit = new QLineEdit();
|
||
|
|
QLabel* label2 = new QLabel(u8"µØÖ·");
|
||
|
|
layout->addWidget(label1);
|
||
|
|
QHBoxLayout* layout2 = new QHBoxLayout();
|
||
|
|
layout2->addWidget(label2);
|
||
|
|
layout2->addWidget(lineEdit);
|
||
|
|
layout->addLayout(layout2);
|
||
|
|
indexVec.push_back(0);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
QString getpath(int index)
|
||
|
|
{
|
||
|
|
QList<QLineEdit*> list = widget->findChildren<QLineEdit*>();
|
||
|
|
return list[index]->text();
|
||
|
|
}
|
||
|
|
cv::Mat getMat(int index)
|
||
|
|
{
|
||
|
|
QList<QLineEdit*> list = widget->findChildren<QLineEdit*>();
|
||
|
|
std::vector<std::string>files;
|
||
|
|
fileManager::getAllFiles(list[index]->text().toStdString(), files,"bmp");
|
||
|
|
if (files.size() == 0)
|
||
|
|
return cv::Mat(1,1,CV_8UC1,cv::Scalar(255,255,255));
|
||
|
|
cv::Mat img = cv::imread(files[indexVec[index]],-1);
|
||
|
|
indexVec[index]++;
|
||
|
|
return img;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
#pragma once
|