From: Francois Fleuret Date: Wed, 13 Aug 2008 21:41:14 +0000 (+0200) Subject: automatic commit X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=3f1230f69c7a29011554f176771bfcd4e08d001c;p=pom.git automatic commit --- diff --git a/misc.cc b/misc.cc index adaf6ed..7251bdd 100644 --- a/misc.cc +++ b/misc.cc @@ -19,6 +19,7 @@ #include #include +#include using namespace std; diff --git a/pom.cc b/pom.cc index 0299b8b..0f4a91b 100644 --- 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); } } diff --git a/pom_solver.cc b/pom_solver.cc index 76cc9a5..e8584c5 100644 --- a/pom_solver.cc +++ b/pom_solver.cc @@ -96,7 +96,7 @@ void POMSolver::add_log_ratio(int camera, void POMSolver::solve(Room *room, Vector *prior, Vector *views, - Vector *proba_presence, + Vector *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]; + } } diff --git a/pom_solver.h b/pom_solver.h index b0624b4..17ed4e3 100644 --- a/pom_solver.h +++ b/pom_solver.h @@ -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 *prior, Vector *views, - Vector *proba_presence, + Vector *result_proba_presence, int nb_frame, char *convergence_file_format); }; diff --git a/rgb_image.cc b/rgb_image.cc index 26d4e3c..dea4888 100644 --- a/rgb_image.cc +++ b/rgb_image.cc @@ -19,6 +19,7 @@ #include #include +#include using namespace std;