⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 peopletracker.cc

📁 不错的shijuegezong的程序
💻 CC
字号:
////////////////////////////////////////////////////////////////////////////////                                                                           ////  PeopleTracker.cc  ---  The master People Tracker class, used in main()   ////                                                                           ////  This class handles inputs, trackers, data and outputs tracking results   ////                                                                           ////  It instantiates Camera objects which in turn hold everything associated  ////   with the respective camera: Inputs, Calibration, the actual Tracking    ////   class which generates and stores results, a Configuration class etc.    ////                                                                           ////  The PeopleTracker class starts a thread for each Camera class and waits  ////   for these to signal that they have new results.  The results are        ////   then extracted and fused by the PeopleTracker and written out in XML    ////   format.                                                                 ////                                                                           ////  Author    : Nils T Siebel (nts)                                          ////  Created   : Thu Jan 10 17:20:32 GMT 2002                                 ////  Revision  : 0.0 of Thu Jan 10 17:20:32 GMT 2002                          ////  Copyright : The University of Reading                                    ////                                                                           /////////////////////////////////////////////////////////////////////////////////#include <cstring>  // for strlen etc#ifdef HAVE_SSTREAM#include <sstream>#else// use strstream for compatability with older versions#ifdef WIN32#include <strstrea.h> // DOS uses 8.3 filenames#else#include <strstream>  // other systems call it by the real name#endif#endif#ifndef WIN32#include <unistd.h>   // for gethostname(...)#endif#include <fstream>#include "PeopleTracker.h"#include "TrackedObject.h"#include "Camera.h"#include "text_output.h"   // which defines the ostreams cinfo, cerror etc#include "Inputs.h"#include "BufferedSlaveImageSource.h"#include "BufferedSlaveXMLRegionSource.h"#include "Results.h"#include "ConfigurationManager.h"namespace ReadingPeopleTracker{static const char *PeopleTracker_Revision = "@(#) PeopleTracker.cc, rev 0.0 of Thu Jan 10 17:20:32 GMT 2002, Author Nils T Siebel, Copyright (c) 2002 The University of Reading";// definition and initialisation of static member variablesobject_id_t PeopleTracker::max_id_used_so_far = 0;pthread_mutex_t PeopleTracker::write_access_to_max_id_used_so_far = PTHREAD_MUTEX_INITIALIZER;/////////////////////////////////////////////////////////////////////////////////                                                                           ////  CONSTRUCTOR                                                              ////      PeopleTracker::PeopleTracker(char *toplevel_config_filename)         ////                                                                           ////  toplevel_config_filename is the base for all configuration file names.   ////  Other configuration files are generated by appending camera number (eg,  ////  LUL-conf1 -> LUL-conf1-01 for the first camera) and initials of tracking ////  modules (eg, LUL-conf1-01-rt for the RegionTracker of the first camera). ////                                                                           ////  The constructor sets a state variable to the number of active cameras    ////  if there is no error during set-up.  Otherwise the state is set to a     ////  value < 0.  Use get_state() to query this state.                         ////                                                                           /////////////////////////////////////////////////////////////////////////////////PeopleTracker::PeopleTracker(char *toplevel_config_filename){    start_time = time(NULL);        unsigned int index;        for (index = 0; index < MAX_NUM_CAMERAS; index++)	cameras[index] = NULL;        number_of_cameras = 0;        if (toplevel_config_filename == NULL)    {	state = -10000;      // indicate fatal toplevel error	return;    }        // setup configuration manager    configuration = new ConfigurationManager;        // register configuration variables with configuration manager    register_configuration_parameters();        // read parameter file data into their respective homes    configuration->parse_parameter_file(toplevel_config_filename);        // remember toplevel config filename as base for ALL configuration files    configuration_filename_base = new char[strlen(toplevel_config_filename) + 2];    sprintf(configuration_filename_base, "%s", toplevel_config_filename);    #ifdef _BSD_SOURCE    // create hostname (for XML output)    gethostname(hostname, sizeof(hostname));    hostname[sizeof(hostname) - 1] = '\0';  // this is just a precaution if we have a long name#endif #ifndef NO_DISPLAY    // create user interface    if (quiet_mode == false)	configuration->create_interface(0, NULL);    else    {#ifdef USE_GL#ifdef LINUX	// tell Ygl not to mind us calling deflinestyle() in Profile	noport();	winopen("dummy tracker graphics window");#endif#endif    }#endif   // ifndef NO_DISPLAY    #ifdef DEBUG    if (write_results_in_XML == false)	cdebug << " >>>>   PeopleTracker::PeopleTracker: write_results_in_XML == "	       << write_results_in_XML	       << ", FIXME: FORCED to true <<<< " << endl;    write_results_in_XML = true;   /////  FIXME: this is because the value gets lost#endif        if (write_results_in_XML)    {   	// open output file for XML output	xml_tracking_results_ostream_ptr = NULL;		if (xml_tracking_results_filename != NULL)	    xml_tracking_results_ostream_ptr = (ostream*)		new ofstream(xml_tracking_results_filename, ios::out);		if ((xml_tracking_results_ostream_ptr == NULL) ||	    (xml_tracking_results_ostream_ptr->bad()))	{	    if(xml_tracking_results_filename == NULL)		xml_tracking_results_filename = "";	    cerror << "PeopleTracker::PeopleTracker: could not open file "		   << "

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -