1. 最大曝光时间乘以0.95,目的:避免曝光时间超过最大,而造成帧率降低;

2. 去掉多余的std::out,避免采集log过于杂乱;
3. 通过OpenCV从高光谱影像中提取rgb影像;
4. 在log中记录开始采集时间和停止采集时间;
5. 添加手动设置曝光时间的功能:127.0.0.1 7,2;
6. 头文件中写入仪器序列号;
This commit is contained in:
tangchao0503
2023-03-19 16:44:12 +08:00
parent e96953b54a
commit 447a1aafb1
11 changed files with 440 additions and 34 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.5.2)
project(ximeaAirborneSystem)
set(CMAKE_CXX_STANDARD 14)
@ -9,7 +9,7 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(QT Core Network SerialPort)
set(QT Core Network SerialPort Gui)
set(TEMPLATE app)
set(TARGET ximeaImageRecorder)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@ -17,9 +17,12 @@ find_package(Qt5 REQUIRED ${QT})#
include_directories(.)
include_directories(/home/300tc/library/ximeaControlDll/Header_Files)
link_directories(/home/300tc/library/ximeaControlDll)
find_package(OpenCV 4.2.0 REQUIRED)
include_directories(/usr/local/include/opencv4/)
link_directories(/usr/local/lib)
add_executable(${CMAKE_PROJECT_NAME}
Source_Files/fileoperation.cpp
Header_Files/fileoperation.h
@ -43,10 +46,11 @@ add_executable(${CMAKE_PROJECT_NAME}
Source_Files/configfile.cpp
Header_Files/configfile.h
Header_Files/MemoryPool.tcc
Header_Files/MemoryPool.h)
Header_Files/MemoryPool.h Source_Files/rgbImage.cpp Header_Files/rgbImage.h)
qt5_use_modules(${CMAKE_PROJECT_NAME} ${QT})
target_link_libraries(${CMAKE_PROJECT_NAME}
irisXimeaImager
libconfig.so
libconfig++.so)
libconfig++.so
${OpenCV_LIBS})

View File

@ -9,6 +9,7 @@
#include <iomanip>
#include <cstdlib>
#include <libconfig.h++>
#include <string>
#include <QFileInfo>
#include <QString>
@ -32,6 +33,7 @@ public:
bool getEffectiveWindow(int &width, int &offsetx, int &height, int &offsety);
bool getEffectiveWindowRoi(int &width, int &offsetx);
bool getGainOffset(float &gain, float &offset);
bool getSN(QString &SN);
bool createConfigFile();
bool updateConfigFile();

75
Header_Files/rgbImage.h Normal file
View File

@ -0,0 +1,75 @@
//
// Created by tangchao on 2022/12/24.
//
#ifndef XIMEAAIRBORNESYSTEM_RGBIMAGE_H
#define XIMEAAIRBORNESYSTEM_RGBIMAGE_H
#include <iostream>
#include <string>
#include <QObject>
#include <QImage>
#include <opencv2/opencv.hpp>//包含了所有东西,编译很慢
using namespace cv;
class rgbImage :public QObject
{
Q_OBJECT
public:
rgbImage(QWidget* pParent = NULL);
~rgbImage();
void SetRgbImageWidthAndHeight(int BandCount, int Sample, int FrameNumber);
void FillRgbImage(unsigned short *datacube);
void FillFocusGrayImage(unsigned short *datacube);
void FillFocusGrayQImage(unsigned short * datacube);
void FillOnerowofRgbImage(cv::Mat * matRgbImage, int rowNumber, unsigned short *datacube);
QImage *m_QRgbImage;
cv::Mat *m_matRgbImage;
QImage *m_qimageFocusGrayImage;
cv::Mat *m_matFocusGrayImage;//用于调焦时,显示一帧的灰度图
//cv::Mat m_matFocusGrayImage;//用于调焦时,显示一帧的灰度图
CvVideoWriter *m_frame_writer;
VideoWriter m_VideoWriter;
// VideoWriter m_video("appsrc ! autovideoconvert ! filesink location=/media/nvme/delete/live.avi", CV_FOURCC('M', 'J', 'P', 'G'), 25.0, Size(640, 480));
// VideoWriter video("test.avi", CV_FOURCC('M', 'J', 'P', 'G'), 25.0, Size(640, 480));//
//控制该填充rgb图像第几帧数据
//以下两种情况需要重置为01调用函数SetRgbImageWidthAndHeight2每次开始填充数据前
int m_iFrameCounter;
int m_iFramerate;//
protected:
private:
int m_iSampleNumber;//
int m_iBandNumber;//
int m_iFrameNumber;//
public slots:
signals :
void sendstr(QString str);
void sendstr1(QString str);
void refreslabelimg(QImage* img1);
};
#endif //XIMEAAIRBORNESYSTEM_RGBIMAGE_H

