You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wheeldetect/3part/Cyclops/include/BarCodeQuality.h

59 lines
1.1 KiB
C

/*!
* \file BarCodeQuality.h
* \date 2020/05/14
*
* \author Lou, Lixuan
* Contact: lou.lixuan@hzleaper.com
*
*
* \note
*/
#ifndef __BarCodeQuality_h_
#define __BarCodeQuality_h_
#include <vector>
struct BarScanQuality {
enum ParamType {
decode = 0, symbolContrast, minReflect, edgeContrast, modulation,
defects, decodability, overall,
AN, GN, FPD, UEC, RM // 2D param
};
void setParam(int type, float val) {
mParam[type] = val;
}
float getParam(int type) {
return mParam[type];
}
char getGrade(int type) {
int idx = round(mParam[type]);
return gradeTable[idx];
}
void clear() {
for (int i = 0; i < 13; ++i) {
mParam[i] = 0;
}
}
float mParam[13] = { 0};
const char gradeTable[5] = { 'F','D','C','B','A' };
};
struct BarCodeQuality
{
void setScanNum(int num) {
scans.clear();
scans = std::vector<BarScanQuality>(num, BarScanQuality());
}
string getGrade() {
string str;
str.push_back(aveScan.getGrade(BarScanQuality::overall));
return str;
}
std::vector<BarScanQuality> scans;
BarScanQuality aveScan;
};
#endif // BarCodeQuality_h_