27 #ifndef _PANODATA_MASK_H
28 #define _PANODATA_MASK_H
60 Mask_Stack_negative=2,
61 Mask_Stack_positive=3,
65 MaskPolygon() : m_maskType(Mask_negative), m_imgNr(0), m_invert(false) {};
71 int getTotalWindingNumber()
const;
79 bool isPositive()
const;
85 unsigned int getImgNr()
const {
return m_imgNr; };
87 void setImgNr(
const unsigned int newImgNr) { m_imgNr=newImgNr; };
89 void setInverted(
const bool inverted) { m_invert = inverted; };
99 void removePoint(
const unsigned int index);
105 void scale(
const double factorx,
const double factory);
111 bool clipPolygon(
const vigra::Rect2D rect);
115 void rotate90(
bool clockwise,
unsigned int maskWidth,
unsigned int maskHeight);
117 void subSample(
const double max_distance);
126 const bool operator==(
const MaskPolygon& otherPoly)
const;
130 bool parsePolygonString(
const std::string& polygonStr);
134 void printPolygonLine(std::ostream & o,
const unsigned int newImgNr)
const;
138 void calcBoundingBox();
159 template <
class SrcImageIterator,
class SrcAccessor>
162 const vigra::Diff2D imgSize = img.second - img.first;
167 #pragma omp parallel for schedule(dynamic)
168 for(
int y=0; y < imgSize.y; ++y)
171 SrcImageIterator xd(img.first);
173 for(
int x=0; x < imgSize.x; ++x, ++xd.x)
176 bool insideMasks=
false;
178 while(!insideMasks && (i<masks.size()))
180 insideMasks=masks[i].isInside(newPoint);
190 #endif // _PANODATA_MASK_H
void SaveMaskToStream(std::ostream &stream, vigra::Size2D imageSize, MaskPolygon &maskToWrite, size_t imgNr)
save the mask into stream
void applyMask(vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > img, HuginBase::MaskPolygonVector masks)
const int maskOffset
polygon can exceed the image maximal maskOffset pixels in each direction bigger polygons will be clip...
misc math function & classes used by other parts of the program
void LoadMaskFromStream(std::istream &stream, vigra::Size2D &imageSize, MaskPolygonVector &newMasks, size_t imgNr)
load the mask from stream
VectorPolygon getMaskPolygon() const
returns vector with coordinates of the polygon
bool isInverted() const
returns if mask is inverted
void setInverted(const bool inverted)
set mask to normal or inverted
vigra::Rect2D m_boundingBox
MaskType
enumeration with type of possible masks
unsigned int getImgNr() const
returns the associated image number, only used when loading a project, otherwise discarded ...
void scale(const double factor)
scales x and y axis equally by factor
std::vector< MaskPolygon > MaskPolygonVector
void setImgNr(const unsigned int newImgNr)
sets the associated image number, only used when loading a project, otherwise discarded ...
std::vector< hugin_utils::FDiff2D > VectorPolygon
vector, which stores coordinates of one polygon
void setMaskType(const MaskType newType)
sets mask type
MaskType getMaskType() const
returns mask type
base class, which stores one mask polygon