31#include <wx/dcbuffer.h>
40#include <vigra/inspectimage.hxx>
132 m_img = ImageCache::getInstance().getImage(file);
142 m_img = ImageCache::EntryPtr(
new ImageCache::Entry);
181 m_img = ImageCache::EntryPtr(
new ImageCache::Entry);
610 if(!
mouse.ShiftDown())
730 if(!
mouse.ShiftDown())
912 for(HuginBase::UIntSet::const_reverse_iterator
it=
points.rbegin();
it!=
points.rend();++
it)
928 for(HuginBase::UIntSet::const_iterator
it=
temp.begin();
it!=
temp.end();++
it)
1057 const int key=e.GetKeyCode();
1077 wxCommandEvent
dummy;
1089 wxCommandEvent
dummy;
1106 zoomEvent.SetString(
"update_selection");
1115 zoomEvent.SetString(
"update_selection");
1124 zoomEvent.SetString(
"update_selection");
1139 switch (e.GetKeyCode())
1213 switch(
poly.getMaskType())
1331 for(
unsigned int j=0;
j<
poly.size();
j++)
1356 region.Offset(-x,-y);
1358 dc.SetDeviceClippingRegion(region);
1360 dc.DestroyClippingRegion();
1418 vigra::FindAverage<vigra::RGBValue<vigra::UInt8> >
average;
1419 vigra::inspectImage(vigra::srcImageRange(*(
m_img->get8BitImage())),
average);
1430 if (img.GetWidth() == 0)
1446 if (std::max(img.GetWidth(), img.GetHeight()) > (
ULONG_MAX >> 16))
1466 img = img.Rotate90(
true);
1469 img = img.Rotate180();
1472 img = img.Rotate90(
false);
1480 vigra::ImageImportInfo::ICCProfile iccProfile;
1482 if (
m_img->imageFloat->width() == 0)
1484 iccProfile = *(
m_img->iccProfile);
1491 img = img.ConvertToDisabled(192);
1509#if wxCHECK_VERSION(3,3,0)
1549 for(
unsigned int i=0;
i<
poly.size();
i++)
1586 int w = size.GetWidth();
1587 int h = size.GetHeight();
1617 : wxXmlResourceHandler()
1628 GetPosition(), GetSize(),
const int maxSelectionDistance
maximal distance for selection of one point
const int polygonPointSize
half size of markers
base class, which stores one mask polygon
void movePointBy(const unsigned int index, const hugin_utils::FDiff2D diff)
relativ moves the point at position index by diff
void movePointTo(const unsigned int index, const hugin_utils::FDiff2D p)
moves the point at position index to the new absolute position p
void removePoint(const unsigned int index)
removes point at the position index from the polygon
VectorPolygon getMaskPolygon() const
returns vector with coordinates of the polygon
unsigned int FindPointNearPos(const hugin_utils::FDiff2D p, const double tol) const
search a point which lies near the polygon line and return the index for inserting the new point
void addPoint(const hugin_utils::FDiff2D p)
adds point at the end to the polygon
bool isInside(const hugin_utils::FDiff2D p) const
checks if given point is inside of the stored polygon
void scale(const double factorx, const double factory)
scales all polygon coordinates by factorx for x position and factory for y position
hugin_utils::FDiff2D getCenter() const
return the center point of the polygon
void insertPoint(const unsigned int index, const hugin_utils::FDiff2D p)
insert point at the position index into the polygon
static MainFrame * Get()
hack.. kind of a pseudo singleton...
void UpdateCropFromImage()
updates the displayed crop in the text boxes (for dragging)
void UpdateMask()
called when mask where changed in MaskImageCtrl
void AddMask()
called when new mask added in MaskImageCtrl
void OnMaskDelete(wxCommandEvent &e)
called when user wants to delete active mask
void SelectMask(unsigned int newMaskNr)
selects the mask with index newMaskNr in the listbox
void UpdateCrop(bool updateFromImgCtrl=false)
updated the crop in the Panorama object with the current values from GUI
xrc handler for mask editor
virtual wxObject * DoCreateResource()
virtual bool CanHandle(wxXmlNode *node)
unsigned int m_activeMask
void setActiveMask(unsigned int newMask, bool doUpdate=true)
mark mask with image as beeing editing
hugin_utils::FDiff2D m_cropCenter
MaskEditorState m_maskEditState
void setImage(const std::string &filename, HuginBase::MaskPolygonVector newMask, HuginBase::MaskPolygonVector masksToDraw, ImageRotation rot)
set the current image and mask list, this loads also the image from cache
void UpdateCrop(hugin_utils::FDiff2D delta)
bool SelectPointsInsideMouseRect(HuginBase::UIntSet &points, const bool considerSelectedOnly)
int scale(int x) const
scale of width/height
std::string m_imageFilename
void OnPaint(wxPaintEvent &e)
drawing routine
T applyRotInv(const T &p) const
void setScale(double factor)
set the scaling factor for mask editing display.
void setDrawingActiveMasks(bool newDrawActiveMasks)
set if active masks should be drawn
void setNewMasks(HuginBase::MaskPolygonVector newMasks, HuginBase::MaskPolygonVector masksToDraw)
updates masks for currently selected image
HuginBase::MaskPolygonVector m_imageMask
MaskEditorPanel * m_editPanel
void startNewPolygon()
starts creating a new polygon
wxColor m_colour_polygon_positive
ImageCache::EntryPtr m_img
ImageRotation
image rotation.
void DrawSelectionRectangle()
void OnLeftMouseDblClick(wxMouseEvent &mouse)
event handler for left double click
void FindPolygon(hugin_utils::FDiff2D p)
void Init(MaskEditorPanel *parent)
double calcAutoScaleFactor(wxSize size)
calculate new scale factor for this image
void DrawPolygon(wxDC &dc, HuginBase::MaskPolygon poly, bool isSelected, bool drawMarker)
void OnKeyUp(wxKeyEvent &e)
event handler for keyboard
ClickPos GetClickPos(vigra::Point2D pos)
void OnRightMouseUp(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
double getScaleFactor() const
get scale factor (calculates factor when fit to window is active)
HuginBase::MaskPolygonVector m_masksToDraw
void OnMouseMove(wxMouseEvent &mouse)
event handler when mouse is moving
void OnSizeFinished(wxTimerEvent &e)
handler called at end of all resize
void OnMiddleMouseUp(wxMouseEvent &mouse)
event handler for middle mouse button, end scrolling
void OnLeftMouseDown(wxMouseEvent &mouse)
event handler when left mouse button is pressed
int transform(int x) const
convert image coordinate to screen coordinates, considers additional added border
wxColour m_color_selection
wxColor m_colour_point_selected
void OnLeftMouseUp(wxMouseEvent &mouse)
event handler when right mouse button is released
ImageRotation m_imgRotation
void rescaleImage()
rescale the image
wxSize DoGetBestSize() const override
returns size of currently scaled image
HuginBase::MaskPolygon m_editingMask
wxColor m_colour_point_unselected
void SetMaskMode(bool newMaskMode)
sets the control to mask (newMaskMode=true) or crop (newMaskMode=false) mode
void OnChar(wxKeyEvent &e)
event handler for scrolling with keyboard
void OnMouseWheel(wxMouseEvent &mouse)
event handler for mouse wheel
wxBitmap m_disabledBitmap
void selectAllMarkers()
select all points of active mask
void setCrop(HuginBase::SrcPanoImage::CropMode newCropMode, vigra::Rect2D newCropRect, bool isCentered, hugin_utils::FDiff2D center, bool isCircleCrop)
updates the crop mode and crop rect
T applyRot(const T &p) const
void OnSize(wxSizeEvent &e)
handler called when size of control was changed
void OnCaptureLost(wxMouseCaptureLostEvent &e)
event handler, when mouse capture is lost, e.g.
HuginBase::UIntSet m_selectedPoints
void OnScroll(wxScrollWinEvent &e)
event handler for remember scroll position
void OnRightMouseDown(wxMouseEvent &mouse)
event handler when right mouse button is pressed
int invtransform(int x) const
translate screen coordinates to image coordinates, considers additional added border
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
wxColor m_colour_polygon_negative
HuginBase::SrcPanoImage::CropMode m_cropMode
void OnMiddleMouseDown(wxMouseEvent &mouse)
event handler for middle mouse button, start scrolling
bool HasMonitorProfile() const
return true if we found a suitable monitor profile and could loading it
static huginApp * Get()
hack.. kind of a pseudo singleton...
#define PI
Header file for Khan's deghosting algorithm Copyright (C) 2009 Lukáš Jirkovský l.jirkovsky@gmail....
void CorrectImage(wxImage &image, const vigra::ImageImportInfo::ICCProfile &iccProfile, const cmsHPROFILE &monitorProfile)
apply color correction to given image using input iccProfile and monitor profile
std::vector< MaskPolygon > MaskPolygonVector
const int maskOffset
polygon can exceed the image maximal maskOffset pixels in each direction bigger polygons will be clip...
std::set< unsigned int > UIntSet
std::vector< hugin_utils::FDiff2D > VectorPolygon
vector, which stores coordinates of one polygon
include file for the hugin project
include file for the hugin project
bool set_contains(const _Container &c, const typename _Container::key_type &key)
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
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.
wxImage imageCacheEntry2wxImage(ImageCache::EntryPtr e)