Hugin trunk 0.1
Loading...
Searching...
No Matches
ChoosyRemapper.cpp
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
2
23#include "panoinc_WX.h"
24#include "panoinc.h"
25
26#include "ChoosyRemapper.h"
27#include "ViewState.h"
28#include "TexCoordRemapper.h"
29#include "VertexCoordRemapper.h"
30
32 HuginBase::SrcPanoImage * image, VisualizationState *visualization_state)
33 : MeshRemapper(m_pano, image, visualization_state)
34{
37}
38
43
45{
47 // have a look at the output mode, find those where the poles cause problems
48 // with the vetex remapper.
50 switch (opts->getProjection())
51 {
52 // the 'stretchy poles' cases.
59// FIXME ARCHITECTURAL is top MILLER and bottom LAMBERT. Will need different remapper for top and bottom half
60// currently the least distorted result is by treating it like a 'stretchy pole'
62 // the circular ones are especially important, they tend to stretch the
63 // area over the pole covers over the entire image, it is difficult to
64 // correct those.
73 // Add any projections where the poles maps to a big set of points here.
77 // check for pole crossing
78 {
79 bool pole = false;
81 // get the pole in image coordinates
84 double img_x, img_y;
86 info->GetNorthPoleX(),
87 info->GetNorthPoleY());
88 if ( img_y > 0.0 && img_y < height
89 && img_x > 0.0 && img_x < width)
90 {
91 pole = true; // it covers this pole
92 }
93 if (opts->getProjection() ==
95 {
96 // always use a TexCoordRemapper for Alber's equal area conic.
97 pole = true;
98 // FIXME This is not sutible for panoramas containing many small
99 // images. To detect the poles in Alber's Equal area conic
100 // projetion, we need to account for their movement with
101 // changing parameters. Also the 180 degree seam goes at a
102 // funny angle, and we need to account for this.
103 }
104 if (!pole)
105 {
106 // check the other pole
108 info->GetSouthPoleX(),
109 info->GetSouthPoleY());
110 if ( img_y > 0.0 && img_y < height
111 && img_x > 0.0 && img_x < width)
112 {
113 pole = true; // it covers this pole.
114 }
115 }
116 if (pole)
117 {
118 // the VertexCoordRemapper doesn't fair well with images where
119 // a single point on an image covers a range on the output.
120 // Use the TexCoordRemmaper instead.
121 if (selection != REMAP_TEX)
122 {
125 {
126 delete selected_remapper;
128 }
130 image,
132 }
133 break;
134 }
135 // not breking to get a VertexCoordRemapper.
136 }
137 default:
138 // A VertexCoordRemapper is generally the best. Create a new one
139 // if we do not already have one.
140 if (selection != REMAP_VERTEX)
141 {
144 {
145 delete selected_remapper;
147 }
149 image,
151 }
152 break;
153 }
154 // now we get the selected remapper to actually do the work.
156}
157
159{
160 // just use the remapper created already:
162}
163
MeshRemapper * selected_remapper
ChoosyRemapper(HuginBase::Panorama *m_pano, HuginBase::SrcPanoImage *image, VisualizationState *visualization_state)
RemapperSelection selection
bool GetNextFaceCoordinates(Coords *result)
Get the texture and vertex coordinates for the next face.
bool transformImgCoord(double &x_dest, double &y_dest, double x_src, double y_src) const
like transform, but return image coordinates, not cartesian coordinates
void createTransform(const vigra::Diff2D &srcSize, VariableMap srcVars, Lens::LensProjectionFormat srcProj, const vigra::Diff2D &destSize, PanoramaOptions::ProjectionFormat destProj, const std::vector< double > &destProjParam, double destHFOV, const vigra::Diff2D &origSrcSize)
initialize pano->image transformation
Panorama image options.
PanoramaOptions::ProjectionFormat getProjection() const
Model for a panorama.
Definition Panorama.h:153
All variables of a source image.
A class for exchanging pointers to coordinates.
An abstract base class for objects that calculate an approximate remap specified by quadrilatrials.
HuginBase::SrcPanoImage * image
HuginBase::PTools::Transform transform
A transform to use to remap the images.
virtual bool GetNextFaceCoordinates(Coords *result)=0
Get the texture and vertex coordinates for the next face.
double height
The sizes of the input images in pixels.
virtual void UpdateAndResetIndex()
VisualizationState * visualization_state
HuginBase::Panorama * m_pano
const double GetSouthPoleY() const
const double GetNorthPoleY() const
const double GetSouthPoleX() const
const double GetNorthPoleX() const
virtual HuginBase::PanoramaOptions * GetOptions()
virtual OutputProjectionInfo * GetProjectionInfo()
include file for the hugin project
include file for the hugin project
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