mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-18 19:39:43 +08:00
(1)将atp光谱仪的控制类更新到卓哥最新版,解决连接atp的问题;
(2)将读取OceanOptics的非线性校正文件 集成到定标程序中;
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;
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
|
||||
void singleShot(DataFrame &dfData);
|
||||
|
||||
void getNonlinearityCoeffs(coeffsFrame &coeffs);
|
||||
|
||||
ZZ_S32 GetMaxValue(ZZ_S32 * dark, int number);
|
||||
|
||||
// DataFrame m_IntegratingSphereData;
|
||||
|
@ -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(2000);//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;
|
||||
}
|
||||
|
||||
@ -509,49 +529,42 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
bFlagIsOverTrying = true;
|
||||
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;
|
||||
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";
|
||||
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() << "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;
|
||||
}
|
||||
else if (dTemp > iDeviceDepth * fMaxScaleFactor)
|
||||
@ -559,11 +572,11 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
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,15 +584,15 @@ 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 > 100 || */fExposureTime < 10)
|
||||
{
|
||||
bFlagIsAutoExposureOK = false;
|
||||
bFlagIsAutoExposureFailed = true;
|
||||
@ -589,41 +602,29 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
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;
|
||||
}
|
||||
|
||||
@ -717,9 +718,8 @@ 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;
|
||||
int iRes = SendCommand(qbSend);
|
||||
if (iRes != 0)
|
||||
{
|
||||
@ -762,11 +762,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>Ϣ
|
||||
|
@ -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 * coeffs);
|
||||
int getNonlinearityCoeffs1(double * coeffs);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
@ -88,16 +91,17 @@ int main(int argc, char *argv[])
|
||||
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();
|
||||
m_FiberSpectrometer = new OceanOpticsFiberImager();//
|
||||
break;
|
||||
case UnknownDevice:
|
||||
parser.showHelp();
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
|
||||
//<2F><><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>
|
||||
QString message;
|
||||
QString SN;
|
||||
@ -106,66 +110,115 @@ 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();
|
||||
|
||||
int iExposureTime;
|
||||
m_FiberSpectrometer->getExposureTime(iExposureTime);
|
||||
|
||||
message="<br><b style=\"color:red\">ExposureTime: " + QString::number(iExposureTime) + "</b>";
|
||||
logout(message);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>sleep<65><70><EFBFBD>ȴ<EFBFBD><C8B4>رտ<D8B1><D5BF><EFBFBD>
|
||||
message="<br><b style=\"color:red\">Please close the lamp in " + QString::number(query.sleepTimeinSecond) + "s!</b>";
|
||||
logout(message);
|
||||
QThread::sleep(query.sleepTimeinSecond);
|
||||
|
||||
//<2F>ɼ<EFBFBD><C9BC><EFBFBD>֡
|
||||
logout("<br><b style=\"color:red\">Record dark frame!</b>");
|
||||
m_FiberSpectrometer->recordDark(query.calFileOutputDirectory);
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>sleep<EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
message="<br><b style=\"color:red\">Please open the lamp in " + QString::number(query.sleepTimeinSecond) + "s!</b>";
|
||||
logout(message);
|
||||
QThread::sleep(query.sleepTimeinSecond);
|
||||
|
||||
//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
logout("<br><b style=\"color:red\">Record integrating sphere frame!</b>");
|
||||
m_FiberSpectrometer->recordTarget(query.averageTimes, query.calFileOutputDirectory);
|
||||
|
||||
//<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
logout("<br><b style=\"color:red\">readAndResample_StandardLightFile!</b>");
|
||||
// //<2F>Զ<EFBFBD><EFBFBD>ع<EFBFBD>
|
||||
// logout("<br><b style=\"color:red\">AutoExpose!</b>");
|
||||
// m_FiberSpectrometer->autoExpose();
|
||||
//
|
||||
// int iExposureTime;
|
||||
// m_FiberSpectrometer->getExposureTime(iExposureTime);
|
||||
//
|
||||
// message="<br><b style=\"color:red\">ExposureTime: " + QString::number(iExposureTime) + "</b>";
|
||||
// logout(message);
|
||||
//
|
||||
// //<2F><><EFBFBD><EFBFBD>sleep<65><70><EFBFBD>ȴ<EFBFBD><C8B4>رտ<D8B1><D5BF><EFBFBD>
|
||||
// message="<br><b style=\"color:red\">Please close the lamp in " + QString::number(query.sleepTimeinSecond) + "s!</b>";
|
||||
// logout(message);
|
||||
// QThread::sleep(query.sleepTimeinSecond);
|
||||
//
|
||||
// //<2F>ɼ<EFBFBD><C9BC><EFBFBD>֡
|
||||
// logout("<br><b style=\"color:red\">Record dark frame!</b>");
|
||||
// m_FiberSpectrometer->recordDark(query.calFileOutputDirectory);
|
||||
//
|
||||
//
|
||||
// //<2F><><EFBFBD><EFBFBD>sleep<65><70><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><F2BFAABF><EFBFBD>
|
||||
// message="<br><b style=\"color:red\">Please open the lamp in " + QString::number(query.sleepTimeinSecond) + "s!</b>";
|
||||
// logout(message);
|
||||
// QThread::sleep(query.sleepTimeinSecond);
|
||||
//
|
||||
// //<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// logout("<br><b style=\"color:red\">Record integrating sphere frame!</b>");
|
||||
// m_FiberSpectrometer->recordTarget(query.averageTimes, query.calFileOutputDirectory);
|
||||
//
|
||||
// //<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
// logout("<br><b style=\"color:red\">readAndResample_StandardLightFile!</b>");
|
||||
DeviceAttribute deviceAttribute;
|
||||
DeviceInfo deviceInfo;
|
||||
m_FiberSpectrometer->getDeviceAttribute(deviceAttribute);
|
||||
m_FiberSpectrometer->getDeviceInfo(deviceInfo);
|
||||
//
|
||||
// CalibrationAlgorithm * m_CalibrationAlgorithm = new CalibrationAlgorithm();
|
||||
// m_CalibrationAlgorithm->readAndResample_StandardLightFile(query.standardLightFilePath,query.integratingSphereDetectorValue, deviceAttribute, deviceInfo);
|
||||
//
|
||||
// //<2F><><EFBFBD>ɷ<EFBFBD><C9B7>䶨<EFBFBD><E4B6A8><EFBFBD>ļ<EFBFBD>
|
||||
// if (query.calFileOutputName.isEmpty())//query->calFileOutputName==""
|
||||
// {
|
||||
// QDateTime curDateTime = QDateTime::currentDateTime();
|
||||
// QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss");
|
||||
// QString calFileName = QDir::cleanPath(query.calFileOutputDirectory + QDir::separator() + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + ".dat");
|
||||
//
|
||||
// query.calFileOutputName=calFileName;
|
||||
// }
|
||||
// logout("<br><b style=\"color:red\">Produce calibration file!</b>");
|
||||
// m_CalibrationAlgorithm->produceCalfile(query.calFileOutputName, deviceAttribute, m_FiberSpectrometer->m_IntegratingSphereData, m_FiberSpectrometer->m_DarkData);
|
||||
//
|
||||
// //<2F><><EFBFBD>Ʒ<EFBFBD><C6B7>䶨<EFBFBD><E4B6A8><EFBFBD>ļ<EFBFBD>
|
||||
// QDateTime curDateTime = QDateTime::currentDateTime();
|
||||
// QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss");
|
||||
// QString destName = QDir::cleanPath(query.calFileOutputDirectory + QDir::separator() + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + "_" +QString::number(query.position) + ".cal");
|
||||
// copyFileToPath(query.calFileOutputName,destName,true);
|
||||
|
||||
CalibrationAlgorithm * m_CalibrationAlgorithm = new CalibrationAlgorithm();
|
||||
m_CalibrationAlgorithm->readAndResample_StandardLightFile(query.standardLightFilePath,query.integratingSphereDetectorValue, deviceAttribute, deviceInfo);
|
||||
|
||||
//<2F><><EFBFBD>ɷ<EFBFBD><C9B7>䶨<EFBFBD><E4B6A8><EFBFBD>ļ<EFBFBD>
|
||||
if (query.calFileOutputName.isEmpty())//query->calFileOutputName==""
|
||||
//<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)
|
||||
{
|
||||
QDateTime curDateTime = QDateTime::currentDateTime();
|
||||
QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss");
|
||||
QString calFileName = QDir::cleanPath(query.calFileOutputDirectory + QDir::separator() + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + ".dat");
|
||||
// cout << "Match!!" << endl;
|
||||
isOcean=true;
|
||||
|
||||
query.calFileOutputName=calFileName;
|
||||
// coeffsFrame tmp;
|
||||
// m_FiberSpectrometer->getNonlinearityCoeffs(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "not OceanOpticsFiberImager!!" << endl;
|
||||
}
|
||||
logout("<br><b style=\"color:red\">Produce calibration file!</b>");
|
||||
m_CalibrationAlgorithm->produceCalfile(query.calFileOutputName, deviceAttribute, m_FiberSpectrometer->m_IntegratingSphereData, m_FiberSpectrometer->m_DarkData);
|
||||
|
||||
//<2F><><EFBFBD>Ʒ<EFBFBD><C6B7>䶨<EFBFBD><E4B6A8><EFBFBD>ļ<EFBFBD>
|
||||
QDateTime curDateTime = QDateTime::currentDateTime();
|
||||
QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss");
|
||||
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><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)
|
||||
{
|
||||
double * coeffs = new double[100];
|
||||
int numberOfCoeffs = getNonlinearityCoeffs1(coeffs);
|
||||
|
||||
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 < numberOfCoeffs; ++i)
|
||||
// {
|
||||
// printf("\n");
|
||||
//
|
||||
// printf("nonlinearityCoeffs(<28><>%d<><64>): %1.2e\n",i , coeffs[i]);
|
||||
//
|
||||
// printf("\n");
|
||||
// }
|
||||
|
||||
std::ofstream outfile(nonlinearityCoeffsName.toStdString().c_str());
|
||||
|
||||
for (int i = 0; i < numberOfCoeffs; i++)
|
||||
{
|
||||
outfile << coeffs[i] << std::endl;
|
||||
}
|
||||
outfile.close();
|
||||
|
||||
free(coeffs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CommandLineParseResult parseCommandLine2(QCommandLineParser &parser, TcQuery *query, QString *errorMessage)
|
||||
@ -485,3 +538,149 @@ bool isFileExist(QString fullFileName)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int getNonlinearityCoeffs1(double * coeffs)
|
||||
{
|
||||
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],coeffs);
|
||||
|
||||
/* 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 * coeffs)
|
||||
{
|
||||
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(coeffs, (int)0, 20);//----------------------------------------------------------------------------
|
||||
length = sbapi_nonlinearity_coeffs_get(deviceID,
|
||||
nonlinearity_coeff_feature_ids[i], &error, coeffs, 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", coeffs[0]);
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
@ -83,6 +83,13 @@ void OceanOpticsFiberImager::singleShot(DataFrame &dfData)
|
||||
m_FiberSpectrometer->SingleShot(dfData);
|
||||
}
|
||||
|
||||
void OceanOpticsFiberImager::getNonlinearityCoeffs(coeffsFrame &coeffs)
|
||||
{
|
||||
printf("This is OceanOpticsFiberImager.\n");
|
||||
|
||||
m_FiberSpectrometer->test_nonlinearity_coeffs_feature();
|
||||
}
|
||||
|
||||
void OceanOpticsFiberImager::recordDark(QString path)
|
||||
{
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
||||
|
Reference in New Issue
Block a user