26 #include "hugin_config.h"
34 #include <OpenGL/gl.h>
35 #include <OpenGL/glu.h>
53 #define SAMPLE_FREQUENCY 12
69 #define MIN_SAMPLE_OVERLAPS 16
85 m_updateStatistics(true),
87 m_useNearestLine(false)
103 for (
unsigned int x = 0; x <
rect_ts; x++)
105 for (
unsigned int y = 0; y <
rect_ts; y++)
107 rect_tex_data[x][y][0] = 255;
111 for (
unsigned int x = 2; x < rect_ts - 2; x++)
113 for (
unsigned int y = 2; y < rect_ts - 2; y++)
115 rect_tex_data[x][y][1] = 31;
119 for (
unsigned int d = 1; d < rect_ts - 1; d++)
121 rect_tex_data[d][1][1] = 255;
122 rect_tex_data[d][rect_ts - 2][1] = 255;
123 rect_tex_data[1][d][1] = 255;
124 rect_tex_data[rect_ts - 2][d][1] = 255;
127 for (
unsigned int d = 0; d <
rect_ts; d++)
129 rect_tex_data[d][0][1] = 0;
130 rect_tex_data[d][rect_ts - 1][1] = 0;
131 rect_tex_data[0][d][1] = 0;
132 rect_tex_data[rect_ts - 1][d][1] = 0;
135 gluBuild2DMipmaps(GL_TEXTURE_2D, GL_LUMINANCE_ALPHA, rect_ts, rect_ts,
136 GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, rect_tex_data);
137 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
138 GL_LINEAR_MIPMAP_LINEAR);
140 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
141 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
204 double minDistance = DBL_MAX;
206 for (
unsigned int i = 0; i <
m_lines.size(); i++)
210 if (lineDistance < minDistance)
213 minDistance = lineDistance;
261 glEnable(GL_LINE_SMOOTH);
263 for (
unsigned int i = 0; i <
m_lines.size(); i++)
267 glDisable(GL_LINE_SMOOTH);
268 glEnable(GL_TEXTURE_2D);
270 glColor3ub(255, 255, 255);
292 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
297 glMatrixMode(GL_TEXTURE);
304 glMatrixMode(GL_MODELVIEW);
314 int width = src.getSize().width(), height = src.getSize().height();
315 vigra::Rect2D crop_region = src.getCropRect();
317 switch (src.getCropMode())
323 crop_region &= vigra::Rect2D(src.getSize());
324 glScalef((
float) width / (
float) crop_region.width(),
325 (float) height / (
float) crop_region.height(),
327 glTranslatef(-(
float) crop_region.left() / (float) width,
328 -(
float) crop_region.top() / (float) height,
335 glMatrixMode(GL_MODELVIEW);
337 glMatrixMode(GL_TEXTURE);
353 if (image == line.
image1 || image == line.
image2)
return false;
388 m_lines.resize(numberOfImages * numberOfImages);
391 for (
unsigned int cpi = 0 ; cpi < numberOfControlPoints ; cpi++)
394 unsigned int low_index, high_index;
428 for (
unsigned int i = 0; i < numberOfImages - 1; i++)
437 vigra::Rect2D c = img.getCropRect();
441 double xc = double (x) / double (SAMPLE_FREQUENCY)
442 * double(c.width()) + c.left();
443 double yc = double (y) / double (SAMPLE_FREQUENCY)
444 * double(c.height()) + c.top();
448 positions[i][x][y].x, positions[i][x][y].y,
455 for (
unsigned int i = 0; i < numberOfImages; i++)
457 for (
unsigned int j = 0; j < numberOfImages; j++)
482 unsigned int overlapingSamples = 0;
493 positions[i][x][y].x,
496 if (src.
isInside(vigra::Point2D((
int) dx, (
int) dy)))
542 spherical_pano_opts.
setHFOV(360);
544 for (
unsigned int image_number = 0;
563 double(s.x) / 2.0,
double(s.y) / 2.0
568 double(s.x) / 2.0,
double(s.y) / 2.0
583 glColor3ub(255, 255, 255);
586 glColor3ub(170, 170, 170);
588 double red, green, blue;
590 glColor3d(red, green, blue);
594 if (lineWidth > 5.0) lineWidth = 5.0;
601 : numberOfControlPoints(0),
617 return arc.squareDistance(point);
void setHeight(unsigned int h)
set panorama height
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
hugin_utils::FDiff2D data[SAMPLE_FREQUENCY][SAMPLE_FREQUENCY]
void DisableTexture(bool maskOnly=false)
std::size_t getNrOfCtrlPoints() const
number of control points
bool set_contains(const _Container &c, const typename _Container::key_type &key)
include file for the hugin project
void ForceRequireRedraw()
bool isInside(vigra::Point2D p, bool ignoreMasks=false) const
check if a coordinate is inside the source image
hugin_utils::FDiff2D * operator[](std::size_t index)
represents a control point
HuginBase::PanoramaOptions * GetOptions()
std::set< unsigned int > UIntSet
std::size_t getNrOfImages() const
number of images.
static MainFrame * Get()
hack.. kind of a pseudo singleton...
const ControlPoint & getCtrlPoint(std::size_t nr) const
get a control point, counting starts with 0
TextureManager * GetTextureManager()
Declare GreatCircles class.
UIntSet getActiveImages() const
get active images
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
void addObserver(PanoramaObserver *o)
add a panorama observer.
void DrawImage(unsigned int image_number, unsigned int display_list)
include file for the hugin project
void ShowCtrlPointEditor(unsigned int img1, unsigned int img2)
opens the control points tab with the both images selected
void ControlPointErrorColour(const double cperr, double &r, double &g, double &b)
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
A map from image positions to panorama positions.
HuginBase::SrcPanoImage * GetSrcImage(unsigned int image_nr)
All variables of a source image.
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
unsigned int GetMeshDisplayList(unsigned int image_nr)
void draw(bool withCross=true, double width=1.0) const
Draw the great circle arc on the fast preview.
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true