~ubuntu-branches/ubuntu/lucid/meshlab/lucid

« back to all changes in this revision

Viewing changes to meshlab/src/meshlabplugins/edit_phototexturing/src/Camera.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-10-08 16:40:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091008164041-0c2ealqv8b8uc20c
Tags: 1.2.2-1
* New upstream version
* Do not build filter_isoparametrization because liblevmar dependency
  is not (yet) in Debian
* Fix compilation with gcc-4.4, thanks to Jonathan Liu for the patch
  (closes: #539544)
* rules: Add compiler variables to the qmake call (for testing with new
  GCC versions)
* io_3ds.pro: Make LIBS and INCLUDEPATH point to Debian version of lib3ds
* io_epoch.pro: Make LIBS point to Debian version of libbz2
* control:
  - Move Homepage URL to the source package section
  - Update to standards-version 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
* MeshLab                                                           o o     *
 
3
* A versatile mesh processing toolbox                             o     o   *
 
4
*                                                                _   O  _   *
 
5
* Copyright(C) 2005                                                \/)\/    *
 
6
* Visual Computing Lab                                            /\/|      *
 
7
* ISTI - Italian National Research Council                           |      *
 
8
*                                                                    \      *
 
9
* All rights reserved.                                                      *
 
10
*                                                                           *
 
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.                                       *
 
15
*                                                                           *
 
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)          *
 
20
* for more details.                                                         *
 
21
*                                                                           *
 
22
****************************************************************************/
 
23
#include "Camera.h"
 
24
#include <src/Tsai/TsaiCameraCalibration.h>
 
25
//#include <src/Poly/PolyCameraCalibration.h>
 
26
 
 
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";
 
33
 
 
34
 
 
35
Camera::Camera(){
 
36
        textureId = -1;
 
37
        zBuffer = 0;
 
38
        textureImage = QString("");
 
39
        calculatedTextures = false;
 
40
}
 
41
Camera::~Camera(){
 
42
 
 
43
}
 
44
void Camera::loadCameraCalibration(QString calibfile){
 
45
 
 
46
}
 
47
void Camera::calibrateCamera(){
 
48
 
 
49
}
 
50
 
 
51
void Camera::assignTextureImage(QString image){
 
52
        textureImage = image;
 
53
}
 
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]);
 
60
 
 
61
        calibration->saveAsXml(doc,&xml_cam);
 
62
 
 
63
        if (root == NULL){
 
64
                doc->appendChild(xml_cam);
 
65
        }else{
 
66
                root->appendChild(xml_cam);
 
67
        }
 
68
 
 
69
}
 
70
 
 
71
void Camera::loadFromXml(QDomElement *xml_cam){
 
72
 
 
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();
 
77
 
 
78
        QDomElement xml_calib = xml_cam->firstChildElement(CameraCalibration::XML_CALIBRATION);
 
79
        if (!xml_calib.isNull()){
 
80
                QString ctype = xml_calib.attribute(CameraCalibration::XML_TYPE);
 
81
 
 
82
                if (!ctype.compare("TSAI")){
 
83
                        //qDebug("TSAI\n");
 
84
                        calibration = new TsaiCameraCalibration();
 
85
                        calibration->loadFromXml(&xml_calib);
 
86
                }/*else if (!ctype.compare("POLY")){
 
87
                        //qDebug("POLY\n");
 
88
                        calibration = new PolyCameraCalibration();
 
89
                        calibration->loadFromXml(&xml_calib);
 
90
 
 
91
                }*/else{
 
92
 
 
93
                }
 
94
                if(calibration!=NULL){
 
95
                        calibration->resolution[0] = resolution[0];
 
96
                        calibration->resolution[1] = resolution[1];
 
97
                }
 
98
        }else{
 
99
                //qDebug("no calibration child in xmlfile \n");
 
100
        }
 
101
 
 
102
}
 
103
 
 
104