Changeset 695 for GTP/trunk/Lib/Vis
- Timestamp:
- 03/15/06 10:22:48 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r677 r695 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.0) on: út 14. II 10:13:0220063 # Generated by qmake (2.00a) (Qt 4.1.0) on: st 15. III 09:41:58 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r677 r695 114 114 115 115 116 /** Compute continuous PVS difference */ 117 float GetPvsHomogenity(const Pvs<T> &pvs) { 118 float 119 pvsReduction, 120 pvsEnlargement; 121 122 ComputeContinuousPvsDifference(pvs, 123 pvsReduction, 124 pvsEnlargement); 125 126 return pvsReduction + pvsEnlargement; 127 } 128 116 129 117 130 … … 122 135 123 136 124 /** Compute continuous PVS difference */ 137 /** 138 Compute continuous PVS difference of 'b' with respect to the base PVS (*this). 139 Provides separatelly PVS reduction from PVS enlargement. 140 141 */ 125 142 template <typename T> 126 143 void 127 Pvs<T>::ComputeContinuousPvsDifference(const Pvs<T> & pvs,144 Pvs<T>::ComputeContinuousPvsDifference(const Pvs<T> &b, 128 145 float &pvsReduction, 129 146 float &pvsEnlargement) 130 147 { 131 132 148 // Uses sum of log differences, which corresponds to entropy 149 std::map<T, PvsData<T>, LtSample<T> >::const_iterator it; 150 151 for (it = b.mEntries.begin(); it != b.mEntries.end(); ++ it) { 152 float bSumPdf = (*it).second.mSumPdf; 153 float aSumPdf = 0.0f; 154 PvsData<T> *data = Find((*it).first); 155 if (data) { 156 aSumPdf = data->second.mSumPdf; 157 // mark this entry as processed to avoid double counting 158 data->second.mSumPdf = -aSumPdf; 159 } 160 float diff = bSumPdf - aSumPdf; 161 162 if (diff > 0.0f) { 163 pvsEnlargement += diff; 164 } else { 165 pvsReduction += -diff; 166 } 167 } 168 169 for (it = mEntries.begin(); it != mEntries.end(); ++ it) { 170 float aSumPdf = (*it).second.mSumPdf; 171 float bSumPdf = 0.0f; 172 if (aSumPdf < 0.0f) { 173 // this entry was already accounted for! 174 // just revert it back 175 (*it).second.mSumPdf = -aSumPdf; 176 } else { 177 PvsData<T> *data = b.Find((*it).first); 178 if (data) { 179 bSumPdf = data->second.mSumPdf; 180 } 181 float diff = bSumPdf - aSumPdf; 182 183 if (diff > 0.0f) { 184 pvsEnlargement += diff; 185 } else { 186 pvsReduction += -diff; 187 } 188 } 189 } 133 190 } 134 191
Note: See TracChangeset
for help on using the changeset viewer.