Files
ximeaAirborneSystem/Header_Files/ximeaimager.h
tangchao0503 8aa402bd5d 1. 读写配置文件类(Configfile):1)修复一些返回值bug,2)添加读写 裁剪有效窗口的参数 的函数getEffectiveWindowRoi;
2. 在没有采集数据时,读取ximea温度,并写入到csv文件中;
3. 在另外的工程更新了ximea控制类(Iris::IrisXimeaImager),并在此工程加入此更新:从获取的有效窗口中裁剪需要的数据,m_imager.setEffectiveWindowRoi();
4. 在函数XimeaImager::processXiApiErrorCodes中,增加处理ximea错误码12;
2022-08-15 17:36:19 +08:00

147 lines
3.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef XIMEAIMAGER_H
#define XIMEAIMAGER_H
/*
This is the reference example application code for XIMEA cameras.
You can use it to simplify development of your camera application.
Sample name:
xiAPI / Capture-10-images
Description:
Open camera, capture 10 images while printing first pixel from each image.
Workflow:
1: Open camera
2: Set parameters
3: Start acquisition
4: Each image captured - print dimensions and value of the first pixel
*/
#include <stdio.h>
#include <iostream>
#include <sys/time.h>
#include <memory.h>
#include <fstream>
#include <unistd.h>
#include <exception>
#include <QObject>
#include <QDateTime>
#include <qthread.h>
#include "configfile.h"
#include "irisximeaimager.h"
#include "math.h"
#include "utility_tc.h"
//#ifdef WIN32
//#include <xiApi.h> // Windows
//#else
//#include <m3api/xiApi.h> // Linux, OSX
//#endif
class RecordXimeaTemperature : public QObject
{
Q_OBJECT
public:
RecordXimeaTemperature(Iris::IrisXimeaImager * imager);
void stopRecordTemperature();
private:
Iris::IrisXimeaImager * m_imager;
bool m_bIsRecord;
public slots:
void recordTemperature(QString filePath);
signals:
};
class XimeaImager : public QObject
{
Q_OBJECT
public:
XimeaImager();
void setFramerate(double framerate);
double getFramerate();
double setExposureTime(float exposureTime);
double getExposureTime();
double autoExposure();
void setGain(double gain);
double getGain();
int getSampleCount();
int getBandCount();
int getWindowStartBand();
int getWindowEndBand();
double geWavelengthAtBand(int x);
void stopRecord();
int getFrameCounter();
int getMaxValueOfOneFrame(unsigned short * data, int numberOfPixel);
int getImagerState() const;
private:
//0-61ximea官方错误代码99发生的ximea官方错误代码没有处理100未打开101打开102设置帧率103自动曝光104正在采集
int m_iImagerState;
int m_iImagerStateTemp;
QThread * m_recordTempThread;
RecordXimeaTemperature * m_ximeaTemperature;
QString m_baseFileName;
QString m_ximeaTemperatureCSVPath;
Iris::IrisXimeaImager m_imager;
unsigned short * m_buffer;
bool m_bRecordControl;
int m_iFrameCounter;
int m_iFrameSizeInByte;
void writeHdr();
void processXiApiErrorCodes(int xiApiErrorCodes);
inline double getSbgTime(double TimeDifferenceBetweensOSAndSbg)
{
struct timespec systemTime;
clock_gettime(CLOCK_REALTIME,&systemTime);
tm systemTime_rili;
localtime_r(&systemTime.tv_sec, &systemTime_rili);
double secondSystem=(systemTime_rili.tm_mday-1)*24*60*60+systemTime_rili.tm_hour*60*60+systemTime_rili.tm_min*60+systemTime_rili.tm_sec;
double nanosecondSystem=secondSystem+static_cast<double>(systemTime.tv_nsec)/1000000000;
// printf("\n");
// printf("XimeaImager::getSbgTime------系统时间纳秒%d\n", systemTime.tv_nsec);
// printf("XimeaImager::getSbgTime------系统时间(未偏移)%f\n", nanosecondSystem);
// printf("XimeaImager::getSbgTime------系统时间(偏移)%f\n", nanosecondSystem-TimeDifferenceBetweensOSAndSbg);
return nanosecondSystem-TimeDifferenceBetweensOSAndSbg;
}
Configfile m_configfile;
public slots:
void openImger();
void closeImger();
void startRecord(double TimeDifferenceBetweensOSAndSbg,QString baseFileName);
signals:
void recordFinished();
void ximeaImageStatus(int);
void recordXimeaTemperatureSignal(QString);
};
#endif // XIMEAIMAGER_H