1
/****************************************************************************
3
* A versatile mesh processing toolbox o o *
5
* Copyright(C) 2005 \/)\/ *
6
* Visual Computing Lab /\/| *
7
* ISTI - Italian National Research Council | *
9
* All rights reserved. *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
* This program is distributed in the hope that it will be useful, *
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
22
****************************************************************************/
24
#include <src/Tsai/TsaiCameraCalibration.h>
25
//#include <src/Poly/PolyCameraCalibration.h>
27
const QString Camera::XML_CAMERADOCUMENT = "CameraDocument";
28
const QString Camera::XML_CAMERA = "Camera";
29
const QString Camera::XML_NAME = "name";
30
const QString Camera::XML_IMAGE = "textureImage";
31
const QString Camera::XML_RESOLUTION_X = "resolutionX";
32
const QString Camera::XML_RESOLUTION_Y = "resolutionY";
38
textureImage = QString("");
39
calculatedTextures = false;
44
void Camera::loadCameraCalibration(QString calibfile){
47
void Camera::calibrateCamera(){
51
void Camera::assignTextureImage(QString image){
54
void Camera::saveAsXml(QDomDocument* doc,QDomElement *root){
55
QDomElement xml_cam = doc->createElement(XML_CAMERA);
56
xml_cam.setAttribute(XML_NAME,name);
57
xml_cam.setAttribute(XML_IMAGE,textureImage);
58
xml_cam.setAttribute(XML_RESOLUTION_X,resolution[0]);
59
xml_cam.setAttribute(XML_RESOLUTION_Y,resolution[1]);
61
calibration->saveAsXml(doc,&xml_cam);
64
doc->appendChild(xml_cam);
66
root->appendChild(xml_cam);
71
void Camera::loadFromXml(QDomElement *xml_cam){
73
name = xml_cam->attribute(XML_NAME);
74
textureImage = xml_cam->attribute(XML_IMAGE);
75
resolution[0] = xml_cam->attribute(XML_RESOLUTION_X).toInt();
76
resolution[1] = xml_cam->attribute(XML_RESOLUTION_Y).toInt();
78
QDomElement xml_calib = xml_cam->firstChildElement(CameraCalibration::XML_CALIBRATION);
79
if (!xml_calib.isNull()){
80
QString ctype = xml_calib.attribute(CameraCalibration::XML_TYPE);
82
if (!ctype.compare("TSAI")){
84
calibration = new TsaiCameraCalibration();
85
calibration->loadFromXml(&xml_calib);
86
}/*else if (!ctype.compare("POLY")){
88
calibration = new PolyCameraCalibration();
89
calibration->loadFromXml(&xml_calib);
94
if(calibration!=NULL){
95
calibration->resolution[0] = resolution[0];
96
calibration->resolution[1] = resolution[1];
99
//qDebug("no calibration child in xmlfile \n");