1.修改了海阳光学光谱仪派生类,以支持暗像素信息的获取。
2.针对FLAME设备添加了新的实时暗背景扣除函数。 3.修改了部分系统执行逻辑,以支持FLAME的正确运行。
This commit is contained in:
@ -35,6 +35,7 @@ int CAbsFSController::Initialize()
|
||||
printf("Flame Not Opened");
|
||||
return 1;
|
||||
}
|
||||
GetDarkPixelIndices();
|
||||
break;
|
||||
case DeviceModel::OSIFAlpha:
|
||||
m_pFSCtrl = new OceanOptics_lib;
|
||||
@ -400,6 +401,27 @@ int CAbsFSController::CheckAndAdjust_Fast()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CAbsFSController::GetDarkPixelIndices()
|
||||
{
|
||||
m_vecDarkPixleIndices.clear();
|
||||
|
||||
if (m_struFSParam.ucDeviceModel == DeviceModel::FLAME)
|
||||
{
|
||||
m_vecDarkPixleIndices = ((OceanOptics_lib*)m_pFSCtrl)->m_vecDarkPixels;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////debug only
|
||||
/*qDebug() << m_vecDarkPixleIndices.size();
|
||||
qDebug() << ((OceanOptics_lib*)m_pFSCtrl)->m_vecDarkPixels.size();
|
||||
for (int i=0;i< m_vecDarkPixleIndices.size();i++)
|
||||
{
|
||||
qDebug() << m_vecDarkPixleIndices[i];
|
||||
}*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////debug only
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CAbsFSController::GetDeviceAttr(DeviceAttribute& struDeviceAttr)
|
||||
{
|
||||
struDeviceAttr = m_struDeviceAttr;
|
||||
|
@ -29,15 +29,19 @@ public:
|
||||
int PerformAutoExposure();
|
||||
int CheckAndAdjust_Fast();
|
||||
|
||||
int GetDarkPixelIndices();
|
||||
|
||||
void GetDeviceAttr(DeviceAttribute &struDeviceAttr);
|
||||
public:
|
||||
std::atomic_int m_iFlagInit;
|
||||
std::vector<int> m_vecDarkPixleIndices;
|
||||
DeviceAttribute m_struDeviceAttr;
|
||||
private:
|
||||
DeviceAttribute m_struDeviceAttr;
|
||||
CIrisFSBase* m_pFSCtrl;
|
||||
OneFSContext m_struFSParam;
|
||||
DataFrame m_struSingleFrame;
|
||||
QString m_qstrWaveLengthPath;
|
||||
|
||||
CIrisFSBase* m_pFSCtrl;
|
||||
OneFSContext m_struFSParam;
|
||||
DataFrame m_struSingleFrame;
|
||||
QString m_qstrWaveLengthPath;
|
||||
private:
|
||||
//int CreateWavelengthFile();
|
||||
public slots:
|
||||
|
@ -81,12 +81,18 @@ int CMainGrabber::Initialize_Self()
|
||||
{
|
||||
InitializeWorkers();
|
||||
SetupMsgPipelines();
|
||||
LoadDCT();
|
||||
if (m_struFSRunParams.ucDeviceModel== DeviceModel::FLAME)
|
||||
{
|
||||
//do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadDCT();
|
||||
}
|
||||
|
||||
emit Signal_InitFinished();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CMainGrabber::Delay_MSec(ZZ_U16 usMS)
|
||||
{
|
||||
@ -114,6 +120,12 @@ int CMainGrabber::InitializeWorkers()
|
||||
}
|
||||
m_pctrlFS->GetDeviceAttr(m_struDeviceAttr);
|
||||
m_dfpDataSaver->WriteWavelengthInfo(m_struDeviceAttr.fWaveLengthInNM, m_struDeviceAttr.iPixels);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////20230713
|
||||
if (m_struFSRunParams.dMinSamplingInterval < m_pctrlFS->m_struDeviceAttr.iMaxIntegrationTimeInMS)
|
||||
{
|
||||
m_pctrlFS->m_struDeviceAttr.iMaxIntegrationTimeInMS = m_struFSRunParams.dMinSamplingInterval * 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -202,45 +214,65 @@ int CMainGrabber::CheckExposureTime(DataFrame dfTemp)
|
||||
|
||||
int CMainGrabber::RemoveBackground(DataFrame& dfTemp)
|
||||
{
|
||||
int iA = dfTemp.usExposureTimeInMS / 10;
|
||||
int iB = dfTemp.usExposureTimeInMS % 10;
|
||||
|
||||
qDebug() << "iA" << iA;
|
||||
qDebug() << "iB" << iB;
|
||||
|
||||
if (iA == 0)
|
||||
if (m_struFSRunParams.ucDeviceModel==DeviceModel::FLAME)
|
||||
{
|
||||
m_dfBackground = m_vecDataFrame[iB];
|
||||
double dBackground = 0;
|
||||
for (int i=0;i< m_pctrlFS->m_vecDarkPixleIndices.size();i++)
|
||||
{
|
||||
dBackground += dfTemp.lData[m_pctrlFS->m_vecDarkPixleIndices[i]];
|
||||
}
|
||||
dBackground = dBackground / m_pctrlFS->m_vecDarkPixleIndices.size();
|
||||
|
||||
for (int i = 0; i < m_struDeviceAttr.iPixels; i++)
|
||||
{
|
||||
dfTemp.lData[i] = dfTemp.lData[i] - dBackground;
|
||||
}
|
||||
|
||||
qDebug() << "FLAME Real Time Background" << dBackground;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iA>100)
|
||||
int iA = dfTemp.usExposureTimeInMS / 10;
|
||||
int iB = dfTemp.usExposureTimeInMS % 10;
|
||||
|
||||
qDebug() << "iA" << iA;
|
||||
qDebug() << "iB" << iB;
|
||||
|
||||
if (iA == 0)
|
||||
{
|
||||
m_dfBackground = m_vecDataFrame[m_vecDataFrame.size()-1];
|
||||
}
|
||||
else if(iA<=9&&iA>=1)
|
||||
{
|
||||
m_dfBackground = m_vecDataFrame[8 + iA];
|
||||
m_dfBackground = m_vecDataFrame[iB-1];
|
||||
}
|
||||
else
|
||||
{
|
||||
int iAA= dfTemp.usExposureTimeInMS / 100;
|
||||
int iBB= dfTemp.usExposureTimeInMS % 100;
|
||||
|
||||
DataFrame dfTempX1, dfTempX2;
|
||||
dfTempX1 = m_vecDataFrame[17 + iAA];
|
||||
dfTempX2 = m_vecDataFrame[18 + iAA];
|
||||
|
||||
for (int i=0;i< m_struDeviceAttr.iPixels;i++)
|
||||
if (iA > 100)
|
||||
{
|
||||
m_dfBackground.lData[i] = dfTempX1.lData[i] + (dfTempX2.lData[i] - dfTempX1.lData[i]) * (double)iBB / (double)100;
|
||||
m_dfBackground = m_vecDataFrame[m_vecDataFrame.size() - 1];
|
||||
}
|
||||
else if (iA <= 9 && iA >= 1)
|
||||
{
|
||||
m_dfBackground = m_vecDataFrame[8 + iA];
|
||||
}
|
||||
else
|
||||
{
|
||||
int iAA = dfTemp.usExposureTimeInMS / 100;
|
||||
int iBB = dfTemp.usExposureTimeInMS % 100;
|
||||
|
||||
DataFrame dfTempX1, dfTempX2;
|
||||
dfTempX1 = m_vecDataFrame[17 + iAA];
|
||||
dfTempX2 = m_vecDataFrame[18 + iAA];
|
||||
|
||||
for (int i = 0; i < m_struDeviceAttr.iPixels; i++)
|
||||
{
|
||||
m_dfBackground.lData[i] = dfTempX1.lData[i] + (dfTempX2.lData[i] - dfTempX1.lData[i]) * (double)iBB / (double)100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_struDeviceAttr.iPixels; i++)
|
||||
{
|
||||
dfTemp.lData[i] = dfTemp.lData[i] - m_dfBackground.lData[i];
|
||||
for (int i = 0; i < m_struDeviceAttr.iPixels; i++)
|
||||
{
|
||||
dfTemp.lData[i] = dfTemp.lData[i] - m_dfBackground.lData[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user