View File

@ -2,12 +2,15 @@
#define UTILITY_TC_H
#include <iostream>
#include <ctime>
#include <QString>
#include <QDebug>
QString getFileNameBaseOnTime();
QString formatTimeStr(char * format);
//https://blog.csdn.net/MoreWindows/article/details/6657829
void bubbleSort(unsigned short * a, int n);

View File

@ -41,6 +41,8 @@
#include <queue>
#include <QMutex>
#include "rgbImage.h"
//#ifdef WIN32
@ -96,7 +98,7 @@ Q_OBJECT
public:
WriteData2Disk();
void setParm(queue<DataBuffer *> * q, QString baseFileName, int frameSizeInByte, MemoryPool<DataBuffer> * pool);
void setParm(queue<DataBuffer *> * q, QString baseFileName, int frameSizeInByte, MemoryPool<DataBuffer> * pool, rgbImage * rgbImage);
private:
queue<DataBuffer *> * m_q;
@ -104,6 +106,8 @@ private:
int m_iFrameSizeInByte;
MemoryPool<DataBuffer> * m_pool;
rgbImage * m_rgbImage;
public slots:
void write2Disk();
@ -116,10 +120,12 @@ class XimeaImager : public QObject
public:
XimeaImager();
~XimeaImager();
void setFramerate(double framerate);
double getFramerate();
double setExposureTime(float exposureTime);
double wrapSetExposureTime(float exposureTime_in_us);
double getExposureTime();
double autoExposure();
void setGain(double gain);
@ -159,6 +165,7 @@ private:
bool m_bRecordControl;
int m_iFrameCounter;
int m_iFrameSizeInByte;
rgbImage * m_rgbImage;
void writeHdr();
void processXiApiErrorCodes(int xiApiErrorCodes);

View File

