26#ifndef PerspectiveImageCtrl_H
27#define PerspectiveImageCtrl_H
233 return T(
m_realSize.GetHeight() - 1 - p.y, p.x);
239 return T(p.y,
m_realSize.GetWidth() - 1 - p.x);
253 return T(p.y,
m_realSize.GetHeight() - 1 - p.x);
259 return T(
m_realSize.GetWidth() - 1 - p.y, p.x);
const int maxSelectionDistance
maximal distance for selection of one point
const int polygonPointSize
half size of markers
const int PerspectiveOffset
size of border at all sides
represents a control point
Line(const hugin_utils::FDiff2D &p1, const hugin_utils::FDiff2D &p2)
hugin_utils::FDiff2D start
image previewer for perspective correction
PerspectiveEditorState
different states of the editor
void RemoveLines()
remove all lines from the list
std::vector< hugin_utils::FDiff2D > m_rectPointsStartDrag
std::vector< Line > m_lines
int GetNearestRectanglePoint(const hugin_utils::FDiff2D &p)
return index of nearest rectangle point or -1 if the point is too far from rectangle
T applyRotInv(const T &p) const
PerspectiveEditorState m_editorState
ImageCache::EntryPtr getCachedImage()
return pointer to ImageCache
std::string m_imageFilename
HuginBase::CPVector GetControlPoints(const unsigned int index)
return list of control points
void DrawRect(wxDC &dc, const std::vector< hugin_utils::FDiff2D > &rect)
void OnMiddleMouseUp(wxMouseEvent &mouse)
event handler for middle mouse button, end scrolling
HuginBase::ControlPoint GetCP(const unsigned int index, const hugin_utils::FDiff2D &p1, const hugin_utils::FDiff2D &p2)
return the HuginBase::ControlPoint, using index as image index, p1 and p2 as position,...
void OnRightMouseUp(wxMouseEvent &mouse)
event handler when right mouse button is released
void AddLines(const HuginBase::CPVector &lines)
add the lines to the list
double getScaleFactor() const
get scale factor (calculates factor when fit to window is active)
double scale(double x) const
void OnSize(wxSizeEvent &e)
handler called when size of control was changed
int GetNearestRectangleLine(const hugin_utils::FDiff2D &p)
return index of nearest rectangle line or -1 if the point is too far from the rectangle lines
ImageRotation getCurrentRotation()
returns the current rotation of displayed image
void setOriginalMode()
show the original images with selected zoom ration, the mouse handlers are activated
void OnMiddleMouseDown(wxMouseEvent &mouse)
event handler for middle mouse button, start scrolling
HuginBase::Panorama m_pano
HuginBase::Panorama object for calculation of remapped image.
ImageRotation m_imgRotation
void rescaleImage()
rescale the image
double calcAutoScaleFactor(wxSize size)
calculate new scale factor for this image
bool IsInsideRect(const hugin_utils::FDiff2D &p)
return true, if the point p is inside the rect
int GetNearestLine(const hugin_utils::FDiff2D &p)
return index of nearest line or -1 if the point is too far from all lines
ImageCache::EntryPtr m_img
image cache entry for current image
void setScale(double factor)
set the scaling factor for mask editing display.
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
creates the control
wxPoint transform(const hugin_utils::FDiff2D &p) const
hugin_utils::FDiff2D invtransform(const wxPoint &p) const
void ChangeRotation(ImageRotation newRot)
wxColor m_colour_selected
int invtransform(int x) const
translate screen coordinates to image coordinates, considers additional added border
wxBitmap m_remappedImg
the remapped image as wxBitmap
double invtransform(double x) const
int transform(int x) const
convert image coordinate to screen coordinates, considers additional added border
ImageRotation
image rotation.
double getScale() const
return scale factor, 0 for autoscale
void UpdateVirtualSize()
update the virtual size of the control, necessary for correctly display the scrollbars
void SetLineColour(wxColour newColour)
sets the colour for the lines
void OnLeftMouseUp(wxMouseEvent &mouse)
event handler when right mouse button is released
void OnKillFocus(wxFocusEvent &e)
event handler, when editor lost focus, mainly cancels creating new polygon
std::vector< hugin_utils::FDiff2D > m_rectPoints
void DrawLines(wxDC &dc, const std::vector< Line > &lines)
void GenerateRemappedImage(const unsigned int newWidth, const unsigned int newHeight)
generates the remapped image suitable for wxBitmap
void OnCaptureLost(wxMouseCaptureLostEvent &e)
event handler, when mouse capture is lost, e.g.
int scale(int x) const
helper function for scale, offset and rotation
bool IsOriginalShown() const
double transform(double x) const
void OnMouseMove(wxMouseEvent &mouse)
event handler when mouse is moving
void OnPaint(wxPaintEvent &e)
drawing routine
std::vector< Line > m_currentLine
void setImage(const std::string &filename, ImageRotation rot)
set the current image and mask list, this loads also the image from cache
void ClipPos(hugin_utils::FDiff2D &pos)
clip the given pos to image size + offset
void SetRemappedMode(const HuginBase::Panorama &pano)
set the panorama object for remapping, the mouse handler are deactivated
void SetRectMode(bool newMode)
set line or rect mode
T applyRot(const T &p) const
int GetNearestLinePoint(const hugin_utils::FDiff2D &p, bool &isStart)
return index of nearest line or -1 if the point to far from line
void OnLeftMouseDown(wxMouseEvent &mouse)
event handler when left mouse button is pressed
std::vector< ControlPoint > CPVector
namespace for various utils
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.