1、QMotorDoubleSlider 将细分参数和 Vince 统一,使用7代表128,并修改配置文件类的相关功能;

2、resonon nir 采集白板崩溃:重连相机解决;
3、去掉 imageViewer 的边缘黑框;
4、解决问题:当采集白板数据后,采集影像拉伸问题:硬编码的4096 → 自动计算最大值;
5、记录上次软件布局状态信息,再次打开时恢复;
6、轨迹规划界面文字居中;
7、将 groupbox 换成 dockwidget,然后再菜单栏添加 dock 的开关;
This commit is contained in:
tangchao0503
2024-12-25 15:51:10 +08:00
parent 6469bff15d
commit cbc81cb75e
13 changed files with 2093 additions and 1831 deletions

View File

@ -15,36 +15,46 @@ HPPA::HPPA(QWidget *parent)
{
ui.setupUi(this);
QString strPath = QCoreApplication::applicationDirPath() + "/UILayout.ini";
QFile file(strPath);
if (file.open(QIODevice::ReadOnly)) {
QByteArray ba;
QDataStream in(&file);
in >> ba;
file.close();
this->restoreState(ba);
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>У<EFBFBD><D0A3>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
configfile.setConfigfilePath(HPPACfgFile);
if (!configfile.isConfigfileExist())
mConfigfile.setConfigfilePath(HPPACfgFile);
if (!mConfigfile.isConfigfileExist())
{
configfile.createConfigFile();
mConfigfile.createConfigFile();
qDebug() << "create: " << QString::fromStdString(HPPACfgFile);
}
configfile.parseConfigfile();
mConfigfile.parseConfigfile();
qDebug() << "exist: " << QString::fromStdString(HPPACfgFile);
/*int max, min;
configfile.getPositionRestriction(max, min);
mConfigfile.getPositionRestriction(max, min);
string sn;
configfile.getSN(sn);
mConfigfile.getSN(sn);
int coarse, fine;
configfile.getTuningStepSize(coarse, fine);
mConfigfile.getTuningStepSize(coarse, fine);
float fa, fb;
configfile.getFitParams(fa, fb);
mConfigfile.getFitParams(fa, fb);
int max_FocusRange, min_FocusRange;
configfile.getAutoFocusRange(max_FocusRange, min_FocusRange);
mConfigfile.getAutoFocusRange(max_FocusRange, min_FocusRange);
float StepAnglemar_x, Lead_x, ScaleFactor_x;
int SubdivisionMultiples_x;
configfile.getXMotorParm(StepAnglemar_x, Lead_x, SubdivisionMultiples_x, ScaleFactor_x);
mConfigfile.getXMotorParm(StepAnglemar_x, Lead_x, SubdivisionMultiples_x, ScaleFactor_x);
float StepAnglemar_y, Lead_y, ScaleFactor_y;
int SubdivisionMultiples_y;
configfile.getYMotorParm(StepAnglemar_y, Lead_y, SubdivisionMultiples_y, ScaleFactor_y);*/
mConfigfile.getYMotorParm(StepAnglemar_y, Lead_y, SubdivisionMultiples_y, ScaleFactor_y);*/
//״̬<D7B4><CCAC>
xmotor_state_label1 = new QLabel();
@ -87,9 +97,18 @@ HPPA::HPPA(QWidget *parent)
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
m_chartView = new QChartView();
QWidget* widget = new QWidget();
QGridLayout* grid = new QGridLayout(widget);
m_chartView = new QChartView(ui.mDockWidgetSpectralViewer);
m_chartView->setRenderHint(QPainter::Antialiasing);
ui.spectral_gridLayout->addWidget(m_chartView);
grid->addWidget(m_chartView);
//grid->setMargin(0);
grid->setContentsMargins(0, 0, 0, 0);
//grid->SetMaximumSize(0);
ui.mDockWidgetSpectralViewer->setWidget(widget);
//QLineSeries *series = new QLineSeries();
//QChart *chart = new QChart();
@ -170,7 +189,7 @@ HPPA::HPPA(QWidget *parent)
float scaleFactor;//<2F><><EFBFBD><EFBFBD>еװ<D0B5>õ<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int subdivisionMultiples;//ϸ<><CFB8><EFBFBD><EFBFBD>
float maxRange;
configfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange);
mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange);
ui.xmotor_speed_slider->setMultiplier(lead, stepAnglemar, scaleFactor, subdivisionMultiples);
ui.xmotor_speed_slider->setRange(0, 3);//5.2734375cm/s=10000<30><30><EFBFBD><EFBFBD>
@ -185,7 +204,7 @@ HPPA::HPPA(QWidget *parent)
ui.xmotor_location_slider->setMultiplier(lead, stepAnglemar, scaleFactor, subdivisionMultiples);
ui.xmotor_location_slider->setValue(0);
configfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange);
mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange);
connect(this->ui.ymotor_location_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnYmotorLocationLineeditEditingFinished()));
connect(this->ui.ymotor_location_slider, SIGNAL(valueChanged(double)), this, SLOT(OnYmotorLocationSliderChanged(double)));
connect(this->ui.ymotor_location_slider, SIGNAL(sliderReleased()), this, SLOT(OnYmotorLocationSliderReleased()));
@ -283,6 +302,8 @@ HPPA::HPPA(QWidget *parent)
createActionGroups();
connect(mImagerGroup, &QActionGroup::triggered, this, &HPPA::selectingImager);
initPanelToolbar();
}
void HPPA::createActionGroups()
@ -305,6 +326,15 @@ void HPPA::selectingImager(QAction* selectedAction)
HPPA::~HPPA()
{
QString strPath = QCoreApplication::applicationDirPath() + "/UILayout.ini";
QFile file(strPath);
if (file.open(QIODevice::WriteOnly)) {
QDataStream outfile(&file);
QByteArray ba = this->saveState();
outfile << ba;
file.close();
}
if (m_Imager != nullptr)
{
//m_Imager->~ResononNirImager();//<2F>ͷ<EFBFBD><CDB7><EFBFBD>Դ
@ -324,6 +354,33 @@ HPPA::~HPPA()
}
}
void HPPA::initPanelToolbar()
{
tabifyDockWidget(ui.mDockWidgetSpectrometer, ui.mDockWidgetLinearStage);
tabifyDockWidget(ui.mDockWidgetLinearStage, ui.mDockWidgetPathPlanning);
tabifyDockWidget(ui.mDockWidgetPathPlanning, ui.mDockWidgetPowerControl);
tabifyDockWidget(ui.mDockWidgetPowerControl, ui.mDockWidgetAdjustTable);
mPanelMenu = new QMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);//create panel menu
mPanelMenu->setObjectName(QStringLiteral("mPanelMenu"));
mToolbarMenu = new QMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);//create toolbar menu
mToolbarMenu->setObjectName(QStringLiteral("mToolbarMenu"));
ui.mWindowsMenu->addSeparator();
ui.mWindowsMenu->addMenu(mPanelMenu);
ui.mWindowsMenu->addMenu(mToolbarMenu);
mPanelMenu->addAction(ui.mDockWidgetSpectrometer->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetLinearStage->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetPathPlanning->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetPowerControl->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetAdjustTable->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetRGBCamera->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetSimulator->toggleViewAction());
mToolbarMenu->addAction(ui.mainToolBar->toggleViewAction());
}
void HPPA::CalculateIntegratioinTimeRange()
{
double range = 1 / m_Imager->getFramerate() * 1000;//<2F><><EFBFBD><EFBFBD>
@ -919,8 +976,8 @@ void HPPA::setMotorRange()
float scaleFactor;//<2F><><EFBFBD><EFBFBD>еװ<D0B5>õ<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int subdivisionMultiples;//ϸ<><CFB8><EFBFBD><EFBFBD>
configfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, xMotorRange);
configfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, yMotorRange);
mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, xMotorRange);
mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, yMotorRange);
//std::cout << "xMotorRange<67><65>" << xMotorRange << std::endl;
@ -1224,20 +1281,22 @@ void HPPA::onAddRecordLine_btn()
int currentRow = ui.recordLine_tableWidget->currentRow();
std::cout << "currentRow<EFBFBD><EFBFBD>" << currentRow << std::endl;
QTableWidgetItem* Item1 = new QTableWidgetItem(QString::number(currentPosOfYmotor, 10, 2));
QTableWidgetItem* Item2 = new QTableWidgetItem(QString::number(maxRangeOfXmotro, 10, 2));
if (currentRow == -1)//<2F><>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʱ
{
int RowCount = ui.recordLine_tableWidget->rowCount();//Returns the number of rows. <20><>1<EFBFBD><31>ʼ<EFBFBD><CABC>
ui.recordLine_tableWidget->insertRow(RowCount);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3>β<EFBFBD><CEB2>Ǵ<EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>
ui.recordLine_tableWidget->setItem(RowCount, 0, new QTableWidgetItem(QString::number(currentPosOfYmotor, 10, 2)));
ui.recordLine_tableWidget->setItem(RowCount, 1, new QTableWidgetItem(QString::number(maxRangeOfXmotro, 10, 2)));
ui.recordLine_tableWidget->setItem(RowCount, 0, Item1);
ui.recordLine_tableWidget->setItem(RowCount, 1, Item2);
}
else
{
ui.recordLine_tableWidget->insertRow(currentRow + 1);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3>β<EFBFBD><CEB2>Ǵ<EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>
ui.recordLine_tableWidget->setItem(currentRow + 1, 0, new QTableWidgetItem(QString::number(currentPosOfYmotor, 10, 2)));
ui.recordLine_tableWidget->setItem(currentRow + 1, 1, new QTableWidgetItem(QString::number(maxRangeOfXmotro, 10, 2)));
ui.recordLine_tableWidget->setItem(currentRow + 1, 0, Item1);
ui.recordLine_tableWidget->setItem(currentRow + 1, 1, Item2);
}
}
@ -1293,6 +1352,7 @@ void HPPA::onGenerateRecordLine_btn()
//<2F><>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ɼ<EFBFBD><C9BC>ߣ<EFBFBD>
QTableWidgetItem* tmpItem;
for (size_t i = 0; i < numberOfRecordLine; i++)
{
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
@ -1302,16 +1362,22 @@ void HPPA::onGenerateRecordLine_btn()
//<2F><><EFBFBD><EFBFBD>yPosition
if (tmp > threshold && i == numberOfRecordLine - 1)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>е<EFBFBD>yPosition
{
ui.recordLine_tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(yMotorRange, 10, 2)));
tmpItem = new QTableWidgetItem(QString::number(yMotorRange, 10, 2));
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui.recordLine_tableWidget->setItem(i, 0, tmpItem);
}
else
{
double x = swath * i - i * repetitiveLength + offset;
ui.recordLine_tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(x, 10, 2)));
tmpItem = new QTableWidgetItem(QString::number(x, 10, 2));
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui.recordLine_tableWidget->setItem(i, 0, tmpItem);
}
//<2F><><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>λ<EFBFBD><CEBB> <20><> ֵ<><D6B5><EFBFBD><EFBFBD>Ϊx<CEAA><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ui.recordLine_tableWidget->setItem(i, 1, new QTableWidgetItem(QString::number(xMotorRange, 10, 2)));
tmpItem = new QTableWidgetItem(QString::number(xMotorRange, 10, 2));
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui.recordLine_tableWidget->setItem(i, 1, tmpItem);
}
@ -1447,7 +1513,9 @@ void HPPA::onReadRecordLineFile_btn()
{
for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++)
{
ui.recordLine_tableWidget->setItem(i, j, new QTableWidgetItem(QString::number(data[i*ui.recordLine_tableWidget->columnCount() + j], 10, 2)));
QTableWidgetItem* tmp = new QTableWidgetItem(QString::number(data[i * ui.recordLine_tableWidget->columnCount() + j], 10, 2));
tmp->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui.recordLine_tableWidget->setItem(i, j, tmp);
}
}
@ -1706,6 +1774,9 @@ void HPPA::newMotor()
connect(m_xMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setMotorParamMicroscope(VinceControl*)));
connect(m_yMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setMotorParamMicroscope(VinceControl*)));
}
connect(m_xMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setXMotorParamFromCfgFile(VinceControl*)));
connect(m_yMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setYMotorParamFromCfgFile(VinceControl*)));
m_xConnectCount = 0;
m_yConnectCount = 0;
@ -1744,6 +1815,41 @@ void HPPA::setMotorParamMicroscope(VinceControl* motor)
motor->GetCommonRetrun(buf);
}
void HPPA::setXMotorParamFromCfgFile(VinceControl* motor)
{
float lead;//导程
float stepAnglemar;//步距角
float scaleFactor;//因机械装置的原因引入的缩放因子
int subdivisionMultiples;//细分数
float maxRange;
mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange);
QString commonstr;
QByteArray buf;
commonstr = "cfg mcs=" + QString::number(subdivisionMultiples) + "\n";
std::string tmp = commonstr.toStdString();
motor->SendCommandtoMotor(commonstr, "non");
motor->GetCommonRetrun(buf);
}
void HPPA::setYMotorParamFromCfgFile(VinceControl* motor)
{
float lead;//导程
float stepAnglemar;//步距角
float scaleFactor;//因机械装置的原因引入的缩放因子
int subdivisionMultiples;//细分数
float maxRange;
mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange);
QString commonstr;
QByteArray buf;
commonstr = "cfg mcs=" + QString::number(subdivisionMultiples) + "\n";
motor->SendCommandtoMotor(commonstr, "non");
motor->GetCommonRetrun(buf);
}
void HPPA::deleteMotor()
{
disconnect(m_xMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString)));

