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

📄 camera.cc

📁 不错的shijuegezong的程序
💻 CC
字号:
/////////////////////////////////////////////////////////////////////////////////                                                                           ////  Camera.cc  ---  A class which holds everything connected with a camera   ////                                                                           ////  A Camera object holds everything associated with a camera:               ////   Inputs, Calibration, the actual Tracking class which generates and      ////   stores results, a ConfigurationManager class etc.                       ////                                                                           ////  The Camera class starts a thread for each Camera class and waits for     ////   input to be fed by the parent.  Results from Tracking, are generated    ////   and the availability of new Results is signalled.                       ////                                                                           ////  Authors   : Initial version with no threads by Philip Elliott (pte)      ////              Redesign and all further changes by Nils T Siebel (nts)      ////  Created   : Initial working revision on Tue Sep 25 16:39:45 BST 2001     ////  Revision  : 1.2 of Thu Nov 29 16:28:21 GMT 2001                          ////  Copyright : The University of Reading                                    ////                                                                           /////////////////////////////////////////////////////////////////////////////////#include <limits.h>#include <string.h>  // for strrchr()// we want to use sched_yield() if available.  POSIX systems on which// sched_yield is available  define _POSIX_PRIORITY_SCHEDULING in <unistd.h>.#ifndef WIN32#include <unistd.h>#endif#ifdef _POSIX_PRIORITY_SCHEDULING#include <sched.h>#else#ifdef __GNUC__#warning POSIX 1003.1b-1993 (aka POSIX.4) sched_yield() seems to be unavailable, disabling it...#endif    // ifdef  __GNUC__#endif    // ifdef  _POSIX_PRIORITY_SCHEDULING else#include "Camera.h"#include "Tracking.h"#include "ConfigurationManager.h"#include "Inputs.h"#include "ScreenOutput.h"#include "MovieStore.h"#include "Results.h"#include "text_output.h"#include "MotionDetector.h"#include "ActiveShapeTracker.h"namespace ReadingPeopleTracker{static const char *Camera_Revision = "@(#) Camera.cc, rev 1.2 of Thu Nov 29 16:28:21 GMT 2001, Authors Philip Elliott and Nils T Siebel, Copyright (c) 2001--2002 The University of Reading";Camera::Camera(char *camera_config_filename, bool the_quiet_mode){    camera_name = NULL;    camera_description = NULL;    quiet_mode = the_quiet_mode;        // we cannot run without configuration file    if (camera_config_filename == NULL)    {	cerror << "Camera::Camera: No configuration file specified. " << endl;	exit(1);    }        //setup configuration manager    configuration_manager = new ConfigurationManager;        // register our own configuration parameters    register_configuration_parameters();        //create classes for storage of the configuration data    //constructors for the classes register their variables with configuration_manager    inputs = new Inputs(configuration_manager);    if (quiet_mode == false)	screen_output = new ScreenOutput(configuration_manager);    else	screen_output = NULL;        tracking = new Tracking(configuration_manager);        //Read parameter file data into their respective homes    configuration_manager->parse_parameter_file(camera_config_filename);        // replace underscores with space in CameraConfiguration's camera_name.    // this is because the file cannot have spaces in the variable values    if (camera_description != NULL)	for (char *c = camera_description; *c != '\0'; c++)	    if (*c == '_')		*c = ' ';        // allocate Results classes    results = new Results;    previous_results = new Results;       // remember that the current (empty) previous_results need no more processing    previous_results->status = RESULTS_PROCESSED;         frame_id_delta = 1;  // default to frame id increment 1 per frame    ///////////////////////// Set up All Inputs ///////////////////////////        // sets up video input, external motion detection input, camera calibration    inputs->setup_inputs();        // initialise pointers to current external image and XML RegionSet input data    current_video_image = NULL;    current_external_xml_region_set = NULL;    //////////////////////// Set up Output Movie (results) //////////////////////////        output_movie = NULL;  // default to NULL (no output movie)        if ((output_movie_filename != NULL) && (output_movie_filename[0] != '\0'))    {	// try detecting the desired format by checking the filename extension	char *file_ext = strrchr(output_movie_filename, '.');		if ((file_ext == NULL) ||	    (strcasecmp(file_ext,".pnm") == 0) || 	    (strcasecmp(file_ext,".ppm") == 0) || 	    (strcasecmp(file_ext,".pgm") == 0) || 	    (strcasecmp(file_ext,".pbm") == 0))	{	    output_movie = new MovieStore (MOVIESTORE_PNM, output_movie_filename);	}	else	    if ((strcasecmp(file_ext,".jpeg") == 0) || 		(strcasecmp(file_ext,".jpg") == 0))            {                output_movie = new MovieStore (MOVIESTORE_JPEG, output_movie_filename);	    }	    else	    {		cerror << "Camera::Camera: Could not detect file format for output movie named 

⌨️ 快捷键说明

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