You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

87 lines
2.9 KiB

#pragma once
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
namespace a8k_opt_algo {
using namespace std;
/***********************************************************************************************************************
* 预处理 *
***********************************************************************************************************************/
typedef enum {
kOptErr_suc,
kOptErr_pointNumError,
} ecode_t;
class OptAlgoPreProcessResult {
public:
bool scanAgain;
int32_t suggestScanGain;
};
ecode_t T_A8kOptAlgoPreProcess(vector<float> ogigin_val, //
int32_t now_scan_gain, //
int32_t expectResultRangeStart, //
int32_t expectResultRangeEnd, //
OptAlgoPreProcessResult& result);
ecode_t F_A8kOptAlgoPreProcess(vector<float> ogigin_val, //
int32_t now_scan_gain, //
int32_t expectResultRangeStart, //
int32_t expectResultRangeEnd, //
OptAlgoPreProcessResult& result);
/***********************************************************************************************************************
* 数据分析 *
***********************************************************************************************************************/
class PeakInfo {
public:
bool find_peak; // 是否找到峰
float area; // 峰面积
int peak_pos; // 峰位置
int peak_start_pos; // 峰开始位置
int peak_end_pos; // 峰结束位置
};
class OptAlgoResult {
public:
/**
* @brief 原始数据
*/
vector<float> displayData; // 250 压缩后的数据
/**
* @brief 峰的信息
*/
PeakInfo pin040; // 峰040的信息
PeakInfo pin080; // 峰080的信息
PeakInfo pin120; // 峰120的信息
PeakInfo pin160; // 峰160的信息
PeakInfo pin200; // 峰200的信息
};
ecode_t A8kOptAlgoProcess(vector<float> ogigin_val, OptAlgoResult& result);
/**
* @brief Debug
*/
class PorcessContext {
public:
vector<float> raw; //
vector<float> avg; //
vector<float> diff; // 一阶斜率
vector<float> diffX2; // 二阶斜率
float agvline; //
};
void A8kOptAlgoGetProcessContext(PorcessContext& context);
} // namespace a8k_opt_algo