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

📄 calibration.cc

📁 不错的shijuegezong的程序
💻 CC
字号:
//////////////////////////////////////////////////////////////////////////////////                                                                            ////  Calibration.cc                                                            ////                                                                            ////  This class reads a calibration (4x3 projection) matrix from file and      ////    provides methods to use this calibration data for image measurements    ////                                                                            ////  The matrix file must be in NAG format.  Its image addressing mode is      ////    determined with a simple test.                                          ////                                                                            ////  Author    : R閙i Belin (rb)  supervised by  Nils T Siebel (nts)           ////  Created   : Wed Jul 18 13:50:21 BST 2001                                  ////  Revision  : 1.0 of Tue Jul 31 12:21:08 BST 2001                           ////  Copyright : The University of Reading                                     ////                                                                            //////////////////////////////////////////////////////////////////////////////////#include <cmath>          // for fmax()#include <string.h>       // for strcmp()#include <cassert>#include <fstream>#include "Calibration.h"#include "text_output.h"namespace ReadingPeopleTracker{static const char *Calibration_Revision = "@(#) Calibration.cc, rev 1.0 of Tue Jul 31 12:21:08 BST 2001, Authors R閙i Belin and Nils T Siebel, Copyright (c) 2000--2001 The University of Reading";Calibration::Calibration(char *filename,			 unsigned int the_image_height){    assert(the_image_height > 0);        if ((filename == NULL) || (strlen(filename) == 0))    {	cerror << "Calibration::Calibration(): Error:"	       << " No or empty calibration file name given. " << endl;	exit(1);    }        WorldToImage = new NagMatrix(3,4);    get_matrix_from_file(filename);    image_height = the_image_height;        // determine the matrix's image addressing mode        // first get a world point in the centre of the image    NagVector image_centre(3);        image_centre[0] = (4/3) * the_image_height / 2;    image_centre[1] = the_image_height / 2;    image_centre[2] = 1;        NagVector lower_wp(4);        lower_wp = get_world_from_ip(image_centre, 0);          // now test whether a point higher up in world is higher up in the image    NagVector upper_wp(4);    upper_wp = lower_wp;    upper_wp[2] += 100;  // FIXME: assuming 100 world units (e.g. cm) is reasonable        NagVector lower_ip(3);    NagVector upper_ip(3);        // before calling get_ip_from_world, set matrix_image_addressing_mode temporarily    // in a way that disables the correction of v components in that method    matrix_image_addressing_mode = Image::image_addressing_mode;    lower_ip = get_ip_from_world(lower_wp);    upper_ip = get_ip_from_world(upper_wp);        // simple comparison of v coordinates to see which one is larger    if (lower_ip[1] > upper_ip[1])    {	matrix_image_addressing_mode = IA_TOP_TO_BOTTOM;		cdebug << " Calibration::Calibration: detected TOP_TO_BOTTOM calibration matrix. "	       << endl;    }    else    {	matrix_image_addressing_mode = IA_BOTTOM_TO_TOP;	cdebug << " Calibration::Calibration: detected BOTTOM_TO_TOP calibration matrix. "	       << endl;    }    }void Calibration::get_matrix_from_file(char *filename){    ifstream ifs(filename);    if (ifs.bad())    {	cerror << "Calibration::get_matrix_from_file(): Warning:"	       << " Cannot open calibration file. 

⌨️ 快捷键说明

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