mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-20 03:49:43 +08:00
更新:
(1)基于非线性校正的数据 生成 定标文件; (2)将非线性定标参数写到文件中,给卓哥用;
This commit is contained in:
@ -14,7 +14,7 @@ class OceanOpticsFiberImager :public QObject,public FiberSpectrometerOperationBa
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OceanOpticsFiberImager();
|
OceanOpticsFiberImager(double * nonlinearityCoeffs, int numberOfCoeffs);
|
||||||
~OceanOpticsFiberImager();
|
~OceanOpticsFiberImager();
|
||||||
|
|
||||||
OceanOptics_lib * m_FiberSpectrometer;
|
OceanOptics_lib * m_FiberSpectrometer;
|
||||||
@ -35,10 +35,16 @@ public:
|
|||||||
|
|
||||||
ZZ_S32 GetMaxValue(ZZ_S32 * dark, int number);
|
ZZ_S32 GetMaxValue(ZZ_S32 * dark, int number);
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>ζ<EFBFBD><CEB6><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
DeviceInfo m_deviceInfo;
|
||||||
|
DeviceAttribute m_deviceAttribute;
|
||||||
|
|
||||||
// DataFrame m_IntegratingSphereData;
|
// DataFrame m_IntegratingSphereData;
|
||||||
// DataFrame m_DarkData;
|
// DataFrame m_DarkData;
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
|
double * m_nonlinearityCoeffs;
|
||||||
|
int m_iNumberOfNonlinearityCoeffs;
|
||||||
|
|
||||||
// ZZ_U32 m_MaxValueOfFiberSpectrometer;
|
// ZZ_U32 m_MaxValueOfFiberSpectrometer;
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
|||||||
double fLastExposureTime = 0.1;
|
double fLastExposureTime = 0.1;
|
||||||
int iRepeatCount = 0;
|
int iRepeatCount = 0;
|
||||||
|
|
||||||
int iRes = SetExposureTime(2000);//need change to load from files
|
int iRes = SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS);//need change to load from files
|
||||||
if (iRes != 0)
|
if (iRes != 0)
|
||||||
{
|
{
|
||||||
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:1";
|
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:1";
|
||||||
@ -527,16 +527,20 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
|||||||
{
|
{
|
||||||
bFlagIsAutoExposureFailed = true;
|
bFlagIsAutoExposureFailed = true;
|
||||||
bFlagIsOverTrying = true;
|
bFlagIsOverTrying = true;
|
||||||
|
qDebug() << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>"<<endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fExposureTime = (float)m_daDeviceAttr.iMinIntegrationTimeInMS;
|
// fExposureTime = (float)m_daDeviceAttr.iMinIntegrationTimeInMS;
|
||||||
|
int tc_tmp;
|
||||||
|
GetExposureTime(tc_tmp);
|
||||||
|
fExposureTime=tc_tmp;
|
||||||
fTempExposureTime = fExposureTime;
|
fTempExposureTime = fExposureTime;
|
||||||
|
|
||||||
iRes = SingleShot(dfTemp);
|
iRes = SingleShot(dfTemp);
|
||||||
if (iRes != 0)
|
if (iRes != 0)
|
||||||
{
|
{
|
||||||
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:2";
|
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:2"<<endl;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,6 +553,8 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
|||||||
dSum += dfTemp.lData[i];
|
dSum += dfTemp.lData[i];
|
||||||
}
|
}
|
||||||
double dTemp = dSum / iCount;
|
double dTemp = dSum / iCount;
|
||||||
|
qDebug() << "1111111111111111111111111111111" << dTemp << endl;
|
||||||
|
|
||||||
|
|
||||||
if (dTemp >= iDeviceDepth * 0.99)
|
if (dTemp >= iDeviceDepth * 0.99)
|
||||||
{
|
{
|
||||||
@ -566,6 +572,7 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
|||||||
else if (iDeviceDepth * fMaxScaleFactor >= dTemp && dTemp >= iDeviceDepth * fMinScaleFactor)
|
else if (iDeviceDepth * fMaxScaleFactor >= dTemp && dTemp >= iDeviceDepth * fMinScaleFactor)
|
||||||
{
|
{
|
||||||
bFlagIsAutoExposureOK = 1;
|
bFlagIsAutoExposureOK = 1;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if (dTemp > iDeviceDepth * fMaxScaleFactor)
|
else if (dTemp > iDeviceDepth * fMaxScaleFactor)
|
||||||
{
|
{
|
||||||
@ -592,12 +599,15 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
|||||||
dFactor = dTemp / (iDeviceDepth * fMaxScaleFactor);
|
dFactor = dTemp / (iDeviceDepth * fMaxScaleFactor);
|
||||||
fExposureTime = (float)(fExposureTime / dFactor);
|
fExposureTime = (float)(fExposureTime / dFactor);
|
||||||
}
|
}
|
||||||
if (/*fExposureTime > 100 || */fExposureTime < 10)
|
if (fExposureTime < m_daDeviceAttr.iMinIntegrationTimeInMS)
|
||||||
{
|
{
|
||||||
bFlagIsAutoExposureOK = false;
|
bFlagIsAutoExposureOK = false;
|
||||||
bFlagIsAutoExposureFailed = true;
|
bFlagIsAutoExposureFailed = true;
|
||||||
bFlagIsLowerMinExposureTime = true;
|
bFlagIsLowerMinExposureTime = true;
|
||||||
|
|
||||||
|
qDebug() << "lower-----------------------"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
bIsLastValueOverflow = bIsValueOverflow;
|
bIsLastValueOverflow = bIsValueOverflow;
|
||||||
fLastExposureTime = fTempExposureTime;
|
fLastExposureTime = fTempExposureTime;
|
||||||
@ -669,7 +679,7 @@ int ZZ_ATPControl_Serial_Qt::SetExposureTime(int iExposureTimeInMS)
|
|||||||
if ((ZZ_U8)qbRecv[0] != 0)
|
if ((ZZ_U8)qbRecv[0] != 0)
|
||||||
{
|
{
|
||||||
qDebug() << "Err:SetExposureTime Failed.Exit Code:1";
|
qDebug() << "Err:SetExposureTime Failed.Exit Code:1";
|
||||||
return 1;
|
//return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -720,6 +730,9 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame &dfData)
|
|||||||
// qbSend[2] = 0x01;
|
// qbSend[2] = 0x01;
|
||||||
qbSend[1] = m_iExposureTime >> 8;;
|
qbSend[1] = m_iExposureTime >> 8;;
|
||||||
qbSend[2] = m_iExposureTime & 0xFF;
|
qbSend[2] = m_iExposureTime & 0xFF;
|
||||||
|
|
||||||
|
qDebug() << "-------------"<<m_iExposureTime<<endl;
|
||||||
|
|
||||||
int iRes = SendCommand(qbSend);
|
int iRes = SendCommand(qbSend);
|
||||||
if (iRes != 0)
|
if (iRes != 0)
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ void ATPFiberImager::recordTarget(int recordTimes, QString path)
|
|||||||
void ATPFiberImager::autoExpose()
|
void ATPFiberImager::autoExpose()
|
||||||
{
|
{
|
||||||
float fPredictedExposureTime;
|
float fPredictedExposureTime;
|
||||||
m_FiberSpectrometer->PerformAutoExposure(0.7,0.8,fPredictedExposureTime);
|
m_FiberSpectrometer->PerformAutoExposure(0.6,0.9,fPredictedExposureTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZZ_S32 ATPFiberImager::GetMaxValue(ZZ_S32 * dark, int number)
|
ZZ_S32 ATPFiberImager::GetMaxValue(ZZ_S32 * dark, int number)
|
||||||
|
@ -47,8 +47,8 @@ void logout(QString str);
|
|||||||
void createDirectory(QString fullPath);
|
void createDirectory(QString fullPath);
|
||||||
bool isFileExist(QString fullFileName);
|
bool isFileExist(QString fullFileName);
|
||||||
|
|
||||||
int getNonlinearityCoeffs2(long deviceID, double * coeffs);
|
int getNonlinearityCoeffs2(long deviceID, double * nonlinearityCoeffs);
|
||||||
int getNonlinearityCoeffs1(double * coeffs);
|
int getNonlinearityCoeffs1(double * nonlinearityCoeffs);
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -88,14 +88,24 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>
|
||||||
FiberSpectrometerOperationBase * m_FiberSpectrometer;
|
FiberSpectrometerOperationBase * m_FiberSpectrometer;
|
||||||
|
bool isOcean = false;
|
||||||
|
double * nonlinearityCoeffs;
|
||||||
|
int numberOfNonlinearityCoeffs;
|
||||||
switch (query.deviceType)
|
switch (query.deviceType)
|
||||||
{
|
{
|
||||||
case OPTOSKY:
|
case OPTOSKY:
|
||||||
m_FiberSpectrometer = new ATPFiberImager(false,query.serialPort.toStdString(),"OPTOSKY");
|
m_FiberSpectrometer = new ATPFiberImager(false,query.serialPort.toStdString(),"OPTOSKY");
|
||||||
break;
|
break;
|
||||||
case OceanOptics:
|
case OceanOptics:
|
||||||
m_FiberSpectrometer = new OceanOpticsFiberImager();//
|
{
|
||||||
|
//ʹ<><CAB9>sbapi<70><69>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
nonlinearityCoeffs = new double[100];
|
||||||
|
numberOfNonlinearityCoeffs = getNonlinearityCoeffs1(nonlinearityCoeffs);
|
||||||
|
|
||||||
|
m_FiberSpectrometer = new OceanOpticsFiberImager(nonlinearityCoeffs, numberOfNonlinearityCoeffs);
|
||||||
|
isOcean = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case UnknownDevice:
|
case UnknownDevice:
|
||||||
parser.showHelp();
|
parser.showHelp();
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
@ -114,7 +124,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//<2F>Զ<EFBFBD><D4B6>ع<EFBFBD>
|
//<2F>Զ<EFBFBD><D4B6>ع<EFBFBD>
|
||||||
logout("<br><b style=\"color:red\">AutoExpose!</b>");
|
logout("<br><b style=\"color:red\">AutoExpose!</b>");
|
||||||
m_FiberSpectrometer->autoExpose();
|
// m_FiberSpectrometer->autoExpose();
|
||||||
|
|
||||||
int iExposureTime;
|
int iExposureTime;
|
||||||
m_FiberSpectrometer->getExposureTime(iExposureTime);
|
m_FiberSpectrometer->getExposureTime(iExposureTime);
|
||||||
@ -169,56 +179,37 @@ int main(int argc, char *argv[])
|
|||||||
QString destName = QDir::cleanPath(query.calFileOutputDirectory + QDir::separator() + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + "_" +QString::number(query.position) + ".cal");
|
QString destName = QDir::cleanPath(query.calFileOutputDirectory + QDir::separator() + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + "_" +QString::number(query.position) + ".cal");
|
||||||
copyFileToPath(query.calFileOutputName,destName,true);
|
copyFileToPath(query.calFileOutputName,destName,true);
|
||||||
|
|
||||||
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>isOcean<61><6E>
|
|
||||||
auto * p_C = dynamic_cast<OceanOpticsFiberImager *>(m_FiberSpectrometer);
|
|
||||||
bool isOcean = false;//
|
|
||||||
if (p_C != nullptr)
|
|
||||||
{
|
|
||||||
// cout << "Match!!" << endl;
|
|
||||||
isOcean=true;
|
|
||||||
|
|
||||||
// coeffsFrame tmp;
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||||
// m_FiberSpectrometer->getNonlinearityCoeffs(tmp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout << "not OceanOpticsFiberImager!!" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//<2F>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
m_FiberSpectrometer->disconnectFiberSpectrometer();
|
|
||||||
//return a.exec();
|
|
||||||
|
|
||||||
//ʹ<><CAB9>sbapi<70><69>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
if (isOcean)
|
if (isOcean)
|
||||||
{
|
{
|
||||||
double * coeffs = new double[100];
|
|
||||||
int numberOfCoeffs = getNonlinearityCoeffs1(coeffs);
|
|
||||||
|
|
||||||
QDateTime curDateTime = QDateTime::currentDateTime();
|
QDateTime curDateTime = QDateTime::currentDateTime();
|
||||||
QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss");
|
QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss");
|
||||||
QString nonlinearityCoeffsName = QDir::cleanPath(query.calFileOutputDirectory + QDir::separator() + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + ".nonLinear");
|
QString nonlinearityCoeffsName = QDir::cleanPath(query.calFileOutputDirectory + QDir::separator() + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + ".nonLinear");
|
||||||
|
|
||||||
// for (int i = 0; i < numberOfCoeffs; ++i)
|
// for (int i = 0; i < numberOfNonlinearityCoeffs; ++i)
|
||||||
// {
|
// {
|
||||||
// printf("\n");
|
// printf("\n");
|
||||||
//
|
//
|
||||||
// printf("nonlinearityCoeffs(<28><>%d<><64>): %1.2e\n",i , coeffs[i]);
|
// printf("nonlinearityCoeffs(<28><>%d<><64>): %1.2e\n",i , nonlinearityCoeffs[i]);
|
||||||
//
|
//
|
||||||
// printf("\n");
|
// printf("\n");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
std::ofstream outfile(nonlinearityCoeffsName.toStdString().c_str());
|
std::ofstream outfile(nonlinearityCoeffsName.toStdString().c_str());
|
||||||
|
|
||||||
for (int i = 0; i < numberOfCoeffs; i++)
|
for (int i = 0; i < numberOfNonlinearityCoeffs; i++)
|
||||||
{
|
{
|
||||||
outfile << coeffs[i] << std::endl;
|
outfile << nonlinearityCoeffs[i] << std::endl;
|
||||||
}
|
}
|
||||||
outfile.close();
|
outfile.close();
|
||||||
|
|
||||||
free(coeffs);
|
free(nonlinearityCoeffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//<2F>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
m_FiberSpectrometer->disconnectFiberSpectrometer();//Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD>free(nonlinearityCoeffs);
|
||||||
|
//return a.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandLineParseResult parseCommandLine2(QCommandLineParser &parser, TcQuery *query, QString *errorMessage)
|
CommandLineParseResult parseCommandLine2(QCommandLineParser &parser, TcQuery *query, QString *errorMessage)
|
||||||
@ -539,7 +530,7 @@ bool isFileExist(QString fullFileName)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNonlinearityCoeffs1(double * coeffs)
|
int getNonlinearityCoeffs1(double * nonlinearityCoeffs)
|
||||||
{
|
{
|
||||||
int number_of_devices;
|
int number_of_devices;
|
||||||
long *device_ids;
|
long *device_ids;
|
||||||
@ -608,7 +599,7 @@ int getNonlinearityCoeffs1(double * coeffs)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
number = getNonlinearityCoeffs2(device_ids[i],coeffs);
|
number = getNonlinearityCoeffs2(device_ids[i],nonlinearityCoeffs);
|
||||||
|
|
||||||
/* Close the device */
|
/* Close the device */
|
||||||
// printf("\tAttempting to close:\n");
|
// printf("\tAttempting to close:\n");
|
||||||
@ -626,7 +617,7 @@ int getNonlinearityCoeffs1(double * coeffs)
|
|||||||
}//
|
}//
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD>ֵ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ϵ<EFBFBD><CFB5><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD>ֵ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ϵ<EFBFBD><CFB5><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>
|
||||||
int getNonlinearityCoeffs2(long deviceID, double * coeffs)
|
int getNonlinearityCoeffs2(long deviceID, double * nonlinearityCoeffs)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
int number_of_nonlinearity_coeff_features;
|
int number_of_nonlinearity_coeff_features;
|
||||||
@ -664,13 +655,19 @@ int getNonlinearityCoeffs2(long deviceID, double * coeffs)
|
|||||||
// i, deviceID, nonlinearity_coeff_feature_ids[i]);
|
// i, deviceID, nonlinearity_coeff_feature_ids[i]);
|
||||||
|
|
||||||
// printf("\t\t\tAttempting to get nonlinearity coefficients...\n");
|
// printf("\t\t\tAttempting to get nonlinearity coefficients...\n");
|
||||||
memset(coeffs, (int)0, 20);//----------------------------------------------------------------------------
|
memset(nonlinearityCoeffs, (int)0, 20);//----------------------------------------------------------------------------
|
||||||
length = sbapi_nonlinearity_coeffs_get(deviceID,
|
length = sbapi_nonlinearity_coeffs_get(deviceID,
|
||||||
nonlinearity_coeff_feature_ids[i], &error, coeffs, 20);
|
nonlinearity_coeff_feature_ids[i], &error, nonlinearityCoeffs, 20);
|
||||||
// printf("\t\t\t\tResult is %d [%s]\n", length, sbapi_get_error_string(error));
|
// printf("\t\t\t\tResult is %d [%s]\n", length, sbapi_get_error_string(error));
|
||||||
|
|
||||||
if(0 == error && length > 0) {
|
if(0 == error && length > 0) {
|
||||||
// printf("\t\t\t\tFirst calibration term: %1.2e\n", coeffs[0]);
|
// printf("\t\t\t\tFirst calibration term: %1.2e\n", nonlinearityCoeffs[0]);
|
||||||
|
// printf("\t\t\t\tFirst calibration term: %1.2e\n", nonlinearityCoeffs[1]);
|
||||||
|
// printf("\t\t\t\tFirst calibration term: %1.2e\n", nonlinearityCoeffs[2]);
|
||||||
|
// printf("\t\t\t\tFirst calibration term: %1.2e\n", nonlinearityCoeffs[3]);
|
||||||
|
// printf("\t\t\t\tFirst calibration term: %1.2e\n", nonlinearityCoeffs[4]);
|
||||||
|
// printf("\t\t\t\tFirst calibration term: %1.2e\n", nonlinearityCoeffs[5]);
|
||||||
|
// printf("\t\t\t\tFirst calibration term: %1.2e\n", nonlinearityCoeffs[6]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("\t\t%d: Finished testing device 0x%02lX, nonlinearity coeffs 0x%02lX\n",
|
// printf("\t\t%d: Finished testing device 0x%02lX, nonlinearity coeffs 0x%02lX\n",
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#include "Header_Files/oceanOpticsFiberImager.h"
|
#include "Header_Files/oceanOpticsFiberImager.h"
|
||||||
|
|
||||||
OceanOpticsFiberImager::OceanOpticsFiberImager()
|
OceanOpticsFiberImager::OceanOpticsFiberImager(double * nonlinearityCoeffs, int numberOfCoeffs)
|
||||||
{
|
{
|
||||||
m_FiberSpectrometer = NULL;
|
m_FiberSpectrometer = NULL;
|
||||||
|
|
||||||
|
m_nonlinearityCoeffs = nonlinearityCoeffs;
|
||||||
|
m_iNumberOfNonlinearityCoeffs = numberOfCoeffs;
|
||||||
}
|
}
|
||||||
|
|
||||||
OceanOpticsFiberImager::~OceanOpticsFiberImager()
|
OceanOpticsFiberImager::~OceanOpticsFiberImager()
|
||||||
@ -18,15 +21,15 @@ void OceanOpticsFiberImager::connectFiberSpectrometer(QString& SN, QString& pixe
|
|||||||
|
|
||||||
m_FiberSpectrometer->Initialize();
|
m_FiberSpectrometer->Initialize();
|
||||||
|
|
||||||
DeviceInfo deviceInfo;
|
getDeviceInfo(m_deviceInfo);
|
||||||
DeviceAttribute deviceAttribute;
|
// m_FiberSpectrometer->GetDeviceInfo(m_deviceInfo);
|
||||||
|
|
||||||
m_FiberSpectrometer->GetDeviceInfo(deviceInfo);
|
getDeviceAttribute(m_deviceAttribute);
|
||||||
m_FiberSpectrometer->GetDeviceAttribute(deviceAttribute);
|
// m_FiberSpectrometer->GetDeviceAttribute(m_deviceAttribute);
|
||||||
|
|
||||||
SN = QString::fromStdString(deviceInfo.strSN);
|
SN = QString::fromStdString(m_deviceInfo.strSN);
|
||||||
pixelCount = QString::number(deviceAttribute.iPixels);
|
pixelCount = QString::number(m_deviceAttribute.iPixels);
|
||||||
wavelengthInfo = QString::number(deviceAttribute.fWaveLengthInNM[0]) + "--" + QString::number(deviceAttribute.fWaveLengthInNM[deviceAttribute.iPixels - 1]);
|
wavelengthInfo = QString::number(m_deviceAttribute.fWaveLengthInNM[0]) + "--" + QString::number(m_deviceAttribute.fWaveLengthInNM[m_deviceAttribute.iPixels - 1]);
|
||||||
|
|
||||||
m_FiberSpectrometer->SetDeviceTemperature(-10);
|
m_FiberSpectrometer->SetDeviceTemperature(-10);
|
||||||
|
|
||||||
@ -34,11 +37,11 @@ void OceanOpticsFiberImager::connectFiberSpectrometer(QString& SN, QString& pixe
|
|||||||
//<2F><><EFBFBD><EFBFBD>dnֵ<6E><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>
|
//<2F><><EFBFBD><EFBFBD>dnֵ<6E><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>
|
||||||
string qepro = "QEP";
|
string qepro = "QEP";
|
||||||
string flame = "FLMS";
|
string flame = "FLMS";
|
||||||
if (deviceInfo.strSN.find(qepro) != string::npos)
|
if (m_deviceInfo.strSN.find(qepro) != string::npos)
|
||||||
{
|
{
|
||||||
m_MaxValueOfFiberSpectrometer = 200000;
|
m_MaxValueOfFiberSpectrometer = 200000;
|
||||||
}
|
}
|
||||||
else if (deviceInfo.strSN.find(flame) != string::npos)
|
else if (m_deviceInfo.strSN.find(flame) != string::npos)
|
||||||
{
|
{
|
||||||
m_MaxValueOfFiberSpectrometer = 65535;
|
m_MaxValueOfFiberSpectrometer = 65535;
|
||||||
}
|
}
|
||||||
@ -81,6 +84,25 @@ void OceanOpticsFiberImager::getDeviceTemperature(float &fTemperature)
|
|||||||
void OceanOpticsFiberImager::singleShot(DataFrame &dfData)
|
void OceanOpticsFiberImager::singleShot(DataFrame &dfData)
|
||||||
{
|
{
|
||||||
m_FiberSpectrometer->SingleShot(dfData);
|
m_FiberSpectrometer->SingleShot(dfData);
|
||||||
|
|
||||||
|
if(m_iNumberOfNonlinearityCoeffs==0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>
|
||||||
|
for (int i = 0; i < m_deviceAttribute.iPixels; i++)
|
||||||
|
{
|
||||||
|
dfData.lData[i] = dfData.lData[i] / (m_nonlinearityCoeffs[0]
|
||||||
|
+ m_nonlinearityCoeffs[1] * dfData.lData[i]
|
||||||
|
+ m_nonlinearityCoeffs[2] * pow(dfData.lData[i], 2)
|
||||||
|
+ m_nonlinearityCoeffs[3] * pow(dfData.lData[i], 3)
|
||||||
|
+ m_nonlinearityCoeffs[4] * pow(dfData.lData[i], 4)
|
||||||
|
+ m_nonlinearityCoeffs[5] * pow(dfData.lData[i], 5)
|
||||||
|
+ m_nonlinearityCoeffs[6] * pow(dfData.lData[i], 6)
|
||||||
|
+ m_nonlinearityCoeffs[7] * pow(dfData.lData[i], 7)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OceanOpticsFiberImager::getNonlinearityCoeffs(coeffsFrame &coeffs)
|
void OceanOpticsFiberImager::getNonlinearityCoeffs(coeffsFrame &coeffs)
|
||||||
|
Reference in New Issue
Block a user