View File

@ -160,6 +160,12 @@ public:
private:
Ui::HPPAClass ui;
QMenu* mPanelMenu = nullptr;
QMenu* mToolbarMenu = nullptr;
void initPanelToolbar();
QLineEdit * frame_number;
QLineEdit * m_FilenameLineEdit;
QLabel * xmotor_state_label1;

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,7 @@ ImageViewer::ImageViewer(QWidget* pParent) :QGraphicsView(pParent)
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFrameShape(QFrame::NoFrame);
}
ImageViewer::~ImageViewer()

View File

@ -12,12 +12,30 @@ QMotorDoubleSlider::QMotorDoubleSlider(QWidget* pParent /*= NULL*/) :QSlider(pPa
m_Multiplier = 0;
}
void QMotorDoubleSlider::setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionMultiples)
void QMotorDoubleSlider::setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionParam)
{
//<2F><><EFBFBD>ݹ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5BBBB>Ϊ<EFBFBD><CEAA><EFBFBD>룺1<EBA3BA><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(m_Multiplier)=<3D><><EFBFBD><EFBFBD>/(360/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>ֱ<EFBFBD><D6B1><EFBFBD>)<29><><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
//m_Multiplier(0.00054496986),//<2F>Ϻ<EFBFBD>ũ<EFBFBD><C5A9>Ժ<EFBFBD><D4BA><EFBFBD>޸<EFBFBD>ǰ<EFBFBD><C7B0>0.00052734375/5=0.00010546875<EFBFBD><EFBFBD><EFBFBD>޸ĺ<EFBFBD>׼ȷֵΪ0.000544969862759644<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0.00054496986/5=0.000108993972<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>еװ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><EFBFBD>
//m_Multiplier(0.00054496986)//<2F>˰<EFBFBD><CBB0><EFBFBD>ũ<EFBFBD><C5A9><EFBFBD><EFBFBD>
m_Multiplier = lead / (360 / stepAnglemar * subdivisionMultiples) * scaleFactor;
m_Multiplier = lead / (360 / stepAnglemar * getValidSubdivision(subdivisionParam)) * scaleFactor;
}
int QMotorDoubleSlider::getValidSubdivision(int subdivisionParam)
{
if (subdivisionParam == 2)
return 4;
else if (subdivisionParam == 3)
return 8;
else if (subdivisionParam == 4)
return 16;
else if (subdivisionParam == 5)
return 32;
else if (subdivisionParam == 6)
return 64;
else if (subdivisionParam == 7)
return 128;
else if (subdivisionParam == 8)
return 256;
}
//<2F><><EFBFBD><EFBFBD><E2B7A2>

