00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef PGH_SCENE_H
00018 #define PGH_SCENE_H
00019
00020 #include <boost/shared_array.hpp>
00021 #include <string>
00022 #include <list>
00023 #include <sys/time.h>
00024 #include "mimasconfig.h"
00025 #include "object.h"
00026 #include "pgh_2dobject.h"
00027 #include "object_instance_list.h"
00028 #include "image.h"
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 namespace mimas {
00109 class pgh_scene : public pgh_2dobject
00110 {
00111
00112
00113
00117 class scene_match_score
00118 {
00119 public:
00120 double best_match;
00121 pgh_ptr object_pgh;
00122 line_ptr object_line;
00123 };
00124
00125 typedef boost::shared_array< scene_match_score > scene_match_score_array;
00126 typedef std::list< scene_match_score_array > scene_match_score_array_list;
00127 typedef pgh_2dobject_ptr_list::iterator obj_it;
00128 typedef scene_match_score_array_list::iterator sms_it;
00129 typedef enum { long_lines, short_lines, points } pgh_loc_type;
00130
00131
00132 private:
00133 pgh_2dobject_ptr_list objects_of_interest;
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 scene_match_score_array_list match_score_list;
00146
00147
00148
00149 #ifdef HAVE_GETTIMEOFDAY
00150 struct timeval timestamp;
00151 #endif
00152 pgh_loc_type location_hough_type;
00153
00154
00155
00156
00157 double centroid_posn_x;
00158 double centroid_posn_y;
00159
00160
00161
00162 int image_height, image_width;
00163
00164
00165
00166
00167 object_instance_list_ptr locateObject( scene_match_score_array match_array, pgh_2dobject_ptr ob );
00168 object_instance_list_ptr locateObject_longLines( scene_match_score_array match_array , pgh_2dobject_ptr ob );
00169 object_instance_list_ptr locateObject_points( scene_match_score_array match_array , pgh_2dobject_ptr ob );
00170 angle orientObject( scene_match_score_array match_array , pgh_2dobject &ob, const Vector &loc );
00171
00172
00173 public:
00174 pgh_scene(void);
00175 ~pgh_scene(void);
00176
00177
00178 void clear(void);
00179
00180
00181 void addModel( const line_ptr_list &geom,
00182 const std::string &name );
00183 void addModel( pgh_2dobject_ptr ob );
00184
00185
00186
00187
00188 void addModel(char *pgmfilename , const char *modelname );
00189
00190
00191 object_instance_list_ptr findModel( pgh_2dobject_ptr ob );
00192 void updateSceneLines( const line_ptr_list &newscene, int w, int h );
00193
00194
00195 void updateSceneLines(char *newscenePGM, int w, int h );
00196 void updateSceneLines( image<int> &imagein);
00197
00198
00199 void updateSceneLines( image<int> &imagein, char *polyfilename);
00200
00201
00202 int getNumScenePGHs(void);
00203 pgh_ptr_list *getScenePghList(void);
00204
00205 bool prefiltering;
00206 double pgh_match_thresh;
00207 double hough_peak_thresh;
00208 #ifdef HAVE_XALAN
00209
00210
00211 void saveSceneParameters( const char *fileName );
00212
00213 void loadSceneParameters( const char *fileName );
00214 #endif
00215 };
00216
00217 }
00218
00219 #endif