26#include "vigra/edgedetection.hxx"
38template <
class SrcImageIterator,
class SrcAccessor,
class DestImage>
71 copyImage(
src, destImage(
dest));
83 vigra::BImage* image =
new vigra::BImage(
scaled.width(),
scaled.height(), 255);
84 vigra::cannyEdgeImage(vigra::srcImageRange(
scaled), vigra::destImage(*image), scale,
threshold, 0);
95 vigra::BImage* image =
new vigra::BImage(
scaled.width(),
scaled.height(), 255);
96 vigra::cannyEdgeImage(vigra::srcImageRange(
scaled), vigra::destImage(*image), scale,
threshold, 0);
105 pixels_per_mm= (cropFactor/24.0)* ((width>height)?height:width);
109 pixels_per_mm= (24.0/cropFactor)* ((width>height)?height:width);
132 for(
unsigned int i=0;
i<
lines.size();
i++)
134 for(
unsigned int j=0;
j<
lines[
i].line.size();
j++)
156#define MAX_RESIZE_DIM 1600
159vigra::Point2D
GetFootpoint(
const vigra::Point2D& p,
const vigra::Point2D& p1,
const vigra::Point2D& p2,
double&
u)
164 return vigra::Point2D(p1.x +
diff.x, p1.y +
diff.y);
167vigra::Point2D
GetFootpoint(
const vigra::Point2D& p,
const vigra::Point2D& p1,
const vigra::Point2D& p2)
182 m_start = vigra::Point2D(x, y);
190 m_end = vigra::Point2D(x, y);
198 auto getDist = [](
const vigra::Point2D& p,
const vigra::Point2D& p1,
const vigra::Point2D& p2)->
double
202 if (-0.1 <
t &&
t < 1.1)
240 size_t n=line.
line.size();
246 for(
size_t i=0;
i<
n;
i++)
265 vigra::Point2D p1(0,offset);
266 vigra::Point2D p2(100,100*
slope+offset);
283 if((*it).status==
valid_line && (*it).line.size()>2)
286 const vigra::Diff2D
diff =
vl.GetEnd() -
vl.GetStart();
288 if(
diff.magnitude()>20)
301 if (std::abs(
vl.GetAngle() -
otherLine.GetAngle()) < 0.05)
305 if (
vl.GetLineLength() >
otherLine.GetLineLength())
328 return cp1.error<
cp2.error;
335 template <
class ITERATOR>
340 template <
class ITERATOR,
class DIFFERENCE>
347template <
class ImageType>
354 double roll=(
needsRemap?0:srcImage.getRoll());
405 if (mask.size().area() > 0)
421 if (mask.size().area() > 0)
431 srcImage.getProjection(),srcImage.getHFOV(),srcImage.getCropFactor(),srcImage.getSize());
458 if (std::abs(roll) < 45 || (roll > 135 && roll < 225) || roll > 315)
491 if(
cp.x1>=0 &&
cp.x1<srcImage.getWidth() &&
cp.y1>=0 &&
cp.y1<srcImage.getHeight() &&
492 cp.x2>=0 &&
cp.x2<srcImage.getWidth() &&
cp.y2>=0 &&
cp.y2<srcImage.getHeight())
522 std::set<std::string>
imgopt;
declaration of functions for finding lines
declaration of find lines algorithm
!! from PTOptimise.h 1951
Contains functions to transform whole images.
Dummy progress display, without output.
static void calcCtrlPntsErrorStats(const PanoramaData &pano, double &min, double &max, double &mean, double &var, const int &imgNr=-1, const bool onlyActive=false, const bool ignoreLineCp=false)
virtual double getResultHorizontalFOV()
virtual double getResultHeight()
represents a control point
@ X
evaluate x, points are on a vertical line
@ Y
evaluate y, points are on a horizontal line
struct to hold a image state for stitching
virtual void run()
runs the algorithm.
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
void setHeight(unsigned int h)
set panorama height
const vigra::Rect2D & getROI() const
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
double outputExposureValue
unsigned int getHeight() const
get panorama height
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
unsigned int addImage(const SrcPanoImage &img)
the the number for a specific image
All variables of a source image.
static double calcFocalLength(SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
calcualte focal length, given crop factor and hfov
void deleteAllMasks()
delete all masks
value_type operator()(ITERATOR const &i, DIFFERENCE d) const
value_type operator()(ITERATOR const &i) const
void SetEnd(const int x, const int y)
double GetLineLength() const
void SetEnd(const vigra::Point2D point)
void SetStart(const int x, const int y)
const bool IsVertical() const
const vigra::Point2D & GetEnd() const
void SetStart(const vigra::Point2D point)
double GetEstimatedDistance(const VerticalLine &otherLine) const
const vigra::Point2D & GetStart() const
vigra::FRGBImage ImageType
std::vector< ControlPoint > CPVector
std::vector< std::set< std::string > > OptimizeVector
std::vector< VerticalLine > VerticalLineVector
VerticalLine FitLine(SingleLine line)
HuginBase::CPVector _getFilteredLines(const HuginBase::Panorama &pano, const unsigned int imgNr, ImageType &image, vigra::BImage &mask, const unsigned int nrLines, const bool onlyVerticalLines)
Lines findLines(vigra::BImage &edge, double length_threshold, double focal_length, double crop_factor)
find straightish non-crossing lines find straightish non-crossing lines in an edge map using 8-neighb...
vigra::BImage * detectEdges(const vigra::UInt8RGBImage &input, const double scale, const double threshold, const unsigned int resize_dimension, double &size_factor)
detect and mark edges in an edge image using Canny's algorithm
vigra::BImage edgeMap2linePts(vigra::BImage &input)
marks line point
VerticalLineVector FilterLines(Lines lines, double roll, const bool onlyVerticalLines)
void ScaleLines(Lines &lines, const double scale)
scales the given lines with given factor use in conjugation with HuginLines::detectEdges to scale the...
bool SortByError(const HuginBase::ControlPoint &cp1, const HuginBase::ControlPoint &cp2)
std::vector< SingleLine > Lines
vector of extracted lines from image
double resize_image(const vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, DestImage &dest, int resize_dimension)
int linePts2lineList(vigra::BImage &img, int minsize, double flpix, Lines &lines)
converts a linePts image to a list of lines
vigra::Point2D GetFootpoint(const vigra::Point2D &p, const vigra::Point2D &p1, const vigra::Point2D &p2, double &u)
double calculate_focal_length_pixels(double focal_length, double cropFactor, double width, double height)
HuginBase::CPVector GetControlPoints(const SingleLine &line, const unsigned int imgNr, const unsigned int lineNr, const unsigned int numberOfCtrlPoints)
returns a HuginBase::CPVector with cps_per_lines
HuginBase::CPVector GetVerticalLines(const HuginBase::Panorama &pano, const unsigned int imgNr, vigra::UInt8RGBImage &image, vigra::BImage &mask, const unsigned int nrLines)
searches for vertical control points in given image
HuginBase::CPVector GetLines(const HuginBase::Panorama &pano, const unsigned int imgNr, vigra::UInt8RGBImage &image, vigra::BImage &mask)
searches for all lines, the same as GetVerticalLines execpt that no filtering according to roll angle...
a single line extracted from image
std::vector< vigra::Point2D > line
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.