add
支持corning 410,并添加配置文件
This commit is contained in:
158
HPPA/Corning410Imager.cpp
Normal file
158
HPPA/Corning410Imager.cpp
Normal file
@ -0,0 +1,158 @@
|
||||
#include "Corning410Imager.h"
|
||||
|
||||
Corning410Imager::Corning410Imager()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>У<EFBFBD><D0A3>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
string CfgFile = getPathofEXE() + "\\corning410.cfg";
|
||||
m_configfile.setConfigfilePath(CfgFile);
|
||||
if (!m_configfile.isConfigfileExist())
|
||||
{
|
||||
m_configfile.createConfigFile();
|
||||
qDebug() << "create: " << QString::fromStdString(CfgFile);
|
||||
}
|
||||
m_configfile.parseConfigfile();
|
||||
qDebug() << "exist: " << QString::fromStdString(CfgFile);
|
||||
}
|
||||
|
||||
Corning410Imager::~Corning410Imager()
|
||||
{
|
||||
if (buffer != nullptr)
|
||||
{
|
||||
std::cout << "<EFBFBD>ͷŶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>" << std::endl;
|
||||
free(buffer);
|
||||
free(dark);
|
||||
free(white);
|
||||
}
|
||||
}
|
||||
|
||||
double Corning410Imager::getFramerate()
|
||||
{
|
||||
return m_imager.get_framerate();
|
||||
}
|
||||
|
||||
double Corning410Imager::getIntegrationTime()
|
||||
{
|
||||
return m_imager.get_integration_time();
|
||||
}
|
||||
|
||||
double Corning410Imager::getGain()
|
||||
{
|
||||
return m_imager.get_gain();
|
||||
}
|
||||
|
||||
void Corning410Imager::setGain(const double gain)
|
||||
{
|
||||
m_imager.set_gain(gain);
|
||||
}
|
||||
|
||||
void Corning410Imager::setFramerate(const double frames_per_second)
|
||||
{
|
||||
m_imager.set_framerate(frames_per_second);
|
||||
m_RgbImage->m_iFramerate = frames_per_second;
|
||||
}
|
||||
|
||||
void Corning410Imager::setIntegrationTime(const double milliseconds)
|
||||
{
|
||||
m_imager.set_integration_time(milliseconds);
|
||||
}
|
||||
|
||||
int Corning410Imager::getStartBand()
|
||||
{
|
||||
return m_imager.get_start_band();
|
||||
}
|
||||
|
||||
int Corning410Imager::getEndBand()
|
||||
{
|
||||
return m_imager.get_end_band();
|
||||
}
|
||||
|
||||
void Corning410Imager::connectImager(const char* camera_sn)
|
||||
{
|
||||
m_imager.connect();
|
||||
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>
|
||||
bool ret, ret1, ret2;
|
||||
|
||||
int spatialBin;
|
||||
int spectralBin;
|
||||
ret1 = m_configfile.getspatialBin(spatialBin);
|
||||
ret2 = m_configfile.getSpectralBin(spectralBin);
|
||||
if (ret1 && ret2)
|
||||
{
|
||||
bool haha = m_imager.setSpectralBin(spectralBin);
|
||||
bool haha2 = m_imager.setSpatialBin(spatialBin);
|
||||
|
||||
std::cout << "spectralBin<EFBFBD><EFBFBD>" << spectralBin << std::endl;
|
||||
std::cout << "spatialBin<EFBFBD><EFBFBD>" << spatialBin << std::endl;
|
||||
}
|
||||
|
||||
float gain, offset;
|
||||
ret = m_configfile.getGainOffset(gain, offset);
|
||||
if (ret)
|
||||
{
|
||||
m_imager.setGainOffset(gain, offset);
|
||||
}
|
||||
|
||||
int width = 0, offsetx = 0, height = 0, offsety = 0;
|
||||
ret = m_configfile.getEffectiveWindow(width, offsetx, height, offsety);
|
||||
if (ret)
|
||||
{
|
||||
m_imager.setEffectiveWindow(offsetx, width, offsety, height);
|
||||
}
|
||||
|
||||
|
||||
int bufferPolicy, acqBufferSize;
|
||||
ret1 = m_configfile.getBufferPolicy(bufferPolicy);
|
||||
if (ret1)
|
||||
{
|
||||
m_imager.setBufferPolicy(bufferPolicy);
|
||||
}
|
||||
ret1 = m_configfile.getAcqBufferSize(acqBufferSize);
|
||||
if (ret1)
|
||||
{
|
||||
m_imager.setAcqBufferSize(acqBufferSize);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Corning410Imager::disconnectImager()
|
||||
{
|
||||
m_imager.disconnect();
|
||||
}
|
||||
|
||||
void Corning410Imager::imagerStartCollect()
|
||||
{
|
||||
m_imager.start();
|
||||
}
|
||||
|
||||
void Corning410Imager::imagerStopCollect()
|
||||
{
|
||||
m_imager.stop();
|
||||
}
|
||||
|
||||
unsigned short* Corning410Imager::getFrame(unsigned short* buffer)
|
||||
{
|
||||
m_imager.get_frame(buffer);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void Corning410Imager::setSpectraBin(int new_spectral_bin)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
double Corning410Imager::getWavelengthAtBand(int band)
|
||||
{
|
||||
return m_imager.get_wavelength_at_band(band);
|
||||
}
|
||||
|
||||
int Corning410Imager::getBandCount()
|
||||
{
|
||||
return m_imager.get_band_count();
|
||||
}
|
||||
|
||||
int Corning410Imager::getSampleCount()
|
||||
{
|
||||
return m_imager.get_sample_count();
|
||||
}
|
||||
48
HPPA/Corning410Imager.h
Normal file
48
HPPA/Corning410Imager.h
Normal file
@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <opencv2/core/core.hpp>
|
||||
|
||||
#include "ImagerOperationBase.h"
|
||||
#include "image2display.h"
|
||||
#include "fileOperation.h"
|
||||
|
||||
#include "irisximeaimager.h"
|
||||
#include "path_tc.h"
|
||||
#include "hppaConfigFile.h"
|
||||
|
||||
class Corning410Imager :public ImagerOperationBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Corning410Imager();
|
||||
~Corning410Imager();
|
||||
|
||||
Iris::IrisXimeaImager m_imager;
|
||||
|
||||
double getWavelengthAtBand(int band);
|
||||
int getBandCount();
|
||||
int getSampleCount();
|
||||
double getFramerate();
|
||||
double getIntegrationTime();
|
||||
double getGain();
|
||||
void setFramerate(const double frames_per_second);
|
||||
void setIntegrationTime(const double milliseconds);
|
||||
void setGain(const double gain);
|
||||
int getStartBand();
|
||||
int getEndBand();
|
||||
void connectImager(const char* camera_sn = NULL);
|
||||
void disconnectImager();
|
||||
void imagerStartCollect();
|
||||
void imagerStopCollect();
|
||||
unsigned short* getFrame(unsigned short* buffer);
|
||||
void setSpectraBin(int new_spectral_bin);
|
||||
|
||||
protected:
|
||||
private:
|
||||
CorningConfigfile m_configfile;
|
||||
|
||||
public slots:
|
||||
|
||||
signals:
|
||||
};
|
||||
@ -827,10 +827,11 @@ void HPPA::onLeftMouseButtonPressed(int x, int y)
|
||||
QLineSeries *series = new QLineSeries();
|
||||
//series->clear();//////////////////////////////
|
||||
|
||||
int start = m_Imager->getStartBand();
|
||||
for (size_t i = 0; i < m_Imager->getBandCount(); i++)
|
||||
{
|
||||
//malloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>÷<EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
series->append(m_Imager->getWavelengthAtBand(i), data[i]);
|
||||
series->append(m_Imager->getWavelengthAtBand(i + start), data[i]);
|
||||
|
||||
////malloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>÷<EFBFBD>2<EFBFBD><32>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ȡ
|
||||
//series->append(m_Imager->getWavelengthAtBand(i), *data);
|
||||
@ -1779,7 +1780,7 @@ void HPPA::onconnect()
|
||||
}
|
||||
else if (imagerSelected == "mActionCorning_410")
|
||||
{
|
||||
|
||||
m_Imager = new Corning410Imager();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include "path_tc.h"
|
||||
|
||||
#include "ResononNirImager.h"
|
||||
#include "Corning410Imager.h"
|
||||
|
||||
#define PI 3.1415926
|
||||
|
||||
|
||||
@ -55,8 +55,8 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;D:\cpp_library\vincecontrol_vs2017;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\HPPA\x64\Debug;$(LibraryPath)</LibraryPath>
|
||||
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;D:\cpp_library\vincecontrol_vs2017;C:\XIMEA\API\xiAPI;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\HPPA\x64\Debug;C:\XIMEA\API\xiAPI;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;$(IncludePath)</IncludePath>
|
||||
@ -64,7 +64,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>opencv_world3411.lib;opencv_world3411d.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++d.lib;vincecontrol.lib;resonon-allied.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>opencv_world3411.lib;opencv_world3411d.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++d.lib;vincecontrol.lib;resonon-allied.lib;xiapi64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>D:\cpp_project_vs2022\HPPA\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
@ -106,8 +106,11 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="aboutWindow.cpp" />
|
||||
<ClCompile Include="adjustTable.cpp" />
|
||||
<ClCompile Include="Corning410Imager.cpp" />
|
||||
<ClCompile Include="hppaConfigFile.cpp" />
|
||||
<ClCompile Include="ImagerOperationBase.cpp" />
|
||||
<ClCompile Include="imager_base.cpp" />
|
||||
<ClCompile Include="irisximeaimager.cpp" />
|
||||
<ClCompile Include="PathPlan.cpp" />
|
||||
<ClCompile Include="path_tc.cpp" />
|
||||
<ClCompile Include="PowerControl.cpp" />
|
||||
@ -156,6 +159,9 @@
|
||||
<QtMoc Include="PowerControl.h" />
|
||||
<QtMoc Include="PathPlan.h" />
|
||||
<QtMoc Include="RobotArmControl.h" />
|
||||
<QtMoc Include="Corning410Imager.h" />
|
||||
<ClInclude Include="imager_base.h" />
|
||||
<ClInclude Include="irisximeaimager.h" />
|
||||
<ClInclude Include="utility_tc.h" />
|
||||
<QtMoc Include="aboutWindow.h" />
|
||||
<ClInclude Include="hppaConfigFile.h" />
|
||||
|
||||
@ -21,6 +21,12 @@
|
||||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||
<Extensions>ts</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\motor">
|
||||
<UniqueIdentifier>{eadfac5f-f4f9-49e2-9f99-0849bf074cf8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\motor">
|
||||
<UniqueIdentifier>{4672856c-86fb-46e3-94ff-0a296dcc6111}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="HPPA.qrc">
|
||||
@ -109,6 +115,15 @@
|
||||
<ClCompile Include="RobotArmControl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Corning410Imager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="imager_base.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="irisximeaimager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="fileOperation.h">
|
||||
@ -159,6 +174,9 @@
|
||||
<QtMoc Include="RobotArmControl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="Corning410Imager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="imageProcessor.h">
|
||||
@ -185,6 +203,12 @@
|
||||
<ClInclude Include="utility_tc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="imager_base.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="irisximeaimager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="FocusDialog.ui">
|
||||
|
||||
@ -397,3 +397,529 @@ bool Configfile::updateConfigFile()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
CorningConfigfile::CorningConfigfile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CorningConfigfile::setConfigfilePath(string configfilePath)
|
||||
{
|
||||
m_configfilePath = configfilePath;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::isConfigfileExist()
|
||||
{
|
||||
QFileInfo info(QString::fromStdString(m_configfilePath));
|
||||
|
||||
return info.exists();
|
||||
}
|
||||
|
||||
bool CorningConfigfile::parseConfigfile()
|
||||
{
|
||||
// Read the file. If there is an error, report it and exit.
|
||||
try
|
||||
{
|
||||
cfg.readFile(m_configfilePath);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const FileIOException& fioex)
|
||||
{
|
||||
std::cerr << "I/O error while reading file." << std::endl;
|
||||
return false;
|
||||
}
|
||||
catch (const ParseException& pex)
|
||||
{
|
||||
std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine()
|
||||
<< " - " << pex.getError() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getSpectralBin(int& spectralBin)
|
||||
{
|
||||
try
|
||||
{
|
||||
spectralBin = cfg.lookup("spectralBin");
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spectralBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getspatialBin(int& spatialBin)
|
||||
{
|
||||
try
|
||||
{
|
||||
spatialBin = cfg.lookup("spatialBin");
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spatialBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getEffectiveWindow(int& width, int& offsetx, int& height, int& offsety)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
int spatialBin;
|
||||
int spectralBin;
|
||||
getspatialBin(spatialBin);
|
||||
getSpectralBin(spectralBin);
|
||||
|
||||
string spatialBinString;
|
||||
if (spatialBin == 1)
|
||||
{
|
||||
spatialBinString = "bin1";
|
||||
}
|
||||
else
|
||||
{
|
||||
spatialBinString = "bin2";
|
||||
}
|
||||
const Setting& spatialArgument = root["effective_window"][spatialBinString]["spatial"];
|
||||
if (!(spatialArgument.lookupValue("width", width)
|
||||
&& spatialArgument.lookupValue("offsetx", offsetx)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string spectralBinString;
|
||||
if (spectralBin == 1)
|
||||
{
|
||||
spectralBinString = "bin1";
|
||||
}
|
||||
else
|
||||
{
|
||||
spectralBinString = "bin2";
|
||||
}
|
||||
const Setting& spectralArgument = root["effective_window"][spectralBinString]["spectral"];
|
||||
if (!(spectralArgument.lookupValue("height", height)
|
||||
&& spectralArgument.lookupValue("offsety", offsety)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getEffectiveWindowRoi(int& width, int& offsetx)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
const Setting& effective_window = root["effective_window_roi"];
|
||||
int count = effective_window.getLength();
|
||||
|
||||
int spatialBin;
|
||||
getspatialBin(spatialBin);
|
||||
|
||||
string spatialBinString;
|
||||
if (spatialBin == 1)
|
||||
{
|
||||
spatialBinString = "spatialBin1";
|
||||
}
|
||||
else
|
||||
{
|
||||
spatialBinString = "spatialBin2";
|
||||
}
|
||||
|
||||
const Setting& window = effective_window[spatialBinString];
|
||||
string name = window.getName();
|
||||
|
||||
if (!(window.lookupValue("width", width)
|
||||
&& window.lookupValue("offsetx", offsetx)
|
||||
))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getPushFlowParam(int& flowSwitch, int& rgbHeight, int& framerateVideo)
|
||||
{
|
||||
Setting& root = cfg.getRoot();
|
||||
|
||||
if (!root.exists("push_flow_param"))
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB2BB><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Setting& push_flow_param = root.add("push_flow_param", Setting::TypeGroup);
|
||||
|
||||
push_flow_param.add("flow_switch", Setting::TypeInt) = 0;
|
||||
push_flow_param.add("rgb_height", Setting::TypeInt) = 720;
|
||||
push_flow_param.add("framerate_video", Setting::TypeInt) = 5;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ĺ<DEB8><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>ļ<EFBFBD>
|
||||
try
|
||||
{
|
||||
QList<QString> fileInfo = getFileInfo(QString::fromStdString(m_configfilePath));
|
||||
bool ret = createDir(fileInfo[0]);
|
||||
|
||||
cfg.writeFile(m_configfilePath.c_str());
|
||||
std::cout << "Config item 'push_flow_param' added." << std::endl;
|
||||
|
||||
flowSwitch = 0;
|
||||
rgbHeight = 720;
|
||||
framerateVideo = 5;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const libconfig::FileIOException& fioex)
|
||||
{
|
||||
std::cerr << "I/O error while writing file." << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
const Setting& push_flow_param = root["push_flow_param"];
|
||||
|
||||
if (!(push_flow_param.lookupValue("rgb_height", rgbHeight)
|
||||
&& push_flow_param.lookupValue("framerate_video", framerateVideo)
|
||||
&& push_flow_param.lookupValue("flow_switch", flowSwitch)
|
||||
))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getWindowOffsety_HeightOfSpectral(int& offsety, int& height, string spectralBinString)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
const Setting& spectralArgument = root["effective_window"][spectralBinString]["spectral"];
|
||||
if (!(spectralArgument.lookupValue("height", height)
|
||||
&& spectralArgument.lookupValue("offsety", offsety)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getGainOffset(float& gain, float& offset)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
const Setting& gainOffset = root["gainOffset"];
|
||||
int count = gainOffset.getLength();
|
||||
|
||||
int spectralBin;
|
||||
getSpectralBin(spectralBin);
|
||||
|
||||
string spectralBinString;
|
||||
if (spectralBin == 1)
|
||||
{
|
||||
spectralBinString = "spectralBin1";
|
||||
}
|
||||
else
|
||||
{
|
||||
spectralBinString = "spectralBin2";
|
||||
}
|
||||
|
||||
const Setting& gainOffsetSetting = gainOffset[spectralBinString];
|
||||
string name = gainOffsetSetting.getName();
|
||||
|
||||
if (!(gainOffsetSetting.lookupValue("gain", gain)
|
||||
&& gainOffsetSetting.lookupValue("offset", offset)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getGainOffsetOfSpectralBin1(float& gain, float& offset)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
const Setting& gainOffset = root["gainOffset"];
|
||||
int count = gainOffset.getLength();
|
||||
|
||||
string spectralBinString = "spectralBin1";
|
||||
|
||||
const Setting& gainOffsetSetting = gainOffset[spectralBinString];
|
||||
string name = gainOffsetSetting.getName();
|
||||
|
||||
if (!(gainOffsetSetting.lookupValue("gain", gain)
|
||||
&& gainOffsetSetting.lookupValue("offset", offset)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getSN(QString& SN)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string SN_tem = cfg.lookup("SN");
|
||||
SN = QString::fromStdString(SN_tem);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spectralBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getBufferPolicy(int& bufferPolicy)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
const Setting& ximeadll = root["ximeadll"];
|
||||
|
||||
try
|
||||
{
|
||||
if (!(ximeadll.lookupValue("buffer_policy", bufferPolicy)
|
||||
))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spectralBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getAcqBufferSize(int& acqBufferSize)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
const Setting& ximeadll = root["ximeadll"];
|
||||
|
||||
try
|
||||
{
|
||||
if (!(ximeadll.lookupValue("acq_buffer_size", acqBufferSize)
|
||||
))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spectralBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::createConfigFile()
|
||||
{
|
||||
using namespace std;
|
||||
using namespace libconfig;
|
||||
|
||||
Config cfg;
|
||||
|
||||
Setting& root = cfg.getRoot();
|
||||
|
||||
// Add some settings to the configuration.
|
||||
Setting& SN = root.add("SN", Setting::TypeString) = "0098";
|
||||
Setting& spatialBin = root.add("spatialBin", Setting::TypeInt) = 2;
|
||||
Setting& SpectralBin = root.add("spectralBin", Setting::TypeInt) = 2;
|
||||
|
||||
Setting& effective_window = root.add("effective_window", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin1 = effective_window.add("bin1", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin1_spatial = effective_window_Bin1.add("spatial", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin1_Spectral = effective_window_Bin1.add("spectral", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin2 = effective_window.add("bin2", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin2_spatial = effective_window_Bin2.add("spatial", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin2_Spectral = effective_window_Bin2.add("spectral", Setting::TypeGroup);
|
||||
|
||||
effective_window_Bin1_spatial.add("width", Setting::TypeInt) = 1368;
|
||||
effective_window_Bin1_spatial.add("offsetx", Setting::TypeInt) = 288;
|
||||
effective_window_Bin1_Spectral.add("height", Setting::TypeInt) = 300;
|
||||
effective_window_Bin1_Spectral.add("offsety", Setting::TypeInt) = 348;
|
||||
|
||||
effective_window_Bin2_spatial.add("width", Setting::TypeInt) = 688;
|
||||
effective_window_Bin2_spatial.add("offsetx", Setting::TypeInt) = 144;
|
||||
effective_window_Bin2_Spectral.add("height", Setting::TypeInt) = 150;
|
||||
effective_window_Bin2_Spectral.add("offsety", Setting::TypeInt) = 174;
|
||||
|
||||
Setting& effective_window_roi = root.add("effective_window_roi", Setting::TypeGroup);
|
||||
Setting& effective_window_roi_spatialBin1 = effective_window_roi.add("spatialBin1", Setting::TypeGroup);
|
||||
Setting& effective_window_roi_spatialBin2 = effective_window_roi.add("spatialBin2", Setting::TypeGroup);
|
||||
|
||||
effective_window_roi_spatialBin1.add("width", Setting::TypeInt) = 1364;
|
||||
effective_window_roi_spatialBin1.add("offsetx", Setting::TypeInt) = 14;
|
||||
// effective_window_roi_Bin1.add("height", Setting::TypeInt) = 300;
|
||||
// effective_window_roi_Bin1.add("offsety", Setting::TypeInt) = 348;
|
||||
|
||||
effective_window_roi_spatialBin2.add("width", Setting::TypeInt) = 682;
|
||||
effective_window_roi_spatialBin2.add("offsetx", Setting::TypeInt) = 15;
|
||||
// effective_window_roi_Bin2.add("height", Setting::TypeInt) = 151;
|
||||
// effective_window_roi_Bin2.add("offsety", Setting::TypeInt) = 174;
|
||||
|
||||
Setting& gainOffset = root.add("gainOffset", Setting::TypeGroup);
|
||||
Setting& gainOffsetSpectralBin1 = gainOffset.add("spectralBin1", Setting::TypeGroup);
|
||||
Setting& gainOffsetSpectralBin2 = gainOffset.add("spectralBin2", Setting::TypeGroup);
|
||||
|
||||
gainOffsetSpectralBin1.add("gain", Setting::TypeFloat) = 2.00313433;
|
||||
gainOffsetSpectralBin1.add("offset", Setting::TypeFloat) = -300.46283157590585;
|
||||
|
||||
gainOffsetSpectralBin2.add("gain", Setting::TypeFloat) = 4.00626868;
|
||||
gainOffsetSpectralBin2.add("offset", Setting::TypeFloat) = -299.46126663407176;
|
||||
|
||||
|
||||
Setting& ximeadll = root.add("ximeadll", Setting::TypeGroup);
|
||||
ximeadll.add("buffer_policy", Setting::TypeInt) = 0;
|
||||
ximeadll.add("acq_buffer_size", Setting::TypeInt) = 400;
|
||||
|
||||
Setting& push_flow_param = root.add("push_flow_param", Setting::TypeGroup);
|
||||
push_flow_param.add("flow_switch", Setting::TypeInt) = 1;
|
||||
push_flow_param.add("rgb_height", Setting::TypeInt) = 720;
|
||||
push_flow_param.add("framerate_video", Setting::TypeInt) = 5;
|
||||
|
||||
// Write out the new configuration.
|
||||
try
|
||||
{
|
||||
cfg.writeFile(m_configfilePath.c_str());
|
||||
cerr << "New configuration successfully written to: " << m_configfilePath.c_str() << endl;
|
||||
|
||||
}
|
||||
catch (const FileIOException& fioex)
|
||||
{
|
||||
cerr << "I/O error while writing configuration file: " << m_configfilePath.c_str() << endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::updateConfigFile()
|
||||
{
|
||||
using namespace std;
|
||||
using namespace libconfig;
|
||||
|
||||
static const char* output_file = "updated.cfg";
|
||||
|
||||
Config cfg;
|
||||
|
||||
cfg.setOptions(Config::OptionFsync
|
||||
| Config::OptionSemicolonSeparators
|
||||
| Config::OptionColonAssignmentForGroups
|
||||
| Config::OptionOpenBraceOnSeparateLine);
|
||||
|
||||
// Read the file. If there is an error, report it and exit.
|
||||
try
|
||||
{
|
||||
cfg.readFile("example.cfg");
|
||||
}
|
||||
catch (const FileIOException& fioex)
|
||||
{
|
||||
std::cerr << "I/O error while reading file." << std::endl;
|
||||
return false;
|
||||
}
|
||||
catch (const ParseException& pex)
|
||||
{
|
||||
std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine()
|
||||
<< " - " << pex.getError() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find the 'movies' setting. Add intermediate settings if they don't yet
|
||||
// exist.
|
||||
Setting& root = cfg.getRoot();
|
||||
|
||||
if (!root.exists("inventory"))
|
||||
root.add("inventory", Setting::TypeGroup);
|
||||
|
||||
Setting& inventory = root["inventory"];
|
||||
|
||||
if (!inventory.exists("movies"))
|
||||
inventory.add("movies", Setting::TypeList);
|
||||
|
||||
Setting& movies = inventory["movies"];
|
||||
|
||||
// Create the new movie entry.
|
||||
Setting& movie = movies.add(Setting::TypeGroup);
|
||||
|
||||
movie.add("title", Setting::TypeString) = "Buckaroo Banzai";
|
||||
movie.add("media", Setting::TypeString) = "DVD";
|
||||
movie.add("price", Setting::TypeFloat) = 12.99;
|
||||
movie.add("qty", Setting::TypeInt) = 20;
|
||||
|
||||
// Write out the updated configuration.
|
||||
try
|
||||
{
|
||||
cfg.writeFile(output_file);
|
||||
cerr << "Updated configuration successfully written to: " << output_file
|
||||
<< endl;
|
||||
|
||||
}
|
||||
catch (const FileIOException& fioex)
|
||||
{
|
||||
cerr << "I/O error while writing file: " << output_file << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -45,6 +45,36 @@ public:
|
||||
bool createConfigFile();
|
||||
bool updateConfigFile();
|
||||
|
||||
private:
|
||||
string m_configfilePath;
|
||||
Config cfg;
|
||||
};
|
||||
|
||||
class CorningConfigfile
|
||||
{
|
||||
public:
|
||||
CorningConfigfile();
|
||||
void setConfigfilePath(string configfilePath);
|
||||
bool isConfigfileExist();
|
||||
bool parseConfigfile();
|
||||
|
||||
bool getSpectralBin(int& spectralBin);
|
||||
bool getspatialBin(int& spatialBin);
|
||||
bool getEffectiveWindow(int& width, int& offsetx, int& height, int& offsety);
|
||||
bool getEffectiveWindowRoi(int& width, int& offsetx);
|
||||
bool getWindowOffsety_HeightOfSpectral(int& offsety, int& height, string spectralBinString);//spectralBinString = "bin1"<22><><EFBFBD>ߡ<EFBFBD>bin2<6E><32>
|
||||
bool getGainOffset(float& gain, float& offset);
|
||||
bool getGainOffsetOfSpectralBin1(float& gain, float& offset);
|
||||
bool getSN(QString& SN);
|
||||
|
||||
bool getBufferPolicy(int& bufferPolicy);
|
||||
bool getAcqBufferSize(int& acqBufferSize);
|
||||
|
||||
bool getPushFlowParam(int& flowSwitch, int& rgbHeight, int& framerateVideo);
|
||||
|
||||
bool createConfigFile();
|
||||
bool updateConfigFile();
|
||||
|
||||
private:
|
||||
string m_configfilePath;
|
||||
Config cfg;
|
||||
|
||||
165
HPPA/imager_base.cpp
Normal file
165
HPPA/imager_base.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
#include "imager_base.h"
|
||||
Iris::ImagerBase::ImagerBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Iris::ImagerBase::~ImagerBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_spectral_bin(int new_spectral_bin)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_spectral_bin()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_spectral_bin()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_spectral_bin()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_start_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_start_band(int band)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_start_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_start_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_inc_start_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_end_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_end_band(int band)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_end_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_end_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_inc_end_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_start_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_start_sample(int sample)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_start_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_start_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_inc_start_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_end_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_end_sample(int sample)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_end_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_end_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_inc_end_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_gain(const double gain)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
double Iris::ImagerBase::get_gain()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
double Iris::ImagerBase::get_min_gain()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
double Iris::ImagerBase::get_max_gain()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_internal_trigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_external_trigger(unsigned int signal_line, bool rising_edge)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Iris::ImagerBase::is_trigger_external()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
93
HPPA/imager_base.h
Normal file
93
HPPA/imager_base.h
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Iris API
|
||||
*
|
||||
* By using this API, the user agrees to the terms and conditions as stated in the
|
||||
* document "Terms of Use", located on the Resonon website
|
||||
* at: http://www.resonon.com/downloads/Resonon_API_Terms_of_Use.pdf.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GUARD_Iris_IMAGER_BASE_H
|
||||
#define __GUARD_Iris_IMAGER_BASE_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstdint>
|
||||
//#include "irisximeaimager_global.h"
|
||||
|
||||
/**
|
||||
* The Iris namespace contains all public classes.
|
||||
*/
|
||||
namespace Iris
|
||||
{
|
||||
/**
|
||||
* An abstract base class which provides a common interface for all imagers.
|
||||
*/
|
||||
class ImagerBase
|
||||
{
|
||||
public:
|
||||
ImagerBase();
|
||||
virtual ~ImagerBase();
|
||||
|
||||
|
||||
virtual void connect(const char * camera_sn=NULL)=0;
|
||||
virtual void disconnect()=0;
|
||||
virtual void start()=0;
|
||||
virtual void stop()=0;
|
||||
virtual void get_imager_type(char *buffer, int buffer_size)=0;
|
||||
virtual void get_serial_number(char *buffer, int buffer_size)=0;
|
||||
virtual void get_camera_serial_number(char *buffer, int buffer_size)=0;
|
||||
virtual void generate_configuration_report(char *buffer, int buffer_size)=0;
|
||||
virtual float get_coeff_a()=0;
|
||||
virtual float get_coeff_b()=0;
|
||||
virtual float get_coeff_c()=0;
|
||||
virtual double get_wavelength_at_band(const int band)=0;
|
||||
int get_nearest_band_to_wavelength(const double wavelength);
|
||||
virtual int get_frame_buffer_size_in_bytes()=0;
|
||||
virtual unsigned short* get_frame(unsigned short* buffer)=0;
|
||||
virtual std::uint64_t get_last_timestamp()=0;
|
||||
virtual std::uint64_t ticks_per_second()=0;
|
||||
virtual void set_spectral_bin(int new_spectral_bin);
|
||||
virtual int get_spectral_bin();
|
||||
virtual int get_min_spectral_bin();
|
||||
virtual int get_max_spectral_bin();
|
||||
virtual int get_band_count()=0;
|
||||
virtual int get_start_band();
|
||||
virtual void set_start_band(int band);
|
||||
virtual int get_min_start_band();
|
||||
virtual int get_max_start_band();
|
||||
virtual int get_inc_start_band();
|
||||
virtual int get_end_band();
|
||||
virtual void set_end_band(int band);
|
||||
virtual int get_min_end_band();
|
||||
virtual int get_max_end_band();
|
||||
virtual int get_inc_end_band();
|
||||
virtual int get_sample_count()=0;
|
||||
virtual int get_start_sample();
|
||||
virtual void set_start_sample(int sample);
|
||||
virtual int get_min_start_sample();
|
||||
virtual int get_max_start_sample();
|
||||
virtual int get_inc_start_sample();
|
||||
virtual int get_end_sample();
|
||||
virtual void set_end_sample(int sample);
|
||||
virtual int get_min_end_sample();
|
||||
virtual int get_max_end_sample();
|
||||
virtual int get_inc_end_sample();
|
||||
virtual void set_framerate(const double frames_per_second)=0;
|
||||
virtual double get_framerate()=0;
|
||||
virtual double get_min_framerate()=0;
|
||||
virtual double get_max_framerate()=0;
|
||||
virtual double get_min_integration_time()=0;
|
||||
virtual double get_max_integration_time()=0;
|
||||
virtual void set_integration_time(const double milliseconds)=0;
|
||||
virtual double get_integration_time()=0;
|
||||
virtual void set_gain(const double gain);
|
||||
virtual double get_gain();
|
||||
virtual double get_min_gain();
|
||||
virtual double get_max_gain();
|
||||
virtual void set_internal_trigger();
|
||||
virtual void set_external_trigger(unsigned int signal_line, bool rising_edge=true);
|
||||
virtual bool is_trigger_external();
|
||||
};
|
||||
} //end namespace Iris
|
||||
#endif //end ifndef __GUARD_Iris_IMAGER_BASE_H
|
||||
565
HPPA/irisximeaimager.cpp
Normal file
565
HPPA/irisximeaimager.cpp
Normal file
@ -0,0 +1,565 @@
|
||||
#include "irisximeaimager.h"
|
||||
using namespace Iris;
|
||||
|
||||
void Iris::IrisXimeaImager::setGainOffset(float gain, float offset)
|
||||
{
|
||||
m_fGain = gain;
|
||||
m_fOffset = offset;
|
||||
}
|
||||
|
||||
bool Iris::IrisXimeaImager::setSpectralBin(int spectralBin)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_SELECTOR, XI_BIN_SELECT_HOST_CPU));//用:XI_BIN_SELECT_HOST_CPU;默认为XI_BIN_SELECT_SENSOR(会报错),不可用:XI_BIN_SELECT_DEVICE_FPGA
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_VERTICAL_MODE, XI_BIN_MODE_AVERAGE));
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_VERTICAL, spectralBin));
|
||||
printf("Iris::IrisXimeaImager::setSpectralBin----2 设置bin模式为XI_PRM_BINNING_SELECTOR XI_BIN_MODE_AVERAGE !\n");
|
||||
|
||||
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_DECIMATION_SELECTOR, XI_DEC_SELECT_SENSOR));
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_DECIMATION_VERTICAL, spectralBin));
|
||||
|
||||
|
||||
m_iSpectralBin = spectralBin;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Iris::IrisXimeaImager::setSpatialBin(int spatialBin)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_SELECTOR, XI_BIN_SELECT_HOST_CPU));//用:XI_BIN_SELECT_HOST_CPU;默认为XI_BIN_SELECT_SENSOR(会报错),不可用:XI_BIN_SELECT_DEVICE_FPGA
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_HORIZONTAL_MODE, XI_BIN_MODE_AVERAGE));
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_HORIZONTAL, spatialBin));
|
||||
printf("Iris::IrisXimeaImager::setSpatialBin----2 设置bin模式为XI_PRM_BINNING_SELECTOR XI_BIN_MODE_AVERAGE !\n");
|
||||
|
||||
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_DECIMATION_SELECTOR, XI_DEC_SELECT_SENSOR));
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_DECIMATION_HORIZONTAL, spatialBin));
|
||||
|
||||
m_iSpatialBin = spatialBin;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::getSpectralBin()
|
||||
{
|
||||
int spectralBin = 0;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_BINNING_VERTICAL, &spectralBin));
|
||||
|
||||
// CE(xiGetParamInt(m_xiH, XI_PRM_DECIMATION_VERTICAL, &spectralBin));
|
||||
|
||||
return spectralBin;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::getSpatialBin()
|
||||
{
|
||||
int spatialBin = 0;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_BINNING_HORIZONTAL, &spatialBin));
|
||||
|
||||
// CE(xiGetParamInt(m_xiH, XI_PRM_DECIMATION_HORIZONTAL, &spatialBin));
|
||||
|
||||
return spatialBin;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::setEffectiveWindow(int OffsetX, int width, int OffsetY, int height)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_WIDTH, width));
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_OFFSET_X, OffsetX));
|
||||
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_HEIGHT, height));
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_OFFSET_Y, OffsetY));
|
||||
|
||||
m_iEffectiveWindow_OffsetX = OffsetX;
|
||||
m_iEffectiveWindow_width = width;
|
||||
m_iEffectiveWindow_OffsetY = OffsetY;
|
||||
m_iEffectiveWindow_height = height;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::setEffectiveWindowRoi(int OffsetX, int width)
|
||||
{
|
||||
m_iEffectiveWindowRoi_OffsetX = OffsetX;
|
||||
m_iEffectiveWindowRoi_width = width;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::getBufferSizeOfOneFrame()
|
||||
{
|
||||
// if(m_xiH==NULL)
|
||||
// return 0;
|
||||
//
|
||||
// start();
|
||||
//
|
||||
// //清空image缓存
|
||||
// memset(&m_image, 0, sizeof(m_image));
|
||||
// m_image.size = sizeof(XI_IMG);
|
||||
//
|
||||
// CE(xiGetImage(m_xiH, 5000, &m_image)); // getting next image from the camera opened
|
||||
//
|
||||
// stop();
|
||||
//
|
||||
// return static_cast<int>(m_image.bp_size);
|
||||
|
||||
// //比实际大小(m_iEffectiveWindow_height * m_iEffectiveWindow_width * 2)大,why?
|
||||
// int value = 0;
|
||||
// xiGetParamInt(m_xiH, XI_PRM_IMAGE_PAYLOAD_SIZE, &value);
|
||||
|
||||
|
||||
return m_iEffectiveWindow_height * m_iEffectiveWindow_width * 2;
|
||||
}
|
||||
|
||||
float Iris::IrisXimeaImager::getTemperature()
|
||||
{
|
||||
float temperature = 0.0;
|
||||
CE(xiGetParamFloat(m_xiH, XI_PRM_TEMP, &temperature));
|
||||
|
||||
return temperature;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::setBufferPolicy(int bufferPolicy)
|
||||
{
|
||||
if (bufferPolicy==0)
|
||||
{
|
||||
xiSetParamInt(m_xiH, XI_PRM_BUFFER_POLICY, XI_BP_UNSAFE);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_BUFFER_POLICY: XI_BP_UNSAFE\n");
|
||||
}
|
||||
else if (bufferPolicy==1)
|
||||
{
|
||||
xiSetParamInt(m_xiH, XI_PRM_BUFFER_POLICY, XI_BP_SAFE);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_BUFFER_POLICY: XI_BP_SAFE\n");
|
||||
}
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::setAcqBufferSize(int acqBufferSize)
|
||||
{
|
||||
XI_RETURN stat = XI_OK;
|
||||
|
||||
// set unit to 1 MiB
|
||||
xiSetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE_UNIT, 1024*1024);
|
||||
int value = 0;
|
||||
xiGetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE, &value);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_ACQ_BUFFER_SIZE: %d MiB.\n", value);
|
||||
|
||||
xiSetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE, acqBufferSize);
|
||||
|
||||
xiGetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE, &value);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_ACQ_BUFFER_SIZE: %d MiB.\n", value);
|
||||
|
||||
// set maximum number of queue
|
||||
int number_of_field_buffers = 0;
|
||||
xiGetParamInt(m_xiH, XI_PRM_BUFFERS_QUEUE_SIZE XI_PRM_INFO_MAX, &number_of_field_buffers);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_BUFFERS_QUEUE_SIZE XI_PRM_INFO_MAX: %d.\n", number_of_field_buffers);
|
||||
HandleResult(stat,"xiGetParam (number_of_field_buffers maximum)");
|
||||
xiSetParamInt(m_xiH, XI_PRM_BUFFERS_QUEUE_SIZE, number_of_field_buffers);
|
||||
HandleResult(stat,"xiSetParam (number_of_field_buffers)");
|
||||
}
|
||||
|
||||
Iris::IrisXimeaImager::IrisXimeaImager()
|
||||
{
|
||||
m_xiH=NULL;
|
||||
|
||||
//std::cout<<"ximeaControlDll 版本:"<< "21." <<std::endl;
|
||||
}
|
||||
|
||||
Iris::IrisXimeaImager::~IrisXimeaImager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::connect(const char *camera_serial_number)
|
||||
{
|
||||
printf("Iris::IrisXimeaImager::connect----1 打开相机(xiOpenDevice)\n");
|
||||
CE(xiOpenDevice(0, &m_xiH));//没有插上ximea相机,这句代码都过不去
|
||||
|
||||
//add-----------------------------------------------------------------------------------------------------------------------
|
||||
XI_RETURN stat = XI_OK;
|
||||
|
||||
int payload=0;
|
||||
stat = xiGetParamInt(m_xiH, XI_PRM_IMAGE_PAYLOAD_SIZE, &payload);
|
||||
HandleResult(stat,"xiGetParam (payload)");
|
||||
|
||||
int transport_buffer_size_default = 0;
|
||||
int transport_buffer_size_increment = 0;
|
||||
int transport_buffer_size_minimum = 0;
|
||||
// get default transport buffer size - that should be OK on all controllers
|
||||
stat = xiGetParamInt(m_xiH, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE, &transport_buffer_size_default);
|
||||
HandleResult(stat,"xiGetParamInt (transport buffer size)");
|
||||
stat = xiGetParamInt(m_xiH, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE XI_PRM_INFO_INCREMENT, &transport_buffer_size_increment);
|
||||
HandleResult(stat,"xiGetParamInt (transport buffer size increment)");
|
||||
stat = xiGetParamInt(m_xiH, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE XI_PRM_INFO_MIN, &transport_buffer_size_minimum);
|
||||
HandleResult(stat,"xiGetParamInt (transport buffer size minimum)");
|
||||
|
||||
// check if payload size is less than default transport buffer size
|
||||
if(payload < transport_buffer_size_default + transport_buffer_size_increment)
|
||||
{
|
||||
// use optimized transport buffer size, as nearest increment to payload
|
||||
int transport_buffer_size = payload;
|
||||
if (transport_buffer_size_increment)
|
||||
{
|
||||
// round up to nearest increment
|
||||
int remainder = transport_buffer_size % transport_buffer_size_increment;
|
||||
if (remainder)
|
||||
transport_buffer_size += transport_buffer_size_increment - remainder;
|
||||
}
|
||||
// check the minimum
|
||||
if (transport_buffer_size < transport_buffer_size_minimum)
|
||||
transport_buffer_size = transport_buffer_size_minimum;
|
||||
stat = xiSetParamInt(m_xiH, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE, transport_buffer_size);
|
||||
HandleResult(stat,"xiSetParam (transport buffer size)");
|
||||
}
|
||||
//add---------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// set unit to 1 MiB
|
||||
xiSetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE_UNIT, 1024*1024);
|
||||
int value = 0;
|
||||
xiGetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE, &value);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_ACQ_BUFFER_SIZE: %d MiB.\n", value);
|
||||
|
||||
|
||||
int NUM_THREADS = 0;
|
||||
xiGetParamInt(m_xiH, XI_PRM_PROC_NUM_THREADS, &NUM_THREADS);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_PROC_NUM_THREADS默认值为%d\n", NUM_THREADS);
|
||||
xiSetParamInt(m_xiH, XI_PRM_PROC_NUM_THREADS, 8);
|
||||
|
||||
//设置数据格式
|
||||
printf("Iris::IrisXimeaImager::connect----2 设置数据格式(xiSetParamInt)\n");
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_IMAGE_DATA_FORMAT, XI_RAW16));//Default value: XI_MONO8
|
||||
// //设置packing, 使用xiGetImage接收影像时不执行unpacking
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_OUTPUT_DATA_BIT_DEPTH, 12));//set 12 bit transport data width
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_OUTPUT_DATA_PACKING, XI_ON));//enable packing
|
||||
// //使用xiGetImage接收影像时不执行unpacking
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_IMAGE_DATA_FORMAT, XI_FRM_TRANSPORT_DATA));//in this case, the function xiGetImage just set pointer to transport-buffer without any processing
|
||||
|
||||
//判断数据格式设置是否成功
|
||||
int dataFortmat;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_IMAGE_DATA_FORMAT, &dataFortmat));
|
||||
if(dataFortmat==XI_RAW16)
|
||||
{
|
||||
printf("Iris::IrisXimeaImager::connect----当前数据格式设置成功, 设置为: XI_RAW16\n");
|
||||
}
|
||||
else if(dataFortmat==XI_FRM_TRANSPORT_DATA)
|
||||
{
|
||||
printf("Iris::IrisXimeaImager::connect----当前数据格式设置成功, 设置为: XI_FRM_TRANSPORT_DATA\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Iris::IrisXimeaImager::connect----2 数据格式设置失败!\n");
|
||||
printf("Iris::IrisXimeaImager::connect----当前数据格式为:%d\n",dataFortmat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::disconnect()
|
||||
{
|
||||
printf("Closing camera...\n");
|
||||
CE(xiCloseDevice(m_xiH));
|
||||
|
||||
m_xiH=NULL;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::start()
|
||||
{
|
||||
CE(xiStartAcquisition(m_xiH));
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::stop()
|
||||
{
|
||||
//printf("Stopping acquisition...\n");
|
||||
CE(xiStopAcquisition(m_xiH));
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::get_imager_type(char *buffer, int buffer_size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::get_serial_number(char *buffer, int buffer_size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::get_camera_serial_number(char *buffer, int buffer_size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::generate_configuration_report(char *buffer, int buffer_size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float Iris::IrisXimeaImager::get_coeff_a()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float Iris::IrisXimeaImager::get_coeff_b()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float Iris::IrisXimeaImager::get_coeff_c()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_wavelength_at_band(const int band)
|
||||
{
|
||||
//sn008
|
||||
float a=1.999564;
|
||||
float b=-279.893;
|
||||
//
|
||||
float wavelength=band*m_fGain + m_fOffset;
|
||||
return wavelength;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_frame_buffer_size_in_bytes()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned short *Iris::IrisXimeaImager::get_frame(unsigned short *buffer)
|
||||
{
|
||||
//清空image缓存
|
||||
memset(&m_image, 0, sizeof(m_image));
|
||||
m_image.size = sizeof(XI_IMG);
|
||||
|
||||
CE(xiGetImage(m_xiH, 5000, &m_image)); // getting next image from the camera opened
|
||||
|
||||
//方法1:memcpy
|
||||
memcpy(buffer,m_image.bp,m_image.bp_size);
|
||||
// //方法2:此做法是错误的,虽然是指针,也是传值!
|
||||
// buffer = (unsigned short *)m_image.bp;
|
||||
|
||||
// for(int i=0;i<m_iEffectiveWindow_height;i++)
|
||||
// {
|
||||
// memcpy(buffer+i*m_iEffectiveWindowRoi_width, (unsigned short *)m_image.bp + i*m_iEffectiveWindow_width + m_iEffectiveWindowRoi_OffsetX, m_iEffectiveWindowRoi_width*2);
|
||||
// }
|
||||
|
||||
//强制将指针从高精度(uint64_t*)转换到低精度(unsigned short *),会有精度降低的问题???????????????????????????????????????????????????
|
||||
return (unsigned short *)&m_timestampOfCamera;
|
||||
}
|
||||
|
||||
uint64_t Iris::IrisXimeaImager::get_last_timestamp()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t Iris::IrisXimeaImager::ticks_per_second()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_spectral_bin(int new_spectral_bin)
|
||||
{
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_spectral_bin()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_spectral_bin()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_spectral_bin()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_band_count()
|
||||
{
|
||||
return m_iEffectiveWindow_height;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_start_band()
|
||||
{
|
||||
int WindowStartLine;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_OFFSET_Y, &WindowStartLine));
|
||||
|
||||
return WindowStartLine;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_start_band(int band)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_start_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_start_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_inc_start_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_end_band()
|
||||
{
|
||||
int height;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_HEIGHT, &height));
|
||||
return get_start_band()+height;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_end_band(int band)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_end_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_end_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_inc_end_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_sample_count()
|
||||
{
|
||||
return m_iEffectiveWindow_width;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_start_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_start_sample(int sample)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_start_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_start_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_inc_start_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_end_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_end_sample(int sample)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_end_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_end_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_inc_end_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_framerate(const double frames_per_second)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_ACQ_TIMING_MODE, XI_ACQ_TIMING_MODE_FRAME_RATE_LIMIT));
|
||||
|
||||
CE(xiSetParamFloat(m_xiH, XI_PRM_FRAMERATE, frames_per_second));
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_framerate()
|
||||
{
|
||||
float framerate;
|
||||
CE(xiGetParamFloat(m_xiH, XI_PRM_FRAMERATE, &framerate));
|
||||
return framerate;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_min_framerate()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_max_framerate()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_min_integration_time()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_max_integration_time()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_integration_time(const double microsecond)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_EXPOSURE, microsecond));//time_in_us(microseconds)
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_integration_time()
|
||||
{
|
||||
float exposureTime;
|
||||
CE(xiGetParamFloat(m_xiH, XI_PRM_EXPOSURE, &exposureTime));//time_in_us(microseconds)
|
||||
return exposureTime;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_gain(const double gain)
|
||||
{
|
||||
CE(xiSetParamFloat(m_xiH, XI_PRM_GAIN, gain));//gain_in_db
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_gain()
|
||||
{
|
||||
float gain;
|
||||
CE(xiGetParamFloat(m_xiH, XI_PRM_GAIN, &gain));
|
||||
return gain;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_min_gain()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_max_gain()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_internal_trigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_external_trigger(unsigned int signal_line, bool rising_edge)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Iris::IrisXimeaImager::is_trigger_external()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
123
HPPA/irisximeaimager.h
Normal file
123
HPPA/irisximeaimager.h
Normal file
@ -0,0 +1,123 @@
|
||||
#ifndef IRISXIMEAIMAGER_H
|
||||
#define IRISXIMEAIMAGER_H
|
||||
|
||||
#include <memory.h>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
||||
//#include "irisximeaimager_global.h"
|
||||
#include "imager_base.h"
|
||||
#ifdef WIN32
|
||||
#include <xiApi.h> // Windows
|
||||
#else
|
||||
#include <m3api/xiApi.h> // Linux, OSX
|
||||
#endif
|
||||
|
||||
#define CE(func) {XI_RETURN stat = (func); if (XI_OK!=stat) {printf("Error:%d returned from function:"#func"\n",stat);throw stat;}}
|
||||
#define HandleResult(res,place) if (res!=XI_OK) {printf("Error after %s (%d)\n",place,res);}
|
||||
|
||||
namespace Iris
|
||||
{
|
||||
class IrisXimeaImager:public ImagerBase
|
||||
{
|
||||
public:
|
||||
HANDLE m_xiH;
|
||||
void setGainOffset(float gain, float offset);
|
||||
bool setSpectralBin(int spectralBin);
|
||||
bool setSpatialBin(int spatialBin);
|
||||
int getSpectralBin();
|
||||
int getSpatialBin();
|
||||
void setEffectiveWindow(int OffsetX, int width, int OffsetY, int height);
|
||||
void setEffectiveWindowRoi(int OffsetX, int width);
|
||||
int getBufferSizeOfOneFrame();
|
||||
float getTemperature();
|
||||
|
||||
XI_IMG m_image; // image buffer
|
||||
|
||||
void setBufferPolicy(int bufferPolicy);//0:XI_BP_UNSAFE; 1:XI_BP_SAFE;
|
||||
void setAcqBufferSize(int acqBufferSize);//单位MiB
|
||||
|
||||
public:
|
||||
//继承基类的
|
||||
IrisXimeaImager();//11111111111111111111
|
||||
virtual ~IrisXimeaImager();
|
||||
|
||||
void connect(const char * camera_serial_number=NULL);//111111111111111111111111111111111
|
||||
void disconnect();//111111111111111111111111111111
|
||||
void start();//111111111111111111111
|
||||
void stop();//1111111111111111111111
|
||||
void get_imager_type(char *buffer, int buffer_size);
|
||||
void get_serial_number(char *buffer, int buffer_size);
|
||||
void get_camera_serial_number(char *buffer, int buffer_size);
|
||||
void generate_configuration_report(char *buffer, int buffer_size);
|
||||
float get_coeff_a();
|
||||
float get_coeff_b();
|
||||
float get_coeff_c();
|
||||
double get_wavelength_at_band(const int band);//11111111111111111111
|
||||
int get_frame_buffer_size_in_bytes();
|
||||
unsigned short* get_frame(unsigned short* buffer);//11111111111111111111111
|
||||
std::uint64_t get_last_timestamp();
|
||||
std::uint64_t ticks_per_second();
|
||||
void set_spectral_bin(int new_spectral_bin);//11111111111111111111111111111111
|
||||
int get_spectral_bin();
|
||||
int get_min_spectral_bin();
|
||||
int get_max_spectral_bin();
|
||||
int get_band_count();//11111111111111111111
|
||||
int get_start_band();//对应上一版本api的函数:get_window_start_band
|
||||
void set_start_band(int band);
|
||||
int get_min_start_band();
|
||||
int get_max_start_band();
|
||||
int get_inc_start_band();
|
||||
int get_end_band();//对应上一版本api的函数:get_window_end_band
|
||||
void set_end_band(int band);
|
||||
int get_min_end_band();
|
||||
int get_max_end_band();
|
||||
int get_inc_end_band();
|
||||
int get_sample_count();//11111111111111111
|
||||
int get_start_sample();
|
||||
void set_start_sample(int sample);
|
||||
int get_min_start_sample();
|
||||
int get_max_start_sample();
|
||||
int get_inc_start_sample();
|
||||
int get_end_sample();
|
||||
void set_end_sample(int sample);
|
||||
int get_min_end_sample();
|
||||
int get_max_end_sample();
|
||||
int get_inc_end_sample();
|
||||
void set_framerate(const double frames_per_second);//11111111111111111111111111111111
|
||||
double get_framerate();//1111111111111111111111
|
||||
double get_min_framerate();
|
||||
double get_max_framerate();
|
||||
double get_min_integration_time();
|
||||
double get_max_integration_time();
|
||||
void set_integration_time(const double microsecond);//111111111111111111111
|
||||
double get_integration_time();//1111111111111111111111111111111
|
||||
void set_gain(const double gain);//111111111111
|
||||
double get_gain();//111111111111
|
||||
double get_min_gain();
|
||||
double get_max_gain();
|
||||
void set_internal_trigger();
|
||||
void set_external_trigger(unsigned int signal_line, bool rising_edge=true);
|
||||
bool is_trigger_external();
|
||||
protected:
|
||||
private:
|
||||
uint64_t m_timestampOfCamera;
|
||||
|
||||
int m_iSpectralBin;
|
||||
int m_iSpatialBin;
|
||||
|
||||
int m_iEffectiveWindow_OffsetX;
|
||||
int m_iEffectiveWindow_width;
|
||||
int m_iEffectiveWindow_OffsetY;
|
||||
int m_iEffectiveWindow_height;
|
||||
|
||||
int m_iEffectiveWindowRoi_OffsetX;
|
||||
int m_iEffectiveWindowRoi_width;
|
||||
|
||||
float m_fGain;
|
||||
float m_fOffset;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // IRISXIMEAIMAGER_H
|
||||
Reference in New Issue
Block a user