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 namespace firevision {
00039 #if 0
00040 }
00041 #endif
00042
00043 class Histogram;
00044 class YuvColormap;
00045
00046 class BayesHistosToLut
00047 {
00048 public:
00049 BayesHistosToLut(std::map< hint_t, Histogram * > &histos,
00050 unsigned int d = 1,
00051 hint_t fg_object = H_UNKNOWN,
00052 unsigned int w = 256,
00053 unsigned int h = 256);
00054 ~BayesHistosToLut();
00055
00056 std::string getName();
00057
00058 float getObjectProb(hint_t object);
00059
00060 float getAPrioriProb( unsigned int u,
00061 unsigned int v,
00062 hint_t object );
00063 float getAPrioriProb( unsigned int y,
00064 unsigned int u,
00065 unsigned int v,
00066 hint_t object );
00067
00068 float getAPosterioriProb( hint_t object,
00069 unsigned int u,
00070 unsigned int v );
00071 float getAPosterioriProb( hint_t object,
00072 unsigned int y,
00073 unsigned int u,
00074 unsigned int v );
00075
00076 hint_t getMostLikelyObject( unsigned int u,
00077 unsigned int v );
00078 hint_t getMostLikelyObject( unsigned int y,
00079 unsigned int u,
00080 unsigned int v );
00081
00082 void setMinProbability( float min_prob );
00083 void setMinProbForColor( float min_prob, hint_t hint );
00084
00085 YuvColormap * get_colormap();
00086
00087
00088
00089 void calculateLutValues( bool penalty = false );
00090
00091
00092
00093 void calculateLutAllColors();
00094 void saveLut(char *file);
00095 void save(std::string filename);
00096
00097 private:
00098 std::map<hint_t, Histogram*> &histograms;
00099 std::map<hint_t, unsigned int> numberOfOccurrences;
00100 std::map<hint_t, float> object_probabilities;
00101
00102 YuvColormap *lut;
00103 unsigned int width;
00104 unsigned int height;
00105 unsigned int depth;
00106
00107 hint_t fg_object;
00108
00109 float min_probability;
00110
00111
00112 float min_prob_ball;
00113 float min_prob_green;
00114 float min_prob_yellow;
00115 float min_prob_blue;
00116 float min_prob_white;
00117 float min_prob_black;
00118 };
00119
00120 }
00121
00122 #endif