mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-19 03:49:42 +08:00
Merge remote-tracking branch 'origin/TC'
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
//#include "pch.h"
|
||||
|
||||
#include "ZZ_Types.h"
|
||||
#include "ZZ_Math.h"
|
||||
#include <QSerialPort>
|
||||
@ -14,7 +15,7 @@ using namespace ZZ_MISCDEF;
|
||||
using namespace ZZ_MISCDEF::ATP;
|
||||
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||
|
||||
class ZZ_ATPControl_Serial_Qt :public CIrisFSBase
|
||||
class ZZ_ATPControl_Serial_Qt:public CIrisFSBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -33,10 +34,10 @@ public:
|
||||
void Close();
|
||||
|
||||
//<2F><><EFBFBD>β<EFBFBD><CEB2>Բɼ<D4B2> <20><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int SingleShot(int& iPixels);
|
||||
int SingleShot(int &iPixels);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2>
|
||||
int SingleShot(DataFrame& dfData);
|
||||
int SingleShot(DataFrame &dfData);
|
||||
|
||||
//<2F><><EFBFBD>ΰ<EFBFBD><CEB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>
|
||||
//int SingleShotDark(ATPDataFrame &dfData);
|
||||
@ -46,15 +47,15 @@ public:
|
||||
int SetExposureTime(int iExposureTimeInMS);
|
||||
|
||||
//<2F><>ȡ<EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int GetExposureTime(int& iExposureTimeInMS);
|
||||
int GetExposureTime(int &iExposureTimeInMS);
|
||||
|
||||
//int GetWaveLength(float *pfWaveLength);
|
||||
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
||||
int GetDeviceInfo(DeviceInfo& Info);
|
||||
int GetDeviceInfo(DeviceInfo &Info);
|
||||
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int GetDeviceAttribute(DeviceAttribute& Attr);
|
||||
int GetDeviceAttribute(DeviceAttribute &Attr);
|
||||
|
||||
//int GetDeviceListInfo(); //use type name to enum
|
||||
|
||||
@ -62,10 +63,12 @@ public:
|
||||
int SetDeviceTemperature(float fTemperature);
|
||||
|
||||
//<2F><>ȡ<EFBFBD>¶<EFBFBD>
|
||||
int GetDeviceTemperature(float& fTemperature);
|
||||
int GetDeviceTemperature(float &fTemperature);
|
||||
|
||||
//<2F>Զ<EFBFBD><D4B6>ع<EFBFBD>
|
||||
int PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float& fPredictedExposureTime);
|
||||
int PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float &fPredictedExposureTime);
|
||||
private:
|
||||
int SetAvgTimes(int iTimes = 1);
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
@ -74,7 +77,7 @@ private:
|
||||
#endif
|
||||
//port
|
||||
int m_iBaudRate;
|
||||
QSerialPort* m_pSerialPort;
|
||||
QSerialPort *m_pSerialPort;
|
||||
|
||||
//ATP
|
||||
DeviceInfo m_diDeviceInfo;
|
||||
@ -94,6 +97,6 @@ public slots:
|
||||
int Init_Self();
|
||||
signals:
|
||||
void SignalInit_Self();
|
||||
//private slots :
|
||||
//private slots :
|
||||
//void ReadMessage();
|
||||
};
|
@ -30,6 +30,14 @@ public:
|
||||
|
||||
virtual void singleShot(DataFrame &dfData) = 0;
|
||||
|
||||
// typedef struct coeffs
|
||||
// {
|
||||
// ZZ_U32 coeffsCounter;
|
||||
// double coeffs[100];
|
||||
// }coeffsFrame;
|
||||
virtual void getNonlinearityCoeffs(coeffsFrame &coeffs) = 0;
|
||||
|
||||
|
||||
// ZZ_S32 GetMaxValue(ZZ_S32 * dark, int number) = 0;
|
||||
|
||||
DataFrame m_IntegratingSphereData;
|
||||
|
@ -30,6 +30,12 @@ namespace ZZ_MISCDEF
|
||||
double dTimes = 0;
|
||||
}DataFrame;
|
||||
|
||||
typedef struct coeffs//tc<74><63><EFBFBD><EFBFBD>-----------------------
|
||||
{
|
||||
ZZ_U32 coeffsCounter;
|
||||
double coeffs[100];
|
||||
}coeffsFrame;
|
||||
|
||||
typedef struct tagDeviceInfo
|
||||
{
|
||||
std::string strPN;
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
|
||||
void singleShot(DataFrame &dfData);
|
||||
|
||||
void getNonlinearityCoeffs(coeffsFrame &coeffs);
|
||||
|
||||
ZZ_S32 GetMaxValue(ZZ_S32 * dark, int number);
|
||||
|
||||
// DataFrame m_IntegratingSphereData;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "IrisFiberSpectrometerBase.h"
|
||||
#include "api/seabreezeapi/SeaBreezeAPI.h"
|
||||
#include "api/seabreezeapi/NonlinearityCoeffsFeatureAdapter.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
@ -53,6 +54,7 @@ public:
|
||||
|
||||
//tc
|
||||
static const char* get_error_string(int error);
|
||||
void test_nonlinearity_coeffs_feature();
|
||||
private:
|
||||
int m_iSpectralmeterHandle;
|
||||
DeviceInfo m_deviceInfo;
|
||||
|
@ -14,7 +14,7 @@ class OceanOpticsFiberImager :public QObject,public FiberSpectrometerOperationBa
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OceanOpticsFiberImager();
|
||||
OceanOpticsFiberImager(double * nonlinearityCoeffs, int numberOfCoeffs);
|
||||
~OceanOpticsFiberImager();
|
||||
|
||||
OceanOptics_lib * m_FiberSpectrometer;
|
||||
@ -31,13 +31,21 @@ public:
|
||||
|
||||
void singleShot(DataFrame &dfData);
|
||||
|
||||
void getNonlinearityCoeffs(coeffsFrame &coeffs);
|
||||
|
||||
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_DarkData;
|
||||
protected:
|
||||
private:
|
||||
|
||||
double * m_nonlinearityCoeffs;
|
||||
int m_iNumberOfNonlinearityCoeffs;
|
||||
|
||||
// ZZ_U32 m_MaxValueOfFiberSpectrometer;
|
||||
|
||||
public slots:
|
||||
|
@ -9,7 +9,7 @@ ZZ_ATPControl_Serial_Qt::ZZ_ATPControl_Serial_Qt(QObject* parent /*= nullptr*/)
|
||||
//emit SignalInit_Self();
|
||||
}
|
||||
|
||||
ZZ_ATPControl_Serial_Qt::~ZZ_ATPControl_Serial_Qt()
|
||||
ZZ_ATPControl_Serial_Qt::~ZZ_ATPControl_Serial_Qt()//
|
||||
{
|
||||
if (m_pSerialPort != NULL)
|
||||
{
|
||||
@ -72,7 +72,7 @@ int ZZ_ATPControl_Serial_Qt::Initialize(bool bIsUSBMode, std::string ucPortNumbe
|
||||
|
||||
GetDeviceInfo(m_diDeviceInfo);
|
||||
GetExposureTime_Init();
|
||||
|
||||
SetAvgTimes(1);
|
||||
|
||||
std::string::size_type szPostion = m_diDeviceInfo.strSN.find(strDeviceName);
|
||||
if (szPostion == std::string::npos)
|
||||
@ -196,15 +196,15 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute(DeviceAttribute &Attr)
|
||||
}
|
||||
m_daDeviceAttr.iMaxIntegrationTimeInMS = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||
|
||||
|
||||
///
|
||||
int iTempExpTime = 0;
|
||||
GetExposureTime(iTempExpTime);
|
||||
|
||||
iRes = SetExposureTime(10);
|
||||
iRes = SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Call SetExposureTime error.Exit Code:2";
|
||||
return 2;
|
||||
//return 2;
|
||||
}
|
||||
iRes = SingleShot(m_daDeviceAttr.iPixels);
|
||||
if (iRes != 0)
|
||||
@ -214,8 +214,7 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute(DeviceAttribute &Attr)
|
||||
}
|
||||
|
||||
SetExposureTime(iTempExpTime);
|
||||
|
||||
|
||||
///
|
||||
qbSend.clear();
|
||||
qbRecv.clear();
|
||||
qbSend.append(GET_WAVELENGTH_CALIBRATION_COEF);
|
||||
@ -257,6 +256,36 @@ int ZZ_ATPControl_Serial_Qt::SetDeviceTemperature(float fTemperature)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::SetAvgTimes(int iTimes /*= 1*/)
|
||||
{
|
||||
QByteArray qbSend, qbRecv;
|
||||
qbSend.clear();
|
||||
qbRecv.clear();
|
||||
qbSend.append(SET_AVERAGE_NUMBER);
|
||||
qbSend.resize(3);
|
||||
qbSend[1] = 0x00;
|
||||
qbSend[2] = 0x01;
|
||||
int iRes = SendCommand(qbSend);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:SetAvgTimes Failed.Exit Code:1";
|
||||
return 1;
|
||||
}
|
||||
iRes = RecvData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:SetAvgTimes Failed.Exit Code:2";
|
||||
return 2;
|
||||
}
|
||||
iRes = ParseData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:SetAvgTimes Failed.Exit Code:3";
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::GetExposureTime_Init()
|
||||
{
|
||||
QByteArray qbSend, qbRecv;
|
||||
@ -326,7 +355,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData(QByteArray &qbData)
|
||||
int iCounter = 0;
|
||||
while (qbData.size() < 4)
|
||||
{
|
||||
m_pSerialPort->waitForReadyRead(1000);
|
||||
m_pSerialPort->waitForReadyRead(5000);
|
||||
QByteArray qbTemp = m_pSerialPort->readAll();
|
||||
qbData.append(qbTemp);
|
||||
|
||||
@ -335,7 +364,6 @@ int ZZ_ATPControl_Serial_Qt::RecvData(QByteArray &qbData)
|
||||
qDebug() << "Err:RecvData Failed,Not Enough Data.Exit Code:1" << qbData.size();
|
||||
return 1;
|
||||
}
|
||||
|
||||
iCounter++;
|
||||
}
|
||||
|
||||
@ -397,7 +425,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData_ShortLag(QByteArray &qbData)
|
||||
|
||||
if (iCounter > 6)
|
||||
{
|
||||
qDebug() << "Err:RecvData Failed,Not Enough Data.Exit Code:1" << qbData.size();
|
||||
qDebug() << "Err:RecvData_ShortLag Failed,Not Enough Data.Exit Code:1" << qbData.size();
|
||||
return 1;
|
||||
}
|
||||
iCounter++;
|
||||
@ -405,7 +433,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData_ShortLag(QByteArray &qbData)
|
||||
|
||||
if ((ZZ_U8)qbData[0] != (ZZ_U8)0xaa || (ZZ_U8)qbData[1] != (ZZ_U8)0x55)
|
||||
{
|
||||
qDebug() << "Err:RecvData Failed,Wrong Header.Exit Code:2" << qbData.size();
|
||||
qDebug() << "Err:RecvData_ShortLag Failed,Wrong Header.Exit Code:2" << qbData.size();
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -418,7 +446,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData_ShortLag(QByteArray &qbData)
|
||||
|
||||
if (iCounter > 6)
|
||||
{
|
||||
qDebug() << "Err:RecvData Failed,Incomplete Data.Exit Code:3" << qbData.size();
|
||||
qDebug() << "Err:RecvData_ShortLag Failed,Incomplete Data.Exit Code:3" << qbData.size();
|
||||
return 3;
|
||||
}
|
||||
iCounter++;
|
||||
@ -438,7 +466,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData_ShortLag(QByteArray &qbData)
|
||||
ZZ_U8 ucTemp = qbData[qbData.size() - 1];
|
||||
if ((ZZ_U8)usCheckSum != ucTemp)
|
||||
{
|
||||
qDebug() << "Err:RecvData Failed,Incorrect Check Sum.Exit Code:4" << "Total Recv:" << qbData.size() << "Check Sum:" << usCheckSum << "Not Equal To" << ucTemp;
|
||||
qDebug() << "Err:RecvData_ShortLag Failed,Incorrect Check Sum.Exit Code:4" << "Total Recv:" << qbData.size() << "Check Sum:" << usCheckSum << "Not Equal To" << ucTemp;
|
||||
//qbData.clear();
|
||||
//return 4;
|
||||
return 0;
|
||||
@ -467,16 +495,9 @@ int ZZ_ATPControl_Serial_Qt::Init_Self()
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float &fPredictedExposureTime)
|
||||
{
|
||||
int m_iThreadID=0;
|
||||
// qDebug() << "--------------------------Starting PerformAutoExposure" << " Thread ID:" << m_iThreadID;
|
||||
using namespace ZZ_MATH;
|
||||
// float fPredictedExposureTime;
|
||||
int iDeviceDepth = 65535;
|
||||
|
||||
|
||||
|
||||
// qDebug() << "MAX---Min" << fMaxScaleFactor << "---" << fMinScaleFactor << " Thread ID:" << m_iThreadID;
|
||||
|
||||
bool bFlagIsOverTrying = false;
|
||||
bool bFlagIsLowerMinExposureTime = false;
|
||||
bool bFlagIsOverMaxExposureTime = false;
|
||||
@ -486,16 +507,15 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
bool bIsValueOverflow = false;
|
||||
bool bIsLastValueOverflow = false;
|
||||
|
||||
int iExposureTime = 0;
|
||||
float fExposureTime = 0;
|
||||
float fTempExposureTime = 0;
|
||||
double fLastExposureTime = 0.1;
|
||||
int iRepeatCount = 0;
|
||||
|
||||
//int iRes = m_pFSCtrl->SetExposureTime(1000);//need change to load from files
|
||||
int iRes = 0;
|
||||
int iRes = SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS);//need change to load from files
|
||||
if (iRes != 0)
|
||||
{
|
||||
// qDebug() << "Err:PerformAutoExposure Failed.Exit Code:1" << " Thread ID:" << m_iThreadID;
|
||||
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:1";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -507,63 +527,63 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
{
|
||||
bFlagIsAutoExposureFailed = true;
|
||||
bFlagIsOverTrying = true;
|
||||
qDebug() << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>"<<endl;
|
||||
break;
|
||||
}
|
||||
//m_pFSCtrl->SetExposureTime(5000);
|
||||
GetExposureTime(iExposureTime);
|
||||
// qDebug() << "Current ExpTime:" << iExposureTime << " Thread ID:" << m_iThreadID;
|
||||
//m_pFSCtrl->SetExposureTime(2500);
|
||||
//fExposureTime = (float)m_daDeviceAttr.iMinIntegrationTimeInMS;
|
||||
fTempExposureTime = iExposureTime;
|
||||
|
||||
// fExposureTime = (float)m_daDeviceAttr.iMinIntegrationTimeInMS;
|
||||
int tc_tmp;
|
||||
GetExposureTime(tc_tmp);
|
||||
fExposureTime=tc_tmp;
|
||||
fTempExposureTime = fExposureTime;
|
||||
|
||||
iRes = SingleShot(dfTemp);
|
||||
//iRes = m_pFSCtrl->SingleShot(dfTemp);
|
||||
if (iRes != 0)
|
||||
{
|
||||
// qDebug() << "Err:PerformAutoExposure Failed.Exit Code:2" << " Thread ID:" << m_iThreadID;
|
||||
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:2"<<endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
HeapSort(dfTemp.lData, m_daDeviceAttr.iPixels);
|
||||
|
||||
double dSum = 0;
|
||||
int iCount = m_daDeviceAttr.iPixels / 200;
|
||||
int iCount = m_daDeviceAttr.iPixels / 100;
|
||||
for (int i = 0; i < iCount; i++)
|
||||
{
|
||||
dSum += dfTemp.lData[i];
|
||||
}
|
||||
double dTemp = dSum / iCount;
|
||||
qDebug() << "1111111111111111111111111111111" << dTemp << endl;
|
||||
|
||||
// qDebug() << "Avg " << dTemp << " Thread ID:" << m_iThreadID;
|
||||
|
||||
if (dTemp >= iDeviceDepth * 0.99)
|
||||
{
|
||||
bIsValueOverflow = true;
|
||||
if (!bIsLastValueOverflow)
|
||||
{
|
||||
iExposureTime = (float)(fLastExposureTime + iExposureTime) / 2;
|
||||
fExposureTime = (float)(fLastExposureTime + fExposureTime) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
iExposureTime = iExposureTime / 2;
|
||||
fExposureTime = fExposureTime / 2;
|
||||
}
|
||||
}
|
||||
|
||||
else if (iDeviceDepth * fMaxScaleFactor >= dTemp && dTemp >= iDeviceDepth * fMinScaleFactor)
|
||||
{
|
||||
// qDebug() << "trace bFlagIsAutoExposureOK =1 " << iExposureTime << " Thread ID:" << m_iThreadID;
|
||||
bFlagIsAutoExposureOK = 1;
|
||||
continue;
|
||||
}
|
||||
else if (dTemp > iDeviceDepth * fMaxScaleFactor)
|
||||
{
|
||||
bIsValueOverflow = true;
|
||||
if (!bIsLastValueOverflow)
|
||||
{
|
||||
iExposureTime = (float)(fLastExposureTime + iExposureTime) / 2;
|
||||
fExposureTime = (float)(fLastExposureTime + fExposureTime) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
iExposureTime = iExposureTime * 3 / 4;
|
||||
fExposureTime = fExposureTime * 3 / 4;
|
||||
}
|
||||
}
|
||||
else if (dTemp < iDeviceDepth * fMinScaleFactor)
|
||||
@ -571,59 +591,50 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
bIsValueOverflow = false;
|
||||
if (bIsLastValueOverflow)
|
||||
{
|
||||
iExposureTime = (float)(fLastExposureTime + iExposureTime) / 2;
|
||||
fExposureTime = (float)(fLastExposureTime + fExposureTime) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
double dFactor;
|
||||
dFactor = dTemp / (iDeviceDepth * fMaxScaleFactor);
|
||||
iExposureTime = (float)(iExposureTime / dFactor);
|
||||
fExposureTime = (float)(fExposureTime / dFactor);
|
||||
}
|
||||
if (/*fExposureTime > 100 || */iExposureTime < 10)
|
||||
if (fExposureTime < m_daDeviceAttr.iMinIntegrationTimeInMS)
|
||||
{
|
||||
bFlagIsAutoExposureOK = false;
|
||||
bFlagIsAutoExposureFailed = true;
|
||||
bFlagIsLowerMinExposureTime = true;
|
||||
|
||||
qDebug() << "lower-----------------------"<<endl;
|
||||
}
|
||||
|
||||
}
|
||||
bIsLastValueOverflow = bIsValueOverflow;
|
||||
fLastExposureTime = fTempExposureTime;
|
||||
|
||||
if (iExposureTime > 65000)
|
||||
if (fExposureTime > 13000)
|
||||
{
|
||||
bFlagIsAutoExposureOK = false;
|
||||
bFlagIsAutoExposureFailed = true;
|
||||
float fPredictedExposureTime = 65000;
|
||||
iRes = SetExposureTime(65000);
|
||||
fPredictedExposureTime = 13000;
|
||||
iRes = SetExposureTime(13000);
|
||||
if (iRes != 0)
|
||||
{
|
||||
// qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3" << " Thread ID:" << m_iThreadID;
|
||||
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3";
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
//qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to 30sec";
|
||||
// qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to " << m_daDeviceAttr.iMaxIntegrationTimeInMS << "MS" << " Thread ID:" << m_iThreadID;
|
||||
}
|
||||
bFlagIsOverMaxExposureTime = true;
|
||||
break;
|
||||
}
|
||||
|
||||
iRes = SetExposureTime((int)iExposureTime);
|
||||
iRes = SetExposureTime((int)fExposureTime);
|
||||
if (iRes != 0)
|
||||
{
|
||||
// qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4" << " Thread ID:" << m_iThreadID;
|
||||
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4";
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Success:PerformAutoExposure. Value" << iExposureTime << " Thread ID:" << m_iThreadID;
|
||||
}
|
||||
}
|
||||
fPredictedExposureTime = iExposureTime;
|
||||
// qDebug() << "--------------------------Stop PerformAutoExposure" << " Thread ID:" << m_iThreadID;
|
||||
//emit SignalAcqFinished(m_iThreadID, 1);
|
||||
|
||||
fPredictedExposureTime = fExposureTime;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -668,7 +679,7 @@ int ZZ_ATPControl_Serial_Qt::SetExposureTime(int iExposureTimeInMS)
|
||||
if ((ZZ_U8)qbRecv[0] != 0)
|
||||
{
|
||||
qDebug() << "Err:SetExposureTime Failed.Exit Code:1";
|
||||
return 1;
|
||||
//return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -717,9 +728,11 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame &dfData)
|
||||
qbSend.resize(3);
|
||||
// qbSend[1] = 0x00;
|
||||
// qbSend[2] = 0x01;
|
||||
int iTemp=m_iExposureTime;
|
||||
qbSend[1] = iTemp >> 8;;
|
||||
qbSend[2] = iTemp & 0xFF;
|
||||
qbSend[1] = m_iExposureTime >> 8;;
|
||||
qbSend[2] = m_iExposureTime & 0xFF;
|
||||
|
||||
qDebug() << "-------------"<<m_iExposureTime<<endl;
|
||||
|
||||
int iRes = SendCommand(qbSend);
|
||||
if (iRes != 0)
|
||||
{
|
||||
@ -762,11 +775,9 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame &dfData)
|
||||
// dfData.lData[i] = usData[i];
|
||||
// }
|
||||
}
|
||||
float fTemp;
|
||||
GetDeviceTemperature(fTemp);
|
||||
|
||||
dfData.usExposureTimeInMS = m_iExposureTime;
|
||||
dfData.fTemperature = fTemp;
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
|
@ -18,13 +18,13 @@ void ATPFiberImager::connectFiberSpectrometer(QString& SN, QString& pixelCount,
|
||||
|
||||
m_FiberSpectrometer = new ZZ_ATPControl_Serial_Qt();
|
||||
|
||||
m_FiberSpectrometer->Initialize(false, mUcPortNumber, "ocean_optics");
|
||||
m_FiberSpectrometer->Initialize(false, mUcPortNumber, "OPTOSKY");
|
||||
|
||||
DeviceInfo deviceInfo;//
|
||||
DeviceAttribute deviceAttribute;
|
||||
|
||||
m_FiberSpectrometer->GetDeviceInfo(deviceInfo);
|
||||
m_FiberSpectrometer->GetDeviceAttribute(deviceAttribute);
|
||||
m_FiberSpectrometer->GetDeviceAttribute(deviceAttribute);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
SN = QString::fromStdString(deviceInfo.strSN);
|
||||
pixelCount = QString::number(deviceAttribute.iPixels);
|
||||
@ -86,6 +86,11 @@ void ATPFiberImager::singleShot(DataFrame &dfData)
|
||||
m_FiberSpectrometer->SingleShot(dfData);
|
||||
}
|
||||
|
||||
void ATPFiberImager::getNonlinearityCoeffs(coeffsFrame &coeffs)
|
||||
{
|
||||
printf("This is ATPFiberImager.\n");
|
||||
}
|
||||
|
||||
void ATPFiberImager::recordDark(QString path)
|
||||
{
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
||||
@ -171,7 +176,7 @@ void ATPFiberImager::recordTarget(int recordTimes, QString path)
|
||||
void ATPFiberImager::autoExpose()
|
||||
{
|
||||
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)
|
||||
|
@ -516,6 +516,77 @@ const char* OceanOptics_lib::get_error_string(int error)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void OceanOptics_lib::test_nonlinearity_coeffs_feature()
|
||||
{
|
||||
using namespace seabreeze;
|
||||
using namespace seabreeze::api;
|
||||
using namespace std;
|
||||
|
||||
NonlinearityCoeffsFeatureAdapter tmp();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// int error = 0;
|
||||
// int number_of_nonlinearity_coeff_features;
|
||||
// long *nonlinearity_coeff_feature_ids = 0;
|
||||
// double buffer[10];
|
||||
// int i;
|
||||
// int length;
|
||||
//
|
||||
// printf("\n\tTesting nonlinearity coefficient features:\n");
|
||||
//
|
||||
// printf("\t\tGetting number of nonlinearity coefficient features:\n");
|
||||
// number_of_nonlinearity_coeff_features =
|
||||
// sbapi_get_number_of_nonlinearity_coeffs_features(m_iSpectralmeterHandle, &error);
|
||||
// printf("\t\t\tResult is %d [%s]\n", number_of_nonlinearity_coeff_features,
|
||||
// sbapi_get_error_string(error));
|
||||
//
|
||||
// if(0 == number_of_nonlinearity_coeff_features) {
|
||||
// printf("\tNo nonlinearity coefficient capabilities found.\n");
|
||||
//// tallyUnsupportedFeatures(unsupportedFeatureCount);
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// nonlinearity_coeff_feature_ids =
|
||||
// (long *)calloc(number_of_nonlinearity_coeff_features, sizeof(long));
|
||||
// printf("\t\tGetting nonlinearity coefficient feature IDs...\n");
|
||||
// number_of_nonlinearity_coeff_features = sbapi_get_nonlinearity_coeffs_features(
|
||||
// m_iSpectralmeterHandle, &error, nonlinearity_coeff_feature_ids,
|
||||
// number_of_nonlinearity_coeff_features);
|
||||
// printf("\t\t\tResult is %d [%s]\n", number_of_nonlinearity_coeff_features,
|
||||
// sbapi_get_error_string(error));
|
||||
//
|
||||
// for(i = 0; i < number_of_nonlinearity_coeff_features; i++) {
|
||||
// printf("\t\t%d: Testing device 0x%02lX, nonlinearity coeffs 0x%02lX\n",
|
||||
// i, m_iSpectralmeterHandle, nonlinearity_coeff_feature_ids[i]);
|
||||
//
|
||||
// printf("\t\t\tAttempting to get nonlinearity coefficients...\n");
|
||||
// memset(buffer, (int)0, sizeof(buffer));
|
||||
// length = sbapi_nonlinearity_coeffs_get(m_iSpectralmeterHandle,
|
||||
// nonlinearity_coeff_feature_ids[i], &error, buffer, 10);
|
||||
// printf("\t\t\t\tResult is %d [%s]\n", length, sbapi_get_error_string(error));
|
||||
//
|
||||
// if(0 == error && length > 0) {
|
||||
// printf("\t\t\t\tFirst calibration term: %1.2e\n", buffer[0]);
|
||||
// }
|
||||
//
|
||||
// printf("\t\t%d: Finished testing device 0x%02lX, nonlinearity coeffs 0x%02lX\n",
|
||||
// i, m_iSpectralmeterHandle, nonlinearity_coeff_feature_ids[i]);
|
||||
// }
|
||||
// free(nonlinearity_coeff_feature_ids);
|
||||
//
|
||||
// printf("\tFinished testing nonlinearity coefficient capabilities.\n");
|
||||
}
|
||||
|
||||
string OceanOptics_lib::GetDeviceType(int index)
|
||||
{
|
||||
char type[16];
|
||||
|
@ -47,6 +47,9 @@ void logout(QString str);
|
||||
void createDirectory(QString fullPath);
|
||||
bool isFileExist(QString fullFileName);
|
||||
|
||||
int getNonlinearityCoeffs2(long deviceID, double * nonlinearityCoeffs);
|
||||
int getNonlinearityCoeffs1(double * nonlinearityCoeffs);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
@ -85,19 +88,30 @@ int main(int argc, char *argv[])
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>
|
||||
FiberSpectrometerOperationBase * m_FiberSpectrometer;
|
||||
bool isOcean = false;
|
||||
double * nonlinearityCoeffs;
|
||||
int numberOfNonlinearityCoeffs;
|
||||
switch (query.deviceType)
|
||||
{
|
||||
case OPTOSKY:
|
||||
m_FiberSpectrometer = new ATPFiberImager(false,query.serialPort.toStdString(),"ocean_optics");
|
||||
m_FiberSpectrometer = new ATPFiberImager(false,query.serialPort.toStdString(),"OPTOSKY");
|
||||
break;
|
||||
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;
|
||||
}
|
||||
case UnknownDevice:
|
||||
parser.showHelp();
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
|
||||
//<2F><><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>
|
||||
QString message;
|
||||
QString SN;
|
||||
@ -106,9 +120,11 @@ int main(int argc, char *argv[])
|
||||
logout("<br><b style=\"color:red\">Connectting the fiber spectrometer!</b>");
|
||||
m_FiberSpectrometer->connectFiberSpectrometer(SN, pixelCount, wavelengthInfo);
|
||||
|
||||
|
||||
|
||||
//<2F>Զ<EFBFBD><D4B6>ع<EFBFBD>
|
||||
logout("<br><b style=\"color:red\">AutoExpose!</b>");
|
||||
m_FiberSpectrometer->autoExpose();
|
||||
// m_FiberSpectrometer->autoExpose();
|
||||
|
||||
int iExposureTime;
|
||||
m_FiberSpectrometer->getExposureTime(iExposureTime);
|
||||
@ -163,8 +179,36 @@ int main(int argc, char *argv[])
|
||||
QString destName = QDir::cleanPath(query.calFileOutputDirectory + QDir::separator() + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + "_" +QString::number(query.position) + ".cal");
|
||||
copyFileToPath(query.calFileOutputName,destName,true);
|
||||
|
||||
|
||||
//<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>
|
||||
if (isOcean)
|
||||
{
|
||||
QDateTime curDateTime = QDateTime::currentDateTime();
|
||||
QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss");
|
||||
QString nonlinearityCoeffsName = QDir::cleanPath(query.calFileOutputDirectory + QDir::separator() + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + ".nonLinear");
|
||||
|
||||
// for (int i = 0; i < numberOfNonlinearityCoeffs; ++i)
|
||||
// {
|
||||
// printf("\n");
|
||||
//
|
||||
// printf("nonlinearityCoeffs(<28><>%d<><64>): %1.2e\n",i , nonlinearityCoeffs[i]);
|
||||
//
|
||||
// printf("\n");
|
||||
// }
|
||||
|
||||
std::ofstream outfile(nonlinearityCoeffsName.toStdString().c_str());
|
||||
|
||||
for (int i = 0; i < numberOfNonlinearityCoeffs; i++)
|
||||
{
|
||||
outfile << nonlinearityCoeffs[i] << std::endl;
|
||||
}
|
||||
outfile.close();
|
||||
|
||||
free(nonlinearityCoeffs);
|
||||
}
|
||||
|
||||
//<2F>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_FiberSpectrometer->disconnectFiberSpectrometer();
|
||||
m_FiberSpectrometer->disconnectFiberSpectrometer();//Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD>free(nonlinearityCoeffs);
|
||||
//return a.exec();
|
||||
}
|
||||
|
||||
@ -485,3 +529,155 @@ bool isFileExist(QString fullFileName)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int getNonlinearityCoeffs1(double * nonlinearityCoeffs)
|
||||
{
|
||||
int number_of_devices;
|
||||
long *device_ids;
|
||||
int i;
|
||||
int test_index;
|
||||
int flag;
|
||||
int error = 0;
|
||||
char nameBuffer[80];
|
||||
|
||||
|
||||
/* Give the driver a chance to initialize itself */
|
||||
sbapi_initialize();
|
||||
|
||||
// printf("Probing for devices...\n"); fflush(stdout);
|
||||
sbapi_probe_devices();
|
||||
|
||||
//#define RS232_TEST
|
||||
#ifdef RS232_TEST
|
||||
printf("Adding an STS at 9600 baud...\n");
|
||||
/* Uncomment for Linux */
|
||||
//sbapi_add_RS232_device_location("STS", "/dev/ttyS0", 9600);
|
||||
//sbapi_add_RS232_device_location("STS", "/dev/ttyUSB0", 9600);
|
||||
|
||||
/* Uncomment for Windows */
|
||||
//sbapi_add_RS232_device_location("STS", "COM1", 9600);
|
||||
|
||||
/* Uncomment for e.g. USB-RS232 adapter under OSX */
|
||||
//sbapi_add_RS232_device_location("STS", "/dev/tty.KeySerial1", 9600);
|
||||
//sbapi_add_RS232_device_location("STS", "/dev/tty.usbserial", 9600);
|
||||
#endif
|
||||
|
||||
/* This shows how to add network devices (note that most use TCP/IP) */
|
||||
//sbapi_add_TCPIPv4_device_location("Jaz", "192.168.1.150", 7654);
|
||||
//sbapi_add_TCPIPv4_device_location("Blaze", "192.168.1.151", 57357);
|
||||
|
||||
// printf("Getting device count...\n"); fflush(stdout);
|
||||
number_of_devices = sbapi_get_number_of_device_ids();
|
||||
|
||||
// printf("Device count is %d\n", number_of_devices);
|
||||
if(0 == number_of_devices) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// printf("Getting device IDs...\n");
|
||||
device_ids = (long *)calloc(number_of_devices, sizeof(long));
|
||||
number_of_devices = sbapi_get_device_ids(device_ids, number_of_devices);
|
||||
// printf("Got %d device ID%s.\n", number_of_devices, number_of_devices == 1 ? "" : "s");
|
||||
|
||||
int number;
|
||||
for(i = 0; i < number_of_devices; i++) {
|
||||
// printf("%d: Device 0x%02lX:\n", i, device_ids[i]);
|
||||
// printf("\tGetting device type...\n");
|
||||
flag = sbapi_get_device_type(device_ids[i], &error, nameBuffer, 79);
|
||||
// printf("\t\tResult is (%d) [%s]\n", flag, sbapi_get_error_string(error));
|
||||
if(flag > 0) {
|
||||
// printf("\tDevice type: [%s]\n", nameBuffer);
|
||||
}
|
||||
|
||||
/* Open the device */
|
||||
// printf("\tAttempting to open:\n");
|
||||
flag = sbapi_open_device(device_ids[i], &error);
|
||||
// printf("\t\tResult is (%d) [%s]\n", flag, sbapi_get_error_string(error));
|
||||
|
||||
// jump to the next iteration if there was a problem
|
||||
if(flag != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
number = getNonlinearityCoeffs2(device_ids[i],nonlinearityCoeffs);
|
||||
|
||||
/* Close the device */
|
||||
// printf("\tAttempting to close:\n");
|
||||
sbapi_close_device(device_ids[i], &error);
|
||||
// printf("\t\tResult is (%d) [%s]\n", flag, sbapi_get_error_string(error));
|
||||
}
|
||||
free(device_ids);
|
||||
|
||||
// printf("Finished testing.\n");
|
||||
|
||||
/* Clean up memory allocated by the driver */
|
||||
sbapi_shutdown();
|
||||
|
||||
return number;
|
||||
}//
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ֵ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ϵ<EFBFBD><CFB5><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>
|
||||
int getNonlinearityCoeffs2(long deviceID, double * nonlinearityCoeffs)
|
||||
{
|
||||
int error = 0;
|
||||
int number_of_nonlinearity_coeff_features;
|
||||
long *nonlinearity_coeff_feature_ids = 0;
|
||||
double buffer[10];
|
||||
int i;
|
||||
int length = 0;
|
||||
|
||||
// printf("\n\tTesting nonlinearity coefficient features:\n");
|
||||
|
||||
// printf("\t\tGetting number of nonlinearity coefficient features:\n");
|
||||
number_of_nonlinearity_coeff_features =
|
||||
sbapi_get_number_of_nonlinearity_coeffs_features(deviceID, &error);
|
||||
// printf("\t\t\tResult is %d [%s]\n", number_of_nonlinearity_coeff_features,
|
||||
// sbapi_get_error_string(error));
|
||||
|
||||
if(0 == number_of_nonlinearity_coeff_features) {
|
||||
printf("\tNo nonlinearity coefficient capabilities found.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
nonlinearity_coeff_feature_ids =
|
||||
(long *)calloc(number_of_nonlinearity_coeff_features, sizeof(long));
|
||||
// printf("\t\tGetting nonlinearity coefficient feature IDs...\n");
|
||||
number_of_nonlinearity_coeff_features = sbapi_get_nonlinearity_coeffs_features(
|
||||
deviceID, &error, nonlinearity_coeff_feature_ids,
|
||||
number_of_nonlinearity_coeff_features);
|
||||
// printf("\t\t\tResult is %d [%s]\n", number_of_nonlinearity_coeff_features,
|
||||
// sbapi_get_error_string(error));
|
||||
|
||||
for(i = 0; i < number_of_nonlinearity_coeff_features; i++)
|
||||
{
|
||||
// printf("\t\t%d: Testing device 0x%02lX, nonlinearity coeffs 0x%02lX\n",
|
||||
// i, deviceID, nonlinearity_coeff_feature_ids[i]);
|
||||
|
||||
// printf("\t\t\tAttempting to get nonlinearity coefficients...\n");
|
||||
memset(nonlinearityCoeffs, (int)0, 20);//----------------------------------------------------------------------------
|
||||
length = sbapi_nonlinearity_coeffs_get(deviceID,
|
||||
nonlinearity_coeff_feature_ids[i], &error, nonlinearityCoeffs, 20);
|
||||
// printf("\t\t\t\tResult is %d [%s]\n", length, sbapi_get_error_string(error));
|
||||
|
||||
if(0 == error && length > 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",
|
||||
// i, deviceID, nonlinearity_coeff_feature_ids[i]);
|
||||
}
|
||||
free(nonlinearity_coeff_feature_ids);
|
||||
|
||||
|
||||
|
||||
// printf("\tFinished testing nonlinearity coefficient capabilities.\n");
|
||||
|
||||
return length;
|
||||
}
|
@ -1,8 +1,11 @@
|
||||
#include "Header_Files/oceanOpticsFiberImager.h"
|
||||
|
||||
OceanOpticsFiberImager::OceanOpticsFiberImager()
|
||||
OceanOpticsFiberImager::OceanOpticsFiberImager(double * nonlinearityCoeffs, int numberOfCoeffs)
|
||||
{
|
||||
m_FiberSpectrometer = NULL;
|
||||
|
||||
m_nonlinearityCoeffs = nonlinearityCoeffs;
|
||||
m_iNumberOfNonlinearityCoeffs = numberOfCoeffs;
|
||||
}
|
||||
|
||||
OceanOpticsFiberImager::~OceanOpticsFiberImager()
|
||||
@ -18,15 +21,15 @@ void OceanOpticsFiberImager::connectFiberSpectrometer(QString& SN, QString& pixe
|
||||
|
||||
m_FiberSpectrometer->Initialize();
|
||||
|
||||
DeviceInfo deviceInfo;
|
||||
DeviceAttribute deviceAttribute;
|
||||
getDeviceInfo(m_deviceInfo);
|
||||
// m_FiberSpectrometer->GetDeviceInfo(m_deviceInfo);
|
||||
|
||||
m_FiberSpectrometer->GetDeviceInfo(deviceInfo);
|
||||
m_FiberSpectrometer->GetDeviceAttribute(deviceAttribute);
|
||||
getDeviceAttribute(m_deviceAttribute);
|
||||
// m_FiberSpectrometer->GetDeviceAttribute(m_deviceAttribute);
|
||||
|
||||
SN = QString::fromStdString(deviceInfo.strSN);
|
||||
pixelCount = QString::number(deviceAttribute.iPixels);
|
||||
wavelengthInfo = QString::number(deviceAttribute.fWaveLengthInNM[0]) + "--" + QString::number(deviceAttribute.fWaveLengthInNM[deviceAttribute.iPixels - 1]);
|
||||
SN = QString::fromStdString(m_deviceInfo.strSN);
|
||||
pixelCount = QString::number(m_deviceAttribute.iPixels);
|
||||
wavelengthInfo = QString::number(m_deviceAttribute.fWaveLengthInNM[0]) + "--" + QString::number(m_deviceAttribute.fWaveLengthInNM[m_deviceAttribute.iPixels - 1]);
|
||||
|
||||
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>
|
||||
string qepro = "QEP";
|
||||
string flame = "FLMS";
|
||||
if (deviceInfo.strSN.find(qepro) != string::npos)
|
||||
if (m_deviceInfo.strSN.find(qepro) != string::npos)
|
||||
{
|
||||
m_MaxValueOfFiberSpectrometer = 200000;
|
||||
}
|
||||
else if (deviceInfo.strSN.find(flame) != string::npos)
|
||||
else if (m_deviceInfo.strSN.find(flame) != string::npos)
|
||||
{
|
||||
m_MaxValueOfFiberSpectrometer = 65535;
|
||||
}
|
||||
@ -81,6 +84,32 @@ void OceanOpticsFiberImager::getDeviceTemperature(float &fTemperature)
|
||||
void OceanOpticsFiberImager::singleShot(DataFrame &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)
|
||||
{
|
||||
printf("This is OceanOpticsFiberImager.\n");
|
||||
|
||||
m_FiberSpectrometer->test_nonlinearity_coeffs_feature();
|
||||
}
|
||||
|
||||
void OceanOpticsFiberImager::recordDark(QString path)
|
||||
|
Reference in New Issue
Block a user