Hugin trunk 0.1
Loading...
Searching...
No Matches
CalculateOptimalScale.cpp
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
27
29
30
31namespace HuginBase {
32
35{
36 if (panorama.getNrOfImages() == 0)
37 return 1;
38
39 PanoramaOptions opt = panorama.getOptions();
40 double scale = 0;
41
42 for (unsigned i = 0; i < panorama.getNrOfImages(); i++) {
43 double s = calcOptimalPanoScale(panorama.getSrcImage(i), opt);
44 if (scale < s) {
45 scale = s;
46 }
47 }
48
49 return scale;
50}
51
52
57 const PanoramaOptions & dest)
58{
59 // calculate the input pixel per output pixel ratio at the panorama center.
60
63 timg.setRoll(0);
64 timg.setPitch(0);
65 timg.setYaw(0);
66 timg.setX(0);
67 timg.setY(0);
68 timg.setZ(0);
69 transf.createTransform(timg, dest);
72
73 transf.transform(imgp1, hugin_utils::FDiff2D(0, 0));
74 transf.transform(imgp2, hugin_utils::FDiff2D(1, 1));
76
77 return dist / sqrt(2.0);
78
79 /*
80 // calculate average pixel density of each image
81 // and use the highest one to calculate the width
82 double density=0;
83 double w = imgSize.x;
84 switch (imgProj) {
85 case Lens::RECTILINEAR:
86 density = 1/RAD_TO_DEG(atan(2*tan(DEG_TO_RAD(v)/2)/w));
87 break;
88 case Lens::CIRCULAR_FISHEYE:
89 case Lens::FULL_FRAME_FISHEYE:
90 // if we assume the linear fisheye model: r = f * theta
91 // then we get the same pixel density as for cylindrical and equirect
92 case Lens::EQUIRECTANGULAR:
93 case Lens::PANORAMIC:
94 density = w / v;
95 break;
96 }
97 // TODO: use density properly based on the output projection.
98 double width = roundi(density * opt.getHFOV());
99 */
100}
101
102
103} //namespace
static double calcOptimalScale(PanoramaData &panorama)
static double calcOptimalPanoScale(const SrcPanoImage &src, const PanoramaOptions &dest)
function to calculate the scaling factor so that the distances in the input image and panorama image ...
Holds transformations for Image -> Pano and the other way.
Model for a panorama.
Panorama image options.
All variables of a source image.
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
double norm(T t)
Definition hugin_math.h:187
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