修改一下默认路径

main
Jeffrey_Li 2 years ago
parent a6da5c3b77
commit 20165d19d2

@ -25,17 +25,15 @@ static std::vector<std::string> classes;
bool AlgJd::init(QString path_model, QString path_jpg)
{
// Load names of classes
std::string classesFile = "D:/model/jd.names";
std::string classesFile = "../model/jd.names";
// Give the configuration and weight files for the model
cv::String modelConfiguration = "D:/model/jd.cfg";
cv::String modelWeights;
cv::String modelConfiguration = "../model/jd.cfg";
cv::String modelWeights = "../model/jd.weights";
if (path_model.length() > 0) {
modelWeights = path_model.toStdString();
}
else {
modelWeights = "D:/model/jd.weights";
classesFile = path_model.toStdString() + "/jd.names";
modelConfiguration = path_model.toStdString() + "/jd.cfg";
modelWeights = path_model.toStdString() + "/jd.weights";
}
std::ifstream classNamesFile(classesFile.c_str());
@ -54,15 +52,16 @@ bool AlgJd::init(QString path_model, QString path_jpg)
net.setPreferableBackend(cv::dnn::DNN_BACKEND_CUDA);
net.setPreferableTarget(cv::dnn::DNN_TARGET_CUDA);
//cv::Mat image = cv::imread("alg_jd.jpg");
cv::Mat image;
if (path_jpg.length() > 0) {
image = cv::imread(path_jpg.toStdString());
}
else {
image = cv::imread("D:/Release/alg_jd.bmp");
image = cv::imread("alg_jd.bmp");
}
//识别一张图测试模型是否正确并且完成GPU数据加载
if (!image.data) return false; //判断测试图片是否正常读取
std::vector<std::pair<int, cv::Rect> > results;

@ -1895,7 +1895,7 @@ void Cigarette::on_pushButton_clear_released()//
QString Cigarette::read_pswd()
{
std::fstream cfg_file;
cfg_file.open("D:/Release/pswd.txt");
cfg_file.open("pswd.txt");
if (!cfg_file.is_open())
{
std::cout << "Error: Open config file pswd.txt"<< std::endl;
@ -1927,7 +1927,7 @@ QString Cigarette::read_pswd()
QString Cigarette::read_op_pswd()
{
std::fstream cfg_file;
cfg_file.open("D:/Release/pswd_op.txt");
cfg_file.open("pswd_op.txt");
if (!cfg_file.is_open())
{
std::cout << "Error: Open config file pswd_op.txt" << std::endl;

@ -6,7 +6,7 @@
#include "basecamera.h"
#include "QtCore\qdatetime.h"
#define __DEBUG //debug信息输出功能
//#define __DEBUG //debug信息输出功能
//#define __UDPSend //网络发送功能
#define USB_BASLER_NEW_FW //使用basler定制固件
//#define IMM_PROCESS //拍照后立马处理,不等校验信号
@ -74,7 +74,7 @@ public:
QTime shiftB; //B换班时间
QTime shiftC; //C换班时间
QString location; // 所在地
QString path_model; // 模型路径
QString path_model; // 模型路径
QString path_jpg; // 图片路径
int timing_shift; //是否定时换班0否1是
int expo[NumberOfSupportedCameras]; //相机曝光时间,单位微秒

@ -282,7 +282,7 @@ void DialogSetup::on_toolButton_choose_path_jpg_released() {
void DialogSetup::write_pswd()
{
std::fstream cfg_file;
cfg_file.open("D:/Release/pswd.txt", std::ios::out | std::ios::trunc);
cfg_file.open("pswd.txt", std::ios::out | std::ios::trunc);
if (cfg_file.good())
{
char buf[256];
@ -295,7 +295,7 @@ void DialogSetup::write_pswd()
void DialogSetup::write_pswd_op()
{
std::fstream cfg_file;
cfg_file.open("D:/Release/pswd_op.txt", std::ios::out | std::ios::trunc);
cfg_file.open("pswd_op.txt", std::ios::out | std::ios::trunc);
if (cfg_file.good())
{
char buf[256];

@ -16,7 +16,7 @@ int main(int argc, char *argv[])
#endif
qRegisterMetaType<cv::Mat>("cv::Mat");
QApplication a(argc, argv);
QPixmap pixmap("D:/Release/splash.jpg");
QPixmap pixmap("splash.jpg");
QSplashScreen splash(pixmap);
splash.show();
a.processEvents();

Loading…
Cancel
Save