automatic commit
authorFrancois Fleuret <fleuret@idiap.ch>
Wed, 13 Aug 2008 21:41:14 +0000 (23:41 +0200)
committerFrancois Fleuret <fleuret@idiap.ch>
Wed, 13 Aug 2008 21:41:14 +0000 (23:41 +0200)
misc.cc
pom.cc
pom_solver.cc
pom_solver.h
rgb_image.cc

diff --git a/misc.cc b/misc.cc
index adaf6ed..7251bdd 100644 (file)
--- a/misc.cc
+++ b/misc.cc
@@ -19,6 +19,7 @@
 
 #include <iostream>
 #include <fstream>
+#include <stdlib.h>
 
 using namespace std;
 
diff --git a/pom.cc b/pom.cc
index 0299b8b..0f4a91b 100644 (file)
--- a/pom.cc
+++ b/pom.cc
@@ -52,7 +52,7 @@ int main(int argc, char **argv) {
            << endl
            << "  If a configuration file name is provided, the program processes it" << endl
            << "  and prints information about the files it generates. Otherwise, it" << endl
-           << "  reads the standard input and does not produce any printout on the" <<
+           << "  reads the standard input and does not produce any printout on the" << endl
            << "  standard output unless an error occurs." << endl
            << endl;
       exit(0);
@@ -176,13 +176,14 @@ int main(int argc, char **argv) {
         else
           solver.solve(room, &prior, proba_views, &proba_presence, f, 0);
 
-        if(strcmp(result_view_format, "") != 0)
+        if(strcmp(result_view_format, "") != 0) {
           for(int c = 0; c < room->nb_cameras(); c++) {
             pomsprintf(buffer, buffer_size, result_view_format, c, f, 0);
             if(configuration_file)
               cout << "Saving " << buffer << endl;
             room->save_stochastic_view(buffer, c, (*proba_views)[c], &proba_presence);
           }
+        }
 
         if(strcmp(result_format, "") != 0) {
           pomsprintf(buffer, buffer_size, result_format, 0, f, 0);
@@ -302,7 +303,7 @@ int main(int argc, char **argv) {
     else if(strcmp(buffer, "") == 0 || buffer[0] == '#') { }
 
     else {
-      cerr << "Unknown token " << token << ".";
+      cerr << "Unknown token " << token << "." << endl;
       exit(1);
     }
   }
index 76cc9a5..e8584c5 100644 (file)
@@ -96,7 +96,7 @@ void POMSolver::add_log_ratio(int camera,
 void POMSolver::solve(Room *room,
                       Vector<scalar_t> *prior,
                       Vector<ProbaView *> *views,
-                      Vector<scalar_t> *proba_presence,
+                      Vector<scalar_t> *result_proba_presence,
                       int nb_frame,
                       char *convergence_file_format) {
 
@@ -120,7 +120,8 @@ void POMSolver::solve(Room *room,
 
     scalar_t e = 0;
     for(int i = 0; i < room->nb_positions(); i++) {
-      scalar_t np = global_smoothing_coefficient * proba_absence[i] + (1 - global_smoothing_coefficient) / (1 + exp(log_prior_ratio[i] + sum[i]));
+      scalar_t np = global_smoothing_coefficient * proba_absence[i] +
+        (1 - global_smoothing_coefficient) / (1 + exp(log_prior_ratio[i] + sum[i]));
       if(abs(proba_absence[i] - np) > e) e = abs(proba_absence[i] - np);
       proba_absence[i] = np;
     }
@@ -129,15 +130,20 @@ void POMSolver::solve(Room *room,
 
     if(convergence_file_format) {
       char buffer[buffer_size];
-      for(int p = 0; p < room->nb_positions(); p++) (*proba_presence)[p] = 1 - proba_absence[p];
+      for(int p = 0; p < room->nb_positions(); p++) {
+        (*result_proba_presence)[p] = 1 - proba_absence[p];
+      }
+
       for(int c = 0; c < room->nb_cameras(); c++) {
         pomsprintf(buffer, buffer_size, convergence_file_format, c, nb_frame, it);
         cout << "Saving " << buffer << "\n"; cout.flush();
-        room->save_stochastic_view(buffer, c, (*views)[c], proba_presence);
+        room->save_stochastic_view(buffer, c, (*views)[c], result_proba_presence);
       }
     }
 
   }
 
-  for(int p = 0; p < room->nb_positions(); p++) (*proba_presence)[p] = 1 - proba_absence[p];
+  for(int p = 0; p < room->nb_positions(); p++) {
+    (*result_proba_presence)[p] = 1 - proba_absence[p];
+  }
 }
index b0624b4..17ed4e3 100644 (file)
@@ -62,12 +62,14 @@ public:
   POMSolver(Room *room);
 
   // Uses the computation above for the various cameras and the prior
-  // to refresh proba_absence. Iterates as many times as specified.
+  // to refresh proba_absence. Iterates as many times as
+  // specified. The two last parameters are used only to save images
+  // showing the convergence
 
   void solve(Room *room,
              Vector<scalar_t> *prior,
              Vector<ProbaView *> *views,
-             Vector<scalar_t> *proba_presence,
+             Vector<scalar_t> *result_proba_presence,
              int nb_frame,
              char *convergence_file_format);
 };
index 26d4e3c..dea4888 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <iostream>
 #include <stdio.h>
+#include <stdlib.h>
 
 using namespace std;