@ -206,6 +206,22 @@ bool Configfile::getGainOffset(float &gain, float &offset)
return true;
}
bool Configfile::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 Configfile::createConfigFile()
{
using namespace std;

253
Source_Files/rgbImage.cpp Normal file
View File

@ -0,0 +1,253 @@
//
// Created by tangchao on 2022/12/24.
//
#include "../Header_Files/rgbImage.h"
rgbImage::rgbImage(QWidget* pParent)
{
m_QRgbImage = nullptr;
m_matRgbImage = nullptr;
m_matFocusGrayImage = nullptr;
m_qimageFocusGrayImage = nullptr;
}
rgbImage::~rgbImage()
{
}
void rgbImage::SetRgbImageWidthAndHeight(int BandCount, int Sample, int FrameNumber)
{
using namespace cv;
if (m_QRgbImage != nullptr)
{
delete m_QRgbImage;//有问题????????????????????????????????????????????????
}
//m_QRgbImage = new QImage(Sample, FrameNumber, QImage::Format_RGB888);
if (m_matRgbImage != nullptr)
{
delete m_matRgbImage;
}
m_matRgbImage = new Mat(FrameNumber, Sample, CV_8UC3, Scalar(0, 0, 0));
int codec = VideoWriter::fourcc('M', 'P', '4', '2'); // select desired codec (must be available at runtime)
double fps = 20.0; // framerate of the created video stream
std::string filename = "appsrc ! autovideoconvert ! filesink location=/media/nvme/delete/live.avi";//https://blog.csdn.net/ancientapesman/article/details/117324638
m_VideoWriter.open(filename, codec, fps, m_matRgbImage->size(), true);
// VideoWriter video("test.avi", CV_FOURCC('M', 'J', 'P', 'G'), 25.0, Size(640, 480));
// m_frame_writer = cvCreateVideoWriter("/media/nvme/delete/live.avi", cv::VideoWriter::fourcc('M', 'J', 'P', 'G'), 20.0, Size(688, 688), false);
if (m_qimageFocusGrayImage == nullptr)
{
m_qimageFocusGrayImage = new QImage(Sample, BandCount, QImage::Format_RGB32);
}
if (m_matFocusGrayImage == nullptr)
{
m_matFocusGrayImage = new Mat(BandCount, Sample, CV_16U, Scalar(0));
//cv::Mat matAdjustPreview = Mat::zeros(BandCount, Sample, CV_16U);
}
//cv::Mat matAdjustPreview = Mat::zeros(BandCount, Sample, CV_16U);
//m_matFocusGrayImage = matAdjustPreview;
std::cout << "设置帧数:" << FrameNumber << std::endl;
m_iFrameCounter = 0;//每次都重置为0
m_iSampleNumber = Sample;
m_iBandNumber = BandCount;
m_iFrameNumber = FrameNumber;
//std::cout << "rgb影像内存地址为" << m_QRgbImage << std::endl;
}
void rgbImage::FillOnerowofRgbImage(cv::Mat * matRgbImage, int rowNumber, unsigned short *datacube)
{
unsigned short r, g, b;
for (int j = 0; j < m_iSampleNumber; j++)
{
//取值一帧影像中从左到右的rgb像元值
r = *(datacube + 121 * m_iSampleNumber + j)*255/4096;
g = *(datacube + 79 * m_iSampleNumber + j)*255/4096;
b = *(datacube + 40 * m_iSampleNumber + j)*255/4096;
//将像元值赋值到cv::Mat中操作像元值https://zhuanlan.zhihu.com/p/51842288
//int dataType = m_matRgbImage->type();//当数据类型为CV_16UC3时返回18
//std::cout << "m_matRgbImage数据类型为" << dataType << std::endl;
if (matRgbImage->type() == CV_16UC3)
{
//std::cout << "操作像素值!" << std::endl;
matRgbImage->at<cv::Vec3w>(rowNumber, j)[2] = r;
matRgbImage->at<cv::Vec3w>(rowNumber, j)[1] = g;
matRgbImage->at<cv::Vec3w>(rowNumber, j)[0] = b;
}
}
}
void rgbImage::FillRgbImage(unsigned short *datacube)
{
unsigned short *r_row, *g_row, *b_row;
if(m_iFrameCounter<m_iFrameNumber)
{
FillOnerowofRgbImage(m_matRgbImage, m_iFrameCounter, datacube);
// std::cout << "小于:" << m_iFrameNumber << std::endl;
}
else
{
// std::cout << "大于:" << m_iFrameNumber << std::endl;
//通过行赋值将前m_iFrameNumber-1行向上移动一行https://blog.csdn.net/u014686356/article/details/65937750
// m_matRgbImage->rowRange(1, m_matRgbImage->rows).copyTo(m_matRgbImage->rowRange(0, m_matRgbImage->rows-1));
for (int i = 1; i < m_matRgbImage->rows; ++i)
{
// std::cout << "大于:" << i << std::endl;
m_matRgbImage->col(i).copyTo(m_matRgbImage->col(i-1));
// std::cout << "--------------" << i << std::endl;
}
// std::cout << "1111111111111111111111111111"<< std::endl;
//通过FillOnerowofRgbImage为m_iFrameNumber行赋值
FillOnerowofRgbImage(m_matRgbImage, m_iFrameNumber-1, datacube);
// std::cout << "22222222222222222"<< std::endl;
// //循环给每行像素赋值
// r_row = datacube + 121 * m_iSampleNumber;
// g_row = datacube + 79 * m_iSampleNumber;
// b_row = datacube + 40 * m_iSampleNumber;
// for (int j = 0; j < m_iFrameNumber; j++)
// {
// p = m_matRgbImage.ptr<uchar>(j);
// for ( j = 0; j < nCols; ++j){
// p[j] = table[p[j]];
// }
//
// }
//保存rgb图片
if (m_iFrameCounter % m_iFramerate == 0 || m_iFrameCounter == m_iFrameNumber - 1)
{
////保存文件
//FileOperation * fileOperation = new FileOperation();
//string directory = fileOperation->getDirectoryOfExe();
//string rgbFilePathStrech = “/media/nvme/300TC/config/” + "\\tmp_image_strech.png";//没有拉伸图片
// std::string rgbFilePathNoStrech = "/media/nvme/300TC/config/" + std::to_string(m_iFrameCounter) + "ctmp_image_no_strech.png";
//m_QRgbImage->save(QString::fromStdString(rgbFilePathNoStrech), "PNG");
// cv::imwrite(rgbFilePathNoStrech, *m_matRgbImage);
//cv::imwrite(rgbFilePathStrech, CStretch(*m_matRgbImage, 0.01));
}
m_VideoWriter.write(*m_matRgbImage);
std::string rgbFilePathNoStrech = "/media/nvme/delete/" + std::to_string(m_iFrameCounter) + "ctmp_image_no_strech.png";
cv::imwrite(rgbFilePathNoStrech, *m_matRgbImage);
}
m_iFrameCounter++;
}
void rgbImage::FillFocusGrayImage(unsigned short * datacube)
{
int rowCount = m_matFocusGrayImage->rows;
int colCount = m_matFocusGrayImage->cols;
for (unsigned short i = 0; i < m_matFocusGrayImage->rows; i++)
{
for (unsigned short j = 0; j < m_matFocusGrayImage->cols; j++)
{
//m_matFocusGrayImage->at<ushort>(i, j) = *(datacube + m_matFocusGrayImage->cols*i + j);
m_matFocusGrayImage->at<ushort>(i, j) = datacube[m_matFocusGrayImage->cols*i + j];
}
}
//int rowCount = m_matFocusGrayImage.rows;
//int colCount = m_matFocusGrayImage.cols;
////memcpy(m_matFocusGrayImage.data, datacube, rowCount*colCount);
//for (unsigned short i = 0; i < m_matFocusGrayImage.rows; i++)
//{
// for (unsigned short j = 0; j < m_matFocusGrayImage.cols; j++)
// {
// m_matFocusGrayImage.at<ushort>(i, j) = *(datacube + m_matFocusGrayImage.cols*i + j);
// //m_matFocusGrayImage.at<ushort>(i, j) = datacube[colCount*i + j];
// }
//}
//将mat保存成文件
//cv::imwrite("D:/delete/2222222222/test.bmp", m_matFocusGrayImage);
}
void rgbImage::FillFocusGrayQImage(unsigned short * datacube)
{
float two_eight = pow(2.0, 8);
float two_sixteen = pow(2.0, 12);
int width = m_qimageFocusGrayImage->width();
int height = m_qimageFocusGrayImage->height();
for (unsigned short i = 0; i < height; i++)
{
for (unsigned short j = 0; j < width; j++)
{
//uint tmp = (two_eight* *(datacube + width * i + j)) / two_sixteen;
uint tmp = (two_eight* datacube[width*i + j]) / two_sixteen;
//uint tmp = datacube[width*i + j];
//m_qimageFocusGrayImage->setPixel(j, i, tmp);
m_qimageFocusGrayImage->setPixel(j, i, qRgb((unsigned char)tmp, (unsigned char)tmp, (unsigned char)tmp));
}
}
m_qimageFocusGrayImage->save("D:/delete/2222222222/test.bmp");
/*float two_eight = pow(2.0, 8);
float two_sixteen = pow(2.0, 16);
QImage *qi = new QImage(imwidth, imheight, QImage::Format_RGB32);
for (int i = 0; i < imheight; i++)
{
for (int j = 0; j < imwidth; j++)
{
floatData[i*imwidth + j] = (two_eight* floatData[i*imwidth + j]) / two_sixteen;
qi->setPixel(j, i, qRgb((unsigned char)floatData[i*imwidth + j], (unsigned char)floatData[i*imwidth + j], (unsigned char)floatData[i*imwidth + j]));
}
}*/
}

View File

@ -622,19 +622,19 @@ void sbgtc::SbgRecorder::parseSbgMessage(QByteArray * sbgMessage)
switch (mode)
{
case SBG_ECOM_SOL_MODE_UNINITIALIZED:
std::cout<<"此刻模式为: "<<"UNINITIALIZED"<<std::endl;
// std::cout<<"此刻模式为: "<<"UNINITIALIZED"<<std::endl;
break;
case SBG_ECOM_SOL_MODE_VERTICAL_GYRO:
std::cout<<"此刻模式为: "<<"VERTICAL_GYRO"<<std::endl;
// std::cout<<"此刻模式为: "<<"VERTICAL_GYRO"<<std::endl;
break;
case SBG_ECOM_SOL_MODE_AHRS:
std::cout<<"此刻模式为: "<<"AHRS"<<std::endl;
// std::cout<<"此刻模式为: "<<"AHRS"<<std::endl;
break;
case SBG_ECOM_SOL_MODE_NAV_VELOCITY:
std::cout<<"此刻模式为: "<<"NAV_VELOCITY"<<std::endl;
// std::cout<<"此刻模式为: "<<"NAV_VELOCITY"<<std::endl;
break;
case SBG_ECOM_SOL_MODE_NAV_POSITION:
std::cout<<"此刻模式为: "<<"NAV_POSITION"<<std::endl;
// std::cout<<"此刻模式为: "<<"NAV_POSITION"<<std::endl;
break;
default:
@ -798,7 +798,7 @@ void sbgtc::SbgRecorder::startRecordSbg()
while (m_bRecordControl)
{
//std::cout<<"SbgRecorder::startRecordSbg--------------:"<<std::endl;
if(m_serial->waitForReadyRead())
if(m_serial->waitForReadyRead(30000))
{
//requestData.resize(m_serial->size());
requestData = m_serial->readAll();

View File

@ -169,18 +169,9 @@ void UdpServer::processPendingDatagrams()
}
case 7:
{
if(datagramList[1].toInt()==1)
{
std::cout<<"拷贝数据!"<<std::endl;
emit startCopyFileSignal();
}
else if(datagramList[1].toInt()==0)
{
std::cout<<"删除数据!"<<std::endl;
emit startDeleteFileSignal();
}
float time = datagramList[1].toFloat();//ms
m_imager->wrapSetExposureTime(time*1000);
std::cout<<"7手动设置曝光时间为" << time <<std::endl;
break;
}
@ -260,9 +251,9 @@ void UdpServer::sender(int status)
void UdpServer::sendSerialPortStatus(int serialPortStatus)
{
std::cout<<"UdpServer::sendSerialPortStatus---------------------:"<< serialPortStatus <<std::endl;
// std::cout<<"UdpServer::sendSerialPortStatus---------------------:"<< serialPortStatus <<std::endl;
std::cout<<"UdpServer::sendSerialPortStatus---------------------:"<< m_clientIpAddress.AnyIPv4 <<std::endl;
// std::cout<<"UdpServer::sendSerialPortStatus---------------------:"<< m_clientIpAddress.AnyIPv4 <<std::endl;
QByteArray datagram2send;
@ -274,7 +265,7 @@ void UdpServer::sendSerialPortStatus(int serialPortStatus)
void UdpServer::sendSbgSolutionModeState(int SolutionMode)
{
std::cout<<"UdpServer::sendSbgSolutionModeState---------------------:"<< SolutionMode <<std::endl;
// std::cout<<"UdpServer::sendSbgSolutionModeState---------------------:"<< SolutionMode <<std::endl;
QByteArray datagram2send;
@ -298,7 +289,7 @@ void UdpServer::sendSbgAccuracyState(int Accuracy,int SatelliteCounter)
void UdpServer::sendXimeaImageStatus(int ximeaImageStatus)
{
std::cout<<"UdpServer::sendXimeaImageStatus---------------------:"<< ximeaImageStatus <<std::endl;
// std::cout<<"UdpServer::sendXimeaImageStatus---------------------:"<< ximeaImageStatus <<std::endl;
QByteArray datagram2send;
@ -310,7 +301,7 @@ void UdpServer::sendXimeaImageStatus(int ximeaImageStatus)
void UdpServer::sendCopyFileStatus(int fileStatus)
{
std::cout<<"UdpServer::sendCopyFileStatus---------------------:"<< fileStatus <<std::endl;
// std::cout<<"UdpServer::sendCopyFileStatus---------------------:"<< fileStatus <<std::endl;
QByteArray datagram2send;

View File

@ -1,6 +1,25 @@
#include "Header_Files/utility_tc.h"
#include <QDir>
QString formatTimeStr(char * format)
{
//获取系统时间
time_t timer;//time_t就是long int 类型
struct tm *tblock;
timer = time(NULL);//返回秒数(精度为秒)从1970-1-1,00:00:00 可以当成整型输出或用于其它函数
tblock = localtime(&timer);
//printf("Local time is: %s\n", asctime(tblock));
//格式化时间为需要的格式
char timeStr_tmp[256] = { 0 };
strftime(timeStr_tmp, sizeof(timeStr_tmp), format, tblock);//
QString timeStr2(timeStr_tmp);
// qDebug() << "time is:" << timeStr2;
return timeStr2;
}
QString getFileNameBaseOnTime()
{
using namespace std;

View File

@ -30,6 +30,13 @@ XimeaImager::XimeaImager()
m_pool = new MemoryPool<DataBuffer>;
q = new queue<DataBuffer *>;
m_rgbImage = new rgbImage();
}
XimeaImager::~XimeaImager()
{
}
void XimeaImager::openImger()
@ -70,6 +77,9 @@ void XimeaImager::openImger()
if (ret)
{
m_imager.setEffectiveWindow(offsetx, width, offsety, height);
m_rgbImage->SetRgbImageWidthAndHeight(height, width, 20);
std::cout<<"height"<< height <<std::endl;
std::cout<<"width"<< width <<std::endl;
}
// int width_roi = 0, offsetx_roi = 0;
@ -206,6 +216,14 @@ double XimeaImager::setExposureTime(float exposureTime_in_us)
}
}
double XimeaImager::wrapSetExposureTime(float exposureTime_in_us)
{
setExposureTime(exposureTime_in_us);
m_iImagerState=103;
emit ximeaImageStatus(m_iImagerState);
}
double XimeaImager::autoExposure()
{
double exposureTime;
@ -216,7 +234,7 @@ double XimeaImager::autoExposure()
float suitableMaxValue=4095 * 0.8;
double framerate = m_imager.get_framerate();
double maxExposureTime = 1/framerate*1000000;
double maxExposureTime = 1/framerate*1000000*0.95;//0.95目的:避免曝光时间超过最大,而造成帧率降低
exposureTime=setExposureTime(maxExposureTime);
bool bIsAutoExposureOk=false;
@ -447,7 +465,10 @@ void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString base
m_iImagerState=104;
emit ximeaImageStatus(m_iImagerState);
printf("开始采集!\n");
char * timeFormat="%Y%m%d_%H%M%S";
QString timeStr = formatTimeStr(timeFormat);
printf("开始采集:%s!\n", timeStr.toStdString().c_str());
m_iFrameCounter=0;
m_bRecordControl=true;
@ -456,11 +477,12 @@ void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString base
QString timesFileName=m_baseFileName+".times";
FILE *hHimesFile=fopen(timesFileName.toStdString().c_str(),"w+");
std::cout << "曝光时间为:" << getExposureTime()/1000 << "ms" <<std::endl;
using namespace std;
// ofstream timesFileHandle(timesFileName.toStdString()+"_ofstream");
writeData2Disk->setParm(q,m_baseFileName,m_iFrameSizeInByte, m_pool);
writeData2Disk->setParm(q,m_baseFileName,m_iFrameSizeInByte, m_pool, m_rgbImage);
emit startWriteDiskSignal();
m_imager.start();
@ -528,7 +550,8 @@ void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString base
fclose(hHimesFile);
// timesFileHandle.close();
printf("Stopping acquisition...\n");
timeStr = formatTimeStr(timeFormat);
printf("停止采集:%s!\n", timeStr.toStdString().c_str());
writeHdr();
@ -553,6 +576,11 @@ void XimeaImager::writeHdr()
ofstream hdrFileHandle(hdrPath.toStdString());
hdrFileHandle << "ENVI\n";
QString SN;
m_configfile.getSN(SN);
hdrFileHandle << "SN = " << SN.toStdString() << "\n";
hdrFileHandle << "interleave = bil\n";
hdrFileHandle << "byte order = 0\n";
hdrFileHandle << "data type = 2\n";
@ -798,19 +826,27 @@ void WriteData2Disk::write2Disk()
m_q->pop();
r_qtx.unlock();
//构造rgb图像用于推流到m300遥控器
m_rgbImage->FillRgbImage(dataBuffer);
// std::cout<<"WriteData2Disk::write2Disk-----------------------正在写磁盘!" << m_pool->max_size() <<std::endl;//
fwrite(dataBuffer,1,m_iFrameSizeInByte, hFile);
frameCounter++;
}
m_rgbImage->m_VideoWriter.release();
std::cout<<"WriteData2Disk::write2Disk-----------------------写磁盘线程将退出,内存池可达到的最多元素数:" << m_pool->max_size() <<std::endl;
std::cout<<"WriteData2Disk::write2Disk-----------------------写磁盘线程将退出,共写帧数:" << frameCounter <<std::endl;
}
void WriteData2Disk::setParm(queue<DataBuffer *> * q, QString baseFileName, int frameSizeInByte, MemoryPool<DataBuffer> * pool)
void WriteData2Disk::setParm(queue<DataBuffer *> * q, QString baseFileName, int frameSizeInByte, MemoryPool<DataBuffer> * pool, rgbImage * rgbImage)
{
m_q = q;
m_QbaseFileName = baseFileName;
m_iFrameSizeInByte = frameSizeInByte;
m_pool = pool;
m_rgbImage = rgbImage;
}