Hugin trunk 0.1
Loading...
Searching...
No Matches
RotatePanorama.cpp
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
26#include "RotatePanorama.h"
27
28
29namespace HuginBase {
30
31
33RotatePanorama::RotatePanorama(PanoramaData& panorama, double yaw, double pitch, double roll)
35{
37}
38
39
40#define conditional_set(variable, value) \
41if (image.variable##isLinked())\
42{\
43 unsigned int j = 0;\
44 while (j < i && !image.variable##isLinkedWith(panorama.getImage(j)))\
45 {\
46 j++;\
47 }\
48 if (j == i) copy.set##variable(value);\
49} else {\
50 copy.set##variable(value);\
51}
52
54{
55 for (unsigned int i = 0; i < panorama.getNrOfImages(); i++)
56 {
57 const SrcPanoImage & image = panorama.getImage(i);
58 SrcPanoImage copy = image;
59 double y = image.getYaw();
60 double p = image.getPitch();
61 double r = image.getRoll();
64 DEBUG_DEBUG("rotation matrix (PT) for img " << i << " << ypr:" << y << " " << p << " " << r << std::endl << mat);
67 DEBUG_DEBUG("rotation matrix after transform: " << rotated);
68 rotated.GetRotationPT(y,p,r);
69 y = RAD_TO_DEG(y);
70 p = RAD_TO_DEG(p);
71 r = RAD_TO_DEG(r);
72 DEBUG_DEBUG("rotated angles of img " << i << ": " << y << " " << p << " " << r);
73
74 // Don't update a variable linked to a variable we already updated.
78 if(image.getX()!=0.0 || image.getY()!=0.0 || image.getZ()!=0.0)
79 {
80 // rotate translation vector
81 Vector3 vecRot=transformMat.Inverse().TransformVector(Vector3(image.getZ(), image.getX(), image.getY()));
85 // rotate translation plane
86 mat.SetRotationPT(DEG_TO_RAD(image.getTranslationPlaneYaw()), DEG_TO_RAD(image.getTranslationPlanePitch()), 0.0);
88 rotated.GetRotationPT(y,p,r);
91 };
92 panorama.setImage(i, copy);
93 panorama.imageChanged(i);
94 }
95}
96
97
98} //namespace
#define conditional_set(variable, value)
Model for a panorama.
static void rotatePano(PanoramaData &panorama, const Matrix3 &transformMat)
RotatePanorama(PanoramaData &panorama, const Matrix3 &transformMat)
All variables of a source image.
general : Matrix3 is a class for handling 3x3 Matrix manipulation.
Definition Matrix3.h:38
void SetRotationPT(double yaw, double pitch, double roll)
set rotation in panotools style, code adapted from Panotools-Script by Bruno Postle
Definition Matrix3.cpp:110
general : Vector3 is a class for handling 3D Vectors manipulation.
Definition Vector3.h:44
#define RAD_TO_DEG(x)
Definition hugin_math.h:45
#define DEG_TO_RAD(x)
Definition hugin_math.h:44
#define DEBUG_DEBUG(msg)
Definition utils.h:68
double Z
double X
double TranslationPlaneYaw
double Yaw
double Roll
double Pitch
double Y
double TranslationPlanePitch
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41