View File

@ -12,7 +12,8 @@ class QMotorDoubleSlider : public QSlider
public:
QMotorDoubleSlider(QWidget* pParent = NULL);
void setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionMultiples);
void setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionParam);
int getValidSubdivision(int subdivisionParam);
double m_Multiplier;//<2F><><EFBFBD>ݹ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5BBBB>Ϊ<EFBFBD><CEAA><EFBFBD>룺1<EBA3BA><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(m_Multiplier)=<3D><><EFBFBD><EFBFBD>/(360/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>ֱ<EFBFBD><D6B1><EFBFBD>)<29><><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html

View File

@ -189,6 +189,44 @@ void ResononNirImager::focus()
setIntegrationTime(tmpIntegrationTime);
}
void ResononNirImager::record_dark()
{
std::cout << "<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
reConnectImage();
imagerStartCollect();
getFrame(dark);
imagerStopCollect();
m_HasDark = true;
}
void ResononNirImager::record_white()
{
std::cout << "<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ壡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
reConnectImage();
imagerStartCollect();
getFrame(white);
imagerStopCollect();
//<2F>װ<EFBFBD><D7B0>۰<EFBFBD><DBB0><EFBFBD><EFBFBD><EFBFBD>
if (m_HasDark)
{
for (size_t i = 0; i < m_FrameSize; i++)
{
if (white[i] < dark[i])
{
white[i] = 0;
}
else
{
white[i] = white[i] - dark[i];
}
}
}
m_HasWhite = true;
}
void ResononNirImager::start_record()
{
using namespace std;

View File

@ -43,6 +43,8 @@ private:
public slots:
double auto_exposure();
void focus();
void record_dark();
void record_white();
void start_record();
signals:

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>753</width>
<height>490</height>
<width>756</width>
<height>463</height>
</rect>
</property>
<property name="windowTitle">
@ -65,12 +65,12 @@
<rect>
<x>270</x>
<y>150</y>
<width>108</width>
<width>141</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>版本1.8</string>
<string>版本1.8.1</string>
</property>
</widget>
<widget class="QLabel" name="label_4">

View File

@ -303,12 +303,12 @@ bool Configfile::createConfigFile()
Setting& x_StepAnglemar = x.add("StepAnglemar", Setting::TypeFloat) = 1.8;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Setting& x_Lead = x.add("Lead", Setting::TypeFloat) = 13.5;//<2F><><EFBFBD>̣<EFBFBD><CCA3><EFBFBD>λ<EFBFBD><CEBB>cm
Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 128;//ϸ<>ֱ<EFBFBD><D6B1><EFBFBD>
Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 7;//ϸ<>ֱ<EFBFBD><D6B1><EFBFBD>
Setting& x_ScaleFactor = x.add("ScaleFactor", Setting::TypeFloat) = 1.0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Setting& x_MaxRange = x.add("MaxRange", Setting::TypeFloat) = 120.0;
Setting& y_StepAnglemar = y.add("StepAnglemar", Setting::TypeFloat) = 1.8;
Setting& y_Lead = y.add("Lead", Setting::TypeFloat) = 13.5;
Setting& y_SubdivisionMultiples = y.add("SubdivisionMultiples", Setting::TypeInt) = 128;
Setting& y_SubdivisionMultiples = y.add("SubdivisionMultiples", Setting::TypeInt) = 7;
Setting& y_ScaleFactor = y.add("ScaleFactor", Setting::TypeFloat) = 0.2;
Setting& y_MaxRange = y.add("MaxRange", Setting::TypeFloat) = 120.0;

View File

@ -113,8 +113,9 @@ void CImage::FillRgbImage(unsigned short *datacube)
//m_QRgbImage->save(QString::fromStdString(rgbFilePathNoStrech), "PNG");
//ImageProcessor imageProcessor;
//cv::imwrite(rgbFilePathNoStrech, *m_matRgbImage);
//cv::imwrite(rgbFilePathStrech, CStretch(*m_matRgbImage, 0.01));
//cv::imwrite(rgbFilePathStrech, imageProcessor.CStretch(*m_matRgbImage, 0.02));
}
}

