- Timestamp:
- 02/19/07 09:16:59 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/src/metrics.cpp
r2090 r2127 13 13 using namespace VMI; 14 14 15 GLdouble VMI::computeMeanProjAreaNoBG( GLuint **histogram, GLuint numCameras, int t) {16 GLuint i;15 GLdouble VMI::computeMeanProjAreaNoBG(int **histogram, int numCameras, int t) { 16 int i; 17 17 GLdouble mean_proj_area = 0.0; 18 18 … … 24 24 } 25 25 26 GLdouble VMI::computeMeanProjArea( GLuint **histogram, GLuint numCameras, int t) {27 GLuint i;26 GLdouble VMI::computeMeanProjArea(int **histogram, int numCameras, int t) { 27 int i; 28 28 GLdouble mean_proj_area = 0.0, total_proj_area, resolution = width * height; 29 29 … … 38 38 /////////////////////////////////////////////////////////////////////////////// 39 39 // Mutual Information 40 GLdouble VMI::computeMI(Mesh *mesh, GLuint **histogram, GLuint numCameras, GLuint cam) {40 GLdouble VMI::computeMI(Mesh *mesh, int **histogram, int numCameras, int cam) { 41 41 GLdouble I = 0.0, pov, po, total_proj_area = width * height; 42 GLuint i;42 int i; 43 43 44 44 for (i=0; i<mesh->numTriangles; i++) { … … 66 66 } 67 67 68 GLdouble VMI::decMI(GLdouble I, GLuint **histogram, GLuint numCameras, GLuint cam, Change *c) {68 GLdouble VMI::decMI(GLdouble I, int **histogram, int numCameras, int cam, Change *c) { 69 69 GLdouble newI = I * numCameras, 70 70 pov = 0.0, po; … … 109 109 } 110 110 111 GLdouble VMI::incMI(GLdouble I, GLuint **histogram, GLuint numCameras, GLuint cam, Change *c) {111 GLdouble VMI::incMI(GLdouble I, int **histogram, int numCameras, int cam, Change *c) { 112 112 GLdouble newI = I * numCameras, 113 113 pov = 0.0, po; 114 114 GLsizei total_proj_area = width * height; 115 GLuint i, t;115 int i, t; 116 116 117 117 // increase entropy of modified triangles 118 for (i=0; i< (GLuint)c->numMod; i++) {118 for (i=0; i<c->numMod; i++) { 119 119 120 120 t = c->modified[i].id; … … 140 140 /////////////////////////////////////////////////////////////////////////////// 141 141 // Kullback-Leibler divergence 142 GLdouble VMI::computeKL(Mesh *mesh, GLuint *histogram) {142 GLdouble VMI::computeKL(Mesh *mesh, int *histogram) { 143 143 GLdouble I = 0.0, 144 144 total_real_area = 0.0, pi, tri_area; 145 145 GLsizei total_proj_area = (width * height) - histogram[0]; 146 GLuint i;146 int i; 147 147 148 148 // Compute total real area of all triangles … … 169 169 170 170 // Hellinger divergence (square root) 171 GLdouble VMI::computeHE(Mesh *mesh, GLuint *histogram) {171 GLdouble VMI::computeHE(Mesh *mesh, int *histogram) { 172 172 GLdouble I = 0.0, temp, 173 173 total_real_area = 0.0, pi, qi; 174 174 GLsizei total_proj_area = (width * height) - histogram[0]; 175 GLuint i;175 int i; 176 176 177 177 // Compute total real area of all triangles … … 203 203 204 204 // Chi-Square divergence (square root) 205 GLdouble VMI::computeCS(Mesh *mesh, GLuint *histogram) {205 GLdouble VMI::computeCS(Mesh *mesh, int *histogram) { 206 206 GLdouble I = 0.0, 207 207 total_real_area = 0.0, pi, qi; 208 208 GLsizei total_proj_area = (width * height) - histogram[0]; 209 GLuint i;209 int i; 210 210 211 211 /// Compute total real area of all triangles … … 231 231 } 232 232 /////////////////////////////////////////////////////////////////////////////// 233 GLdouble VMI::computeEntropy( GLuint **histogram, GLuint numCameras, GLuint k) {233 GLdouble VMI::computeEntropy(int **histogram, int numCameras, int k) { 234 234 GLdouble H = 0.0, POk, pi, 235 235 total_proj_area, resolution = width * height, pv = 1.0 / (GLdouble)numCameras; 236 GLuint i;236 int i; 237 237 238 238 for (i=0; i<numCameras; i++) { … … 253 253 } 254 254 255 GLdouble VMI::computeMixedEntropy(GLdouble *mixed, GLuint numCameras) {255 GLdouble VMI::computeMixedEntropy(GLdouble *mixed, int numCameras) { 256 256 GLdouble H = 0.0, pi; 257 GLuint i;257 int i; 258 258 259 259 for (i=0; i<numCameras; i++) { … … 269 269 /////////////////////////////////////////////////////////////////////////////// 270 270 // Jensen-Shannon divergence 271 GLdouble VMI::computeJS( GLuint **histogram, GLuint numCameras, GLuint j, GLuint k) {271 GLdouble VMI::computeJS(int **histogram, int numCameras, int j, int k) { 272 272 GLdouble js, Wj = 0.0, Wk = 0.0, POj, POk, pj, pk, total_proj_area, 273 273 resolution = width * height, pv = 1.0 / (GLdouble)numCameras, 274 274 *mixing = (GLdouble *)malloc(numCameras * sizeof(GLdouble)); 275 GLuint i;275 int i; 276 276 277 277 POj = computeMeanProjArea(histogram, numCameras, j + 1); … … 311 311 } 312 312 /////////////////////////////////////////////////////////////////////////////// 313 void VMI::getProjectedAreas(GLuint **histogram, GLuint numCameras) { 314 315 renderScene(histogram, numCameras); 316 } 317 318 void VMI::getProjectedAreasWin(GLuint **histogram, GLuint numCameras, Change *c) { 319 320 renderSceneWin(histogram, numCameras, c); 321 } 322 323 void VMI::resetProjectedAreas(GLuint **histogram, GLuint numCameras) { 324 GLuint i = 0; 325 326 // Reset the projected areas for all cameras 327 for (i=0; i<numCameras; i++) 328 resetSWHistogram(histogram[i], mesh->numTriangles); 329 } 330 331 GLdouble *VMI::initIs(GLuint numCameras) { 313 314 GLdouble *VMI::initIs(int numCameras) { 332 315 GLdouble *initialIs; 333 316 … … 346 329 } 347 330 348 void VMI::computeCameraIs( GLuint **histogram, GLuint numCameras, GLdouble *mis) {349 GLuint i = 0;331 void VMI::computeCameraIs(int **histogram, int numCameras, GLdouble *mis) { 332 int i = 0; 350 333 GLdouble meanI = 0.0; 351 334 … … 374 357 } 375 358 376 void VMI::printIs(GLdouble *mis, GLuint numCameras) {377 GLuint i;359 void VMI::printIs(GLdouble *mis, int numCameras) { 360 int i; 378 361 379 362 printf("\n");
Note: See TracChangeset
for help on using the changeset viewer.