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();
|
||||
}
|
||||
Reference in New Issue
Block a user