View File

@ -11,6 +11,7 @@
#include "QImage"
#include "fileOperation.h"
#include "imageProcessor.h"
class CImage :public QObject

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "imageProcessor.h"
#include <algorithm>
ImageProcessor::ImageProcessor()
{
@ -14,8 +15,9 @@ std::vector<cv::Point2f> ImageProcessor::CHistogram(const cv::Mat img)
cv::Mat mimg = img.clone();
int rows = mimg.rows;
int cols = mimg.cols;
int maxValue = *std::max_element(mimg.begin<unsigned short>(), mimg.end<unsigned short>());
//ͳ<><CDB3>ÿ<EFBFBD><C3BF><EFBFBD>Ҷȳ<D2B6><C8B3>ֵĴ<D6B5><C4B4><EFBFBD>
std::vector<long int> hisnum(4096, 0);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::vector<long int> hisnum(maxValue, 0);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i(0); i < rows; ++i)
{
//std::cout << "i<><69>" << i << std::endl;
@ -27,7 +29,7 @@ std::vector<cv::Point2f> ImageProcessor::CHistogram(const cv::Mat img)
//<2F>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD><EFBFBD>ڿ۳<DABF><DBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><D0BF><EFBFBD>Ϊ<EFBFBD><CEAA>ֵ
//<2F><><EFBFBD><EFBFBD>mat<61><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪCV_16UC3<43><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>ֵʱ<D6B5><CAB1><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ϊ65535
if (gv >= 4096)
if (gv >= maxValue)
{
++hisnum[0];
}
@ -35,8 +37,6 @@ std::vector<cv::Point2f> ImageProcessor::CHistogram(const cv::Mat img)
{
++hisnum[gv];
}
}
}
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Ҷ<EFBFBD>Ƶ<EFBFBD><C6B5>