bayes_histos_to_lut.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef __FIREVISION_COLORMODEL_BAYES_HISTOS_TO_LUT_H_
00031 #define __FIREVISION_COLORMODEL_BAYES_HISTOS_TO_LUT_H_
00032
00033 #include <fvutils/base/roi.h>
00034
00035 #include <map>
00036 #include <string>
00037
00038 class Histogram;
00039 class YuvColormap;
00040
00041 class BayesHistosToLut
00042 {
00043 public:
00044 BayesHistosToLut(std::map< hint_t, Histogram * > &histos,
00045 unsigned int d = 1,
00046 hint_t fg_object = H_UNKNOWN,
00047 unsigned int w = 256,
00048 unsigned int h = 256);
00049 ~BayesHistosToLut();
00050
00051 std::string getName();
00052
00053 float getObjectProb(hint_t object);
00054
00055 float getAPrioriProb( unsigned int u,
00056 unsigned int v,
00057 hint_t object );
00058 float getAPrioriProb( unsigned int y,
00059 unsigned int u,
00060 unsigned int v,
00061 hint_t object );
00062
00063 float getAPosterioriProb( hint_t object,
00064 unsigned int u,
00065 unsigned int v );
00066 float getAPosterioriProb( hint_t object,
00067 unsigned int y,
00068 unsigned int u,
00069 unsigned int v );
00070
00071 hint_t getMostLikelyObject( unsigned int u,
00072 unsigned int v );
00073 hint_t getMostLikelyObject( unsigned int y,
00074 unsigned int u,
00075 unsigned int v );
00076
00077 void setMinProbability( float min_prob );
00078 void setMinProbForColor( float min_prob, hint_t hint );
00079
00080 YuvColormap * get_colormap();
00081
00082
00083
00084 void calculateLutValues( bool penalty = false );
00085
00086
00087
00088 void calculateLutAllColors();
00089 void saveLut(char *file);
00090 void save(std::string filename);
00091
00092 private:
00093 std::map<hint_t, Histogram*> &histograms;
00094 std::map<hint_t, unsigned int> numberOfOccurrences;
00095 std::map<hint_t, float> object_probabilities;
00096
00097 YuvColormap *lut;
00098 unsigned int width;
00099 unsigned int height;
00100 unsigned int depth;
00101
00102 hint_t fg_object;
00103
00104 float min_probability;
00105
00106
00107 float min_prob_ball;
00108 float min_prob_green;
00109 float min_prob_yellow;
00110 float min_prob_blue;
00111 float min_prob_white;
00112 float min_prob_black;
00113 };
00114
00115 #endif