1 #ifndef TEMPLATECLASS_H 2 #define TEMPLATECLASS_H 4 #include "opencv2/opencv.hpp" 11 #include <src/footballConstants.h> 19 void RGB2XYZ(
const int& sR,
27 void RGB2LAB(
const int& sR,
37 typedef std::map<soccerClass, std::map< playerPart , cv::Mat > > soccerIntImType;
38 typedef std::map< soccerClass , std::map< playerPart, gaussianMixtureColorModel > > colorClassType;
46 void clearIntegralImages();
47 void clearRectParts();
50 void setColor(QString filename, playerPart part, soccerClass clase,
bool i, QString distFilename = NULL, QString probFileName = NULL );
51 void setROI(cv::Mat roi, cv::Mat froi);
52 void setRectParts(cv::Rect roi,
int x,
int y,
int height,
int width);
54 std::string partToString(playerPart part);
59 double getDistance(cv::Vec3b bgrPixel, soccerClass team, playerPart part);
61 double getColorMapProb(soccerClass team);
63 double getRectangleSum(cv::Rect rect,
const cv::Mat &integral );
65 cv::Rect getPartOnFrameCoordinate(cv::Point offset, playerPart p);
67 std::map< playerPart, cv::Rect > part;
68 soccerIntImType integralImages;
72 cv::Rect setRectPart(
int heightROI,
int widthROI,
int x,
int y,
int height,
int width, playerPart part);
75 colorClassType ColorClasses;
89 void readParamsfromJSONFile(QString fileName);
90 void setParameters(
const cv::Mat &means,
const cv::Mat &weights, std::vector<cv::Mat> covs);
91 void deleteParameters();
93 void generateMahalanobisTable(QString fileName = NULL);
94 void generateProbTable(QString fileName = NULL);
97 void saveDistTable(QString filename);
98 void saveProbTable(QString filename);
99 void saveParameters(QString filename, QString model);
100 void readParameters(QString filename, QString model);
101 void showModel(std::string name);
103 cv::Mat getMeans(
int c);
104 cv::Mat getCov(
int c);
106 double getWeight(
int c);
107 double calcMahalanobisDistance(cv::Mat bgr_points,
int c);
108 double calcEuclideanDistance(cv::Mat bgr_points,
int c);
109 double getTableMValue(
unsigned long value,
int c);
110 double getTableValue(
unsigned long value);
111 int getIndexTableValue(
unsigned long value);
112 double getProbTableValue(
unsigned long value);
120 static unsigned long createBGR(
int r,
int g,
int b)
122 return ((b & 0xff) << 16) + ((g & 0xff) << 8) + (r & 0xff);
125 cv::Ptr<cv::ml::EM> emPointer;
134 std::vector<cv::Mat> covs;
136 std::map< unsigned long, std::vector < double > > mahalanobisDistTable;
137 std::map< unsigned long, double> distTable;
138 std::map< unsigned long, double > logLikeTable;
139 std::map< unsigned long, int > indexClassTable;
144 bool autoGeneratedTables;
148 #endif // TEMPLATECLASS_H Definition: templateclass.h:82
Definition: templateclass.h:40