|
|
|
@ -35,7 +35,7 @@ XimeaImager::XimeaImager()
|
|
|
|
|
m_parameterConfigfile.parseConfigfile();
|
|
|
|
|
|
|
|
|
|
m_recordTempThread=new QThread();
|
|
|
|
|
m_ximeaTemperature = new RecordXimeaTemperature(&m_imager);
|
|
|
|
|
m_ximeaTemperature = new RecordXimeaTemperature(&m_imager, this);
|
|
|
|
|
m_ximeaTemperature->moveToThread(m_recordTempThread);
|
|
|
|
|
m_recordTempThread->start();
|
|
|
|
|
|
|
|
|
@ -155,7 +155,7 @@ void XimeaImager::openImger()
|
|
|
|
|
|
|
|
|
|
QDateTime curDateTime = QDateTime::currentDateTime();
|
|
|
|
|
QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss");
|
|
|
|
|
m_ximeaTemperatureCSVPath = QDir::cleanPath(QString::fromStdString("/home/programRunLog/hyperspectralLog") + QDir::separator() + "ximeaTemperature_" + currentTime + ".csv");
|
|
|
|
|
m_ximeaTemperatureCSVPath = QDir::cleanPath(QString::fromStdString("/media/nvme/300TC/programRunLog/ximeaTemperature") + QDir::separator() + "ximeaTemperature_" + currentTime + ".csv");
|
|
|
|
|
// m_ximeaTemperatureCSVPath = "/home/ximeaTemperature.csv";
|
|
|
|
|
emit recordXimeaTemperatureSignal(m_ximeaTemperatureCSVPath);
|
|
|
|
|
}
|
|
|
|
@ -204,9 +204,14 @@ void XimeaImager::setFramerate(double framerate)
|
|
|
|
|
{
|
|
|
|
|
m_imager.set_framerate(framerate);
|
|
|
|
|
|
|
|
|
|
int exposureTimeInUs = getExposureTime();
|
|
|
|
|
|
|
|
|
|
int maxExposureTimeInUs=1/framerate*1000000;
|
|
|
|
|
// setExposureTime(maxExposureTimeInUs);
|
|
|
|
|
// setExposureTime(1000);
|
|
|
|
|
|
|
|
|
|
if (exposureTimeInUs > maxExposureTimeInUs)
|
|
|
|
|
{
|
|
|
|
|
wrapSetExposureTime(maxExposureTimeInUs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_iImagerState=102;
|
|
|
|
|
emit ximeaImageStatus(m_iImagerState);
|
|
|
|
@ -249,9 +254,7 @@ double XimeaImager::setExposureTime(float exposureTime_in_us)
|
|
|
|
|
//确保设置的积分时间比最大积分时间小
|
|
|
|
|
if(exposureTime_in_us<maxExposureTime_in_us)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
m_imager.set_integration_time(exposureTime_in_us);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -284,7 +287,7 @@ int XimeaImager::wrapSetExposureTime(float exposureTime_in_us)
|
|
|
|
|
m_iImagerState=103;
|
|
|
|
|
emit ximeaImageStatus(m_iImagerState);
|
|
|
|
|
|
|
|
|
|
emit autoExposeMaxValueOfOneFrame(maxValueOfOneFrame, exposureTime/1000);
|
|
|
|
|
emit autoExposeMaxValueOfOneFrame(maxValueOfOneFrame, exposureTime);
|
|
|
|
|
|
|
|
|
|
return maxValueOfOneFrame;
|
|
|
|
|
}
|
|
|
|
@ -347,7 +350,7 @@ double XimeaImager::autoExposure()
|
|
|
|
|
|
|
|
|
|
m_iImagerState=103;
|
|
|
|
|
emit ximeaImageStatus(m_iImagerState);
|
|
|
|
|
emit autoExposeMaxValueOfOneFrame(maxValueOfOneFrame, exposureTime/1000);
|
|
|
|
|
emit autoExposeMaxValueOfOneFrame(maxValueOfOneFrame, exposureTime);
|
|
|
|
|
|
|
|
|
|
std::cout<<"自动曝光完成!"<<std::endl;
|
|
|
|
|
return exposureTime;
|
|
|
|
@ -544,13 +547,11 @@ double XimeaImager::calculateTimeDifferenceBetweenSbgAndximea(XI_IMG * image, do
|
|
|
|
|
|
|
|
|
|
void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString baseFileName)
|
|
|
|
|
{
|
|
|
|
|
m_ximeaTemperature->stopRecordTemperature();//开始采集影像前,停止获取相机的温度,以免降低帧率;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if(m_iImagerState <= 99 || m_iImagerState==100 || m_iImagerState==104)
|
|
|
|
|
{
|
|
|
|
|
emit ximeaImageStatus(m_iImagerState);
|
|
|
|
|
|
|
|
|
|
printf("已经开始采集----------------------------!\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -568,7 +569,8 @@ void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString base
|
|
|
|
|
|
|
|
|
|
m_baseFileName=baseFileName;
|
|
|
|
|
|
|
|
|
|
std::cout << "曝光时间为:" << getExposureTime()/1000 << "ms" <<std::endl;
|
|
|
|
|
std::cout << "帧率为:" << getFramerate() << "hz" <<std::endl;
|
|
|
|
|
std::cout << "曝光时间为:" << getExposureTime() << "μs" <<std::endl;
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
// ofstream timesFileHandle(timesFileName.toStdString()+"_ofstream");
|
|
|
|
@ -661,7 +663,7 @@ void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString base
|
|
|
|
|
double frameLossRate = frameLossed / m_imager.m_image.acq_nframe;
|
|
|
|
|
|
|
|
|
|
std::cout<<"当前采集文件为: "<<baseFileName.toStdString()<< ".bil" <<std::endl;
|
|
|
|
|
std::cout<<"采集时间为: "<<runTime<< "s" <<std::endl;
|
|
|
|
|
std::cout<<"采集时间为: "<<runTime/60<< " min" <<std::endl;
|
|
|
|
|
std::cout<<"当前帧率为: "<<getFramerate() << "hz" <<std::endl;
|
|
|
|
|
std::cout<<"每秒数据量为: "<<getFramerate()*m_iFrameSizeInByte/(1024*1024)<<"MB"<<std::endl;
|
|
|
|
|
std::cout<<"理论采集帧数为: "<<m_imager.m_image.acq_nframe<<std::endl;
|
|
|
|
@ -680,8 +682,6 @@ void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString base
|
|
|
|
|
emit ximeaImageStatus(m_iImagerState);
|
|
|
|
|
|
|
|
|
|
emit recordFinished();
|
|
|
|
|
|
|
|
|
|
emit recordXimeaTemperatureSignal(m_ximeaTemperatureCSVPath);//停止采集影像后,继续获取传感器温度;
|
|
|
|
|
}
|
|
|
|
|
catch(int xiApiErrorCodes)
|
|
|
|
|
{
|
|
|
|
@ -915,10 +915,12 @@ DataBuffer::~DataBuffer()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RecordXimeaTemperature::RecordXimeaTemperature(Iris::IrisXimeaImager * imager)
|
|
|
|
|
RecordXimeaTemperature::RecordXimeaTemperature(Iris::IrisXimeaImager * imager, XimeaImager * ximeaImager)
|
|
|
|
|
{
|
|
|
|
|
m_imager = imager;
|
|
|
|
|
m_bIsRecord = true;
|
|
|
|
|
|
|
|
|
|
m_ximeaImager = ximeaImager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RecordXimeaTemperature::stopRecordTemperature()
|
|
|
|
@ -930,11 +932,24 @@ void RecordXimeaTemperature::recordTemperature(QString filePath= nullptr)
|
|
|
|
|
{
|
|
|
|
|
if(filePath== nullptr)
|
|
|
|
|
filePath="ximeaTemperature.csv";
|
|
|
|
|
ofstream ximeaTemperatureFile(filePath.toStdString().c_str(),ios::app);
|
|
|
|
|
QList<QString> fileInfo = getFileInfo(filePath);
|
|
|
|
|
bool ret = createDir(fileInfo[0]);
|
|
|
|
|
|
|
|
|
|
ofstream ximeaTemperatureFile(filePath.toStdString().c_str(),ios::app);
|
|
|
|
|
int counter = 0;
|
|
|
|
|
while(m_bIsRecord)
|
|
|
|
|
{
|
|
|
|
|
counter++;
|
|
|
|
|
|
|
|
|
|
float temp = m_imager->getTemperature();
|
|
|
|
|
if(temp > 80 && m_ximeaImager->getImagerState() == 104)
|
|
|
|
|
{
|
|
|
|
|
system("/home/300tc/projects/udpClient/udpClient 127.0.0.1 9,0");
|
|
|
|
|
}
|
|
|
|
|
if(temp > 90)
|
|
|
|
|
{
|
|
|
|
|
system("/home/300tc/projects/udpClient/udpClient 127.0.0.1 2");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDateTime curDateTime = QDateTime::currentDateTime();
|
|
|
|
|
QString currentTime = curDateTime.toString("yyyy/MM/dd hh:mm:ss");
|
|
|
|
@ -942,7 +957,12 @@ void RecordXimeaTemperature::recordTemperature(QString filePath= nullptr)
|
|
|
|
|
ximeaTemperatureFile << currentTime.toStdString() << "," << temp << "\n";
|
|
|
|
|
|
|
|
|
|
// std::cout<<"RecordXimeaTemperature::recordTemperature----------------:ximea Temperature is "<< temp <<std::endl;
|
|
|
|
|
// std::cout<<"RecordXimeaTemperature::recordTemperature----------------:ximea state is "<< m_ximeaImager->getImagerState() <<std::endl;
|
|
|
|
|
|
|
|
|
|
if (counter % 60 == 0)
|
|
|
|
|
{
|
|
|
|
|
ximeaTemperatureFile.flush();
|
|
|
|
|
}
|
|
|
|
|
sleep(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|