/*! * \file BarCodeQuality.h * \date 2020/05/14 * * \author Lou, Lixuan * Contact: lou.lixuan@hzleaper.com * * * \note */ #ifndef __BarCodeQuality_h_ #define __BarCodeQuality_h_ #include 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(num, BarScanQuality()); } string getGrade() { string str; str.push_back(aveScan.getGrade(BarScanQuality::overall)); return str; } std::vector scans; BarScanQuality aveScan; }; #endif // BarCodeQuality_h_