#include <pgh_scene.h>
Inheritance diagram for mimas::pgh_scene:
Public Member Functions | |
pgh_scene (void) | |
~pgh_scene (void) | |
void | clear (void) |
void | addModel (const line_ptr_list &geom, const std::string &name) |
void | addModel (pgh_2dobject_ptr ob) |
void | addModel (char *pgmfilename, const char *modelname) |
object_instance_list_ptr | findModel (pgh_2dobject_ptr ob) |
void | updateSceneLines (const line_ptr_list &newscene, int w, int h) |
void | updateSceneLines (char *newscenePGM, int w, int h) |
void | updateSceneLines (image< int > &imagein) |
void | updateSceneLines (image< int > &imagein, char *polyfilename) |
int | getNumScenePGHs (void) |
pgh_ptr_list * | getScenePghList (void) |
void | saveSceneParameters (const char *fileName) |
void | loadSceneParameters (const char *fileName) |
Public Attributes | |
bool | prefiltering |
double | pgh_match_thresh |
double | hough_peak_thresh |
Classes | |
class | scene_match_score |
small structure used to associate match scores with object line and pgh |
based on original tina tool source however the algorithm used here is different. here we simply say, for a given model and scene, are the lines in the scene consistent with the model.
:-). Ok. AN input image from a camera consists of a lot of straight lines. From a pairwise perspective this set of lines can be considered as another pgh_2dobject, however in this case we typically want to compare other 2d_objects to the scene and to store and collate the results to find all the instances of (eg) arthur the stegosaurus in the scene. Hence the extra class. Pgh_scene inherits pgh_2dobject and the base class is used to store and update the set of histograms which form the scene itself. On top of this the scene class itself contains matrices for comparing all known objects etc.
Now! Most of the code here is all my own, so don't blame me if it doesn't work :-). Also I've changed the location algorithm quite a bit.
Use the pgh_scene like this:
2dobject dino1,dino2; pgh_scene s; //upload the model info s.addModel(dino1); s.addModel(dino2); do { //get the new scene lines list<line*> ll = getLinesfromIntelligentCamera(); s.updateSceneLines( ll, image_width, image_height); //use it! object_instance_list oil = s.findModel( dino2 ); }
Obviously this is a little less complex with the original tina, so i'd better explain what's going on. Basically you can still use either long_lines or points to locate the objects, however at the moment its hard coded for points, and i'd recommend that it stays that way. Short lines hasn't been implemented yet, and even points i've completely rewrittten.
So what does happen now? Basically the location stuff is highly geared towards the possibility that there might be more than one instance of a given model in the scene. Consequently all scene lines are compare to all the model lines for the model youre looking for. The results are then simply thresholded and then any remaining successful matches are examined to find the consisten possible model instances in the scene. A location PHT is used as in the original tina, however this time it scales to match the size of the input image (!) and also the lines entered into it are drawn correctly and have width >1. The points method is more successful than the long lines method because each possible pair of lines in the scene (or model?) is used and only when a pair of matches is consistent with a given single location are points plotted into the location histogram. This removes a lot of the problems we have with long lines.
Basically there are a lots of points entered into a PHT for the possible location of model instances in the scene. This is then thresholded and the locations of any remaining peaks are taken to be locations of instances of the model you're looking for. The user is returned a list of this locations wrt the co-ordainte system of the origianl image.
See the example. Talk to fabio. Email me if you're still confused. If you want, you can add/uncomment the hough.display() lines in the process to check what the histograms look like. (You might need to scale them first though).
Definition at line 109 of file pgh_scene.h.
mimas::pgh_scene::pgh_scene | ( | void | ) |
mimas::pgh_scene::~pgh_scene | ( | void | ) |
void mimas::pgh_scene::clear | ( | void | ) |
Reimplemented from mimas::pgh_2dobject.
void mimas::pgh_scene::addModel | ( | const line_ptr_list & | geom, | |
const std::string & | name | |||
) |
void mimas::pgh_scene::addModel | ( | pgh_2dobject_ptr | ob | ) |
void mimas::pgh_scene::addModel | ( | char * | pgmfilename, | |
const char * | modelname | |||
) |
object_instance_list_ptr mimas::pgh_scene::findModel | ( | pgh_2dobject_ptr | ob | ) |
void mimas::pgh_scene::updateSceneLines | ( | const line_ptr_list & | newscene, | |
int | w, | |||
int | h | |||
) |
int mimas::pgh_scene::getNumScenePGHs | ( | void | ) |
pgh_ptr_list* mimas::pgh_scene::getScenePghList | ( | void | ) |
void mimas::pgh_scene::saveSceneParameters | ( | const char * | fileName | ) |
void mimas::pgh_scene::loadSceneParameters | ( | const char * | fileName | ) |
Definition at line 205 of file pgh_scene.h.
Definition at line 206 of file pgh_scene.h.
Definition at line 207 of file pgh_scene.h.