31 #include "vigra/transformimage.hxx"
48 m_edge.Create(0,0,
true);
49 m_previewMode=mode_original;
58 m_monitorProfile = NULL;
62 m_hasMonitorProfile = !profileName.IsEmpty();
72 if(e.Entering() || e.Leaving())
77 if(!e.LeftIsDown() && !e.RightIsDown())
86 vigra::Point2D pos(e.GetPosition().x,e.GetPosition().y);
109 std::vector<double> min_distance(lines.size(),10000);
110 double shortest_distance=10000;
111 for(
unsigned int i=0;i<lines.size();i++)
115 for(
unsigned int j=0;j<lines[i].line.size();j++)
117 double distance=(lines[i].line[j]-pos).magnitude();
118 if(distance<min_distance[i])
119 min_distance[i]=distance;
122 if(min_distance[i]<shortest_distance)
124 shortest_distance=min_distance[i];
125 if(shortest_distance<50)
144 wxGetApp().GetLensCalFrame()->UpdateListString(
m_imageIndex);
176 for(
unsigned int i=0;i<lines.size();i++)
178 if(lines[i].
line.size()<2)
180 switch(lines[i].status)
183 memDC.SetPen(wxPen(wxColour(0,255,0), 1, wxPENSTYLE_SOLID));
186 memDC.SetPen(wxPen(wxColour(255, 0, 0), 1, wxPENSTYLE_SOLID));
189 memDC.SetPen(wxPen(wxColour(128, 128, 128), 1, wxPENSTYLE_SOLID));
192 for(
unsigned int j=0;j<lines[i].line.size()-1;j++)
214 memDC.DrawLine(x1,y1,x2,y2);
218 memDC.SelectObject(wxNullBitmap);
236 float r_img = (float)
m_img.GetWidth() / (float)
m_img.GetHeight();
237 float r_window = (float)x/(
float)y;
238 if ( r_img > r_window )
271 wxPaintDC paintDC(
this);
289 ImageCache::EntryPtr img = ImageCache::getInstance().getImage(filename);
306 m_img.Create(0,0,
true);
352 vigra::RGBValue<vigra::UInt8>
gray2RGB(vigra::UInt8
const& v)
354 return vigra::RGBValue<vigra::UInt8>(v,v,v);
360 if(edgeImage->width()>0 && edgeImage->height()>0)
363 m_edgeImage.resize(edgeImage->width(),edgeImage->height());
394 ImageCache::EntryPtr img = ImageCache::getInstance().getImage(filename);
451 cp->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(wxT(
"style")), GetName());
458 return IsOfClass(node, wxT(
"LensCalCanvas"));
xrc handler for LensCalImageCtrl
void SetEmptyImage()
set preview to empty image
void SetLines(HuginLines::Lines lines)
store given lines in member variable
void setHeight(unsigned int h)
set panorama height
void transformImage(vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, vigra::triple< DestImageIterator, DestImageIterator, DestAccessor > dest, std::pair< AlphaImageIterator, AlphaAccessor > alpha, vigra::Diff2D destUL, TRANSFORM &transform, PixelTransform &pixelTransform, bool warparound, Interpolator interpol, AppBase::ProgressDisplay *progress, bool singleThreaded=false)
Transform an image into the panorama.
void setPanoImage(const SrcPanoImage &src, const PanoramaOptions &dest, vigra::Rect2D roi)
vigra::RGBValue< vigra::UInt8 > gray2RGB(vigra::UInt8 const &v)
image previewer for lens calibration GUI
bool m_hasMonitorProfile
true, if we found a real monitor profile
void GenerateRemappedImage(const unsigned int newWidth, const unsigned int newHeight)
generates the remapped image suitable for wxImage
HuginBase::SrcPanoImage * GetPanoImage()
return the SrcPanoImage from the given filename
unsigned int getHeight() const
get panorama height
wxBitmap m_scaled_img
the scaled image to save resizing
Contains functions to transform whole images.
LensCalPreviewMode m_previewMode
which image should be drawn
void SetEdgeImage()
converts the edge image into wxImage
wxImage m_remapped_img
the remapped image as wxImage
ImageLineList * m_imageLines
struct with filename, edge image and detected lines
include file for the hugin project
void DrawView()
draw the view into the offscreen buffer
void OnPaint(wxPaintEvent &dc)
paint event
HuginBase::PanoramaOptions m_opts
const vigra::Rect2D & getROI() const
vigra::BRGBImage m_remappedImage
the remapped image
void CorrectImage(wxImage &image, const vigra::ImageImportInfo::ICCProfile &iccProfile, const cmsHPROFILE &monitorProfile)
apply color correction to given image using input iccProfile and monitor profile
void setVar(const std::string &name, double val)
wxImage imageCacheEntry2wxImage(ImageCache::EntryPtr e)
void remapImage(vigra::triple< ImgIter, ImgIter, ImgAccessor > srcImg, vigra_ext::Interpolator interpol, AppBase::ProgressDisplay *progress, bool singleThreaded=false)
remap a image without alpha channel
RemapImage m_image
remapped image
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
virtual bool CanHandle(wxXmlNode *node)
virtual wxObject * DoCreateResource()
void Resize(wxSizeEvent &e)
resize event, recalculates the offscreen buffer
vigra::pair< typename ROIImage< Image, Alpha >::image_traverser, typename ROIImage< Image, Alpha >::ImageAccessor > destImage(ROIImage< Image, Alpha > &img)
wxImage m_edge
the edge detect image (resized scale)
declaration of preview for lens calibration gui
void setROI(const vigra::Rect2D &val)
vigra::triple< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImageRange(const ROIImage< Image, Mask > &img)
helper function for ROIImages
HuginBase::SrcPanoImage::Projection m_projection
unsigned int m_imageIndex
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
void OnMouseEvent(wxMouseEvent &e)
unsigned int getWidth() const
include file for the hugin project
const LensCalPreviewMode GetMode()
return actual preview mode
std::vector< SingleLine > Lines
vector of extracted lines from image
void SetImage(ImageLineList *newList, unsigned int newIndex)
set preview setting to given ImageLineList
const HuginLines::Lines GetLines()
returns the list of detected lines
static double calcHFOV(SrcPanoImage::Projection proj, double fl, double crop, vigra::Size2D imageSize)
calculate hfov of an image given focal length, image size and crop factor
wxBitmap m_display_img
the image to display, e.g.
declaration of application class for lens calibrate application
cmsHPROFILE m_monitorProfile
monitor profile
vigra::BImage * GetEdgeImage()
return pointer to edge image
const wxString GetFilename()
returns the filename
HuginBase::SrcPanoImage m_panoimage
void SetLens(const HuginBase::SrcPanoImage::Projection newProjection, const double newFocallength, const double newCropfactor)
updates the internal values of the lens (needed only for remapped image)
wxImage m_img
the image to adjust (full scale)
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
bool m_showLines
true, if the lines should be drawn above the image
void SetMode(const LensCalPreviewMode newMode)
set which image (original, edge, remapped/corrected) should be drawn
void SetLensDistortions(const double newA, const double newB, const double newC, const double newD, const double newE)
updates the internal values of the lens distortions parameters (needed only for remapped image) ...
struct to hold a image state for stitching
float m_scale
scale factor for scaling from m_img to m_scaled_img
void SetShowLines(bool showLines)
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
vigra::BRGBImage m_edgeImage
the edge image as RGBImage (in m_imageLines the edge image is grayscale (vigra::BImage)) ...
void GetMonitorProfile(wxString &profileName, cmsHPROFILE &profile)
retrieve monitor profile from system