70 if((b.
x-a.
x)*(p.
y-a.
y)<(p.
x-a.
x)*(b.
y-a.
y))
76 if((b.
x-a.
x)*(p.
y-a.
y)>(p.
x-a.
x)*(b.
y-a.
y))
90 for(
unsigned int i=0;
i<count;
i++)
190 unsigned int count=
oldPoly.size();
192 for(
unsigned int i=0;
i<count;
i++)
197 double distance=norm(p2-p1);
243 return p.
x>=r.left();
245 return p.
x<=r.right();
249 return p.
y<=r.bottom();
268 a=(
q.y-p.
y)/(
q.x-p.
x);
364 if(
slope.squareLength()<1e-5)
387 for(std::set<double>::const_iterator
it=
t.begin();
it!=
t.end();++
it)
579 if((
u>=0.1) && (
u<=0.9))
585 return i==0 ?
j+1 :
i;
667 std::getline(
stream,line);
674 imageSize.setWidth(
w);
677 imageSize.setHeight(h);
709 stream <<
"# w" << imageSize.width() <<
" h" << imageSize.height() << std::endl;
declaration of classes to work with mask
base class, which stores one mask polygon
bool isPositive() const
returns true, if mask type is positive
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
void setImgNr(const unsigned int newImgNr)
sets the associated image number, only used when loading a project, otherwise discarded
void setMaskPolygon(const VectorPolygon &newMask)
set complete vector with all corrdinates of the polygon
vigra::Rect2D m_boundingBox
void rotate90(bool clockwise, unsigned int maskWidth, unsigned int maskHeight)
rotate the polygon by 90 degrees
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 calcBoundingBox()
calculates the bounding box of the polygon to speed up tests
void addPoint(const hugin_utils::FDiff2D p)
adds point at the end to the polygon
void subSample(const double max_distance)
subsamples the polygon, so that the longest distance between 2 points is max_distance
int getWindingNumber(const hugin_utils::FDiff2D p) const
returns the winding number of the polygon around point p
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
bool clipPolygon(const vigra::Rect2D rect)
clips the polygon to the given rectangle
MaskPolygon & operator=(const MaskPolygon &otherPoly)
assign operator
bool parsePolygonString(const std::string &polygonStr)
parses the x and y positions from the given string
const bool operator==(const MaskPolygon &otherPoly) const
comparision operator
void setMaskType(const MaskType newType)
sets mask type
void printPolygonLine(std::ostream &o, const unsigned int newImgNr) const
writes the complete k line which describes the mask to the stream, using the given newImgNr for the i...
hugin_utils::FDiff2D getCenter() const
return the center point of the polygon
int getTotalWindingNumber() const
returns the total winding number of the polygon
void insertPoint(const unsigned int index, const hugin_utils::FDiff2D p)
insert point at the position index into the polygon
void setInverted(const bool inverted)
set mask to normal or inverted
MaskType
enumeration with type of possible masks
void transformPolygon(const PTools::Transform &trans)
transforms the polygon coordinates by the given transformation
#define DEBUG_ASSERT(cond)
#define PI
Header file for Khan's deghosting algorithm Copyright (C) 2009 Lukáš Jirkovský l.jirkovsky@gmail....
bool getIntParam(T &value, const std::string &line, const std::string &name)
bool getPTParam(std::string &output, const std::string &line, const std::string ¶meter)
helper functions for parsing of a script line
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
bool clip_isSide(const hugin_utils::FDiff2D p, const vigra::Rect2D r, const clipSide side)
std::vector< MaskPolygon > MaskPolygonVector
hugin_utils::FDiff2D clip_getIntersection(const hugin_utils::FDiff2D p, const hugin_utils::FDiff2D q, const vigra::Rect2D r, const clipSide side)
std::vector< hugin_utils::FDiff2D > clip_getIntersectionCircle(const hugin_utils::FDiff2D p, const hugin_utils::FDiff2D s, const hugin_utils::FDiff2D center, const double radius)
returns intersection of line and circle
VectorPolygon clip_onPlane(const VectorPolygon &polygon, const vigra::Rect2D r, const clipSide side)
double angle_between(const hugin_utils::FDiff2D a, const hugin_utils::FDiff2D b)
calculates angle between vector a and b in radians
void generateArc(VectorPolygon &poly, const hugin_utils::FDiff2D s, const hugin_utils::FDiff2D center, const double radius, const bool clockwise)
adds an arc with given radius at the end of the polygon, the point is not added to the arc
void LoadMaskFromStream(std::istream &stream, vigra::Size2D &imageSize, MaskPolygonVector &newMasks, size_t imgNr)
load the mask from stream
void SaveMaskToStream(std::ostream &stream, vigra::Size2D imageSize, MaskPolygon &maskToWrite, size_t imgNr)
save the mask into stream
bool clip_insideCircle(const hugin_utils::FDiff2D p, const hugin_utils::FDiff2D center, const double radius)
check if point is inside circle
std::vector< hugin_utils::FDiff2D > VectorPolygon
vector, which stores coordinates of one polygon
TDiff2D< double > FDiff2D
T squareLength() const
Return the square of the length of the vector.
T squareDistance(TDiff2D< T > other) const
Return square of the distance to another